javascript - Load polygon in Google map api -


i want implement user can draw area in google map our application. when come back, should load data drew him/her.

i've done 2 way of method. 1 is,

  1. using drawing manager.

    drawing polygon in google map using javascript

    https://developers.google.com/maps/documentation/javascript/drawinglayer

  2. using google map api data layer. http://jsfiddle.net/dg9e93qy/

from first method, can allow user drag, , can restrict user drawing multiple polygons. but cannot load polygons again drawing. found somewhere can load polygons. https://developers.google.com/maps/documentation/javascript/examples/polygon-simple.

but using polygon instance show polygons not drawing.

here need other 2 solutions.

  • whether should load polygon data map using drawing.

  • should enable drawing option using polygon https://developers.google.com/maps/documentation/javascript/examples/polygon-simple

from second method, can coordinates, , can load polygon again. cannot polygon area that. (actually getting geojson data)

here cannot area drawn place. how that?

any answer first method or second methods good.

i have done alternate that, created polygon instead of loading in same drawing manager.

after drawing complete, removed drawing manager , created polygon. had separate button remove polygon map.

if remove polygon, removed polygon map , recreated drawing manger.

this solved issue.

drawingmanager.setmap(null);                     bermudatriangle = new google.maps.polygon({                         paths: polygonsarray,                         strokecolor: '#ff0000',                         strokeopacity: 0.8,                         strokeweight: 2,                         fillcolor: '#ff0000',                         fillopacity: 0.35                         //,editable: true                     });                     bermudatriangle.setmap(map); 

Comments

Popular posts from this blog

gridview - Yii2 DataPorivider $totalSum for a column -

java - Suppress Jboss version details from HTTP error response -

Sass watch command compiles .scss files before full sftp upload -