1

I was able to do the same as this example in order to let the user draw a polygon and it works perfectly. Now I want to display an existing polygon inside the same map. How can I do that?

To explain more: I have used the first example for the create mode in my spring boot/ angularjs application. For the edit mode, I want to display the polygon that the user already drawn and let him draw another one.

Can anyone help me please?

Ne AS
  • 1,490
  • 3
  • 26
  • 58

1 Answers1

0

It's possible to do that using <shape path="{{vm.paths}}" name="polygon" ></shape> inside the <ng-map>. Thanks to the answer of this issu, this is how it's possible:

<div ng-app="myapp" ng-controller="DrawingManagerCtrl as vm">
        <ng-map zoom="12" center="28.623457, 77.196452"
                map-type-id="ROADMAP"
                street-view-control-options="{position: 'LEFT_CENTER'}">
            <drawing-manager on-overlaycomplete="vm.onMapOverlayCompleted()"
                             drawing-control-options="{position: 'TOP_CENTER',drawingModes:['polygon','marker']}"
                             drawingControl="true"
                             drawingMode="null"
                             rectangleOptions="{fillColor:'red'}"
                             circleOptions="{fillColor: '#FFFF00',fillOpacity: 1,strokeWeight: 5,clickable: false,zIndex: 1,editable: true}">
            </drawing-manager>


            <shape path="{{vm.paths}}"  name="polygon" ></shape>
        </ng-map>
</div>
Community
  • 1
  • 1
Ne AS
  • 1,490
  • 3
  • 26
  • 58