Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google Maps V3 Polyline Drawing / Editing / Continue Drawing

I'm searching for a way to draw a polyline via google maps v3. Once complete be able to edit the polyline and then continue drawing the same polyline.

I've read much about the DrawingManager (introduced in 3.7) and read much of the API of V3 found here:

https://developers.google.com/maps/documentation/javascript/overlays#drawing_tools

Which shows the example of this:

https://google-developers.appspot.com/maps/documentation/javascript/examples/drawing-tools

The developers.google example is great and allows the user to draw and complete the polyline by clicking on the last vertex. But once it's complete I cant seem to find out how to continue drawing on the same polyline. Is this possible?

I know that Google Maps API is up to version 10 (Frozen). I've even looked in their Release and Experimental versions but there's no talk of it there.

I would be open to any suggestions.

like image 443
Marven Avatar asked Mar 25 '13 22:03

Marven


People also ask

Are Google Maps editable?

To edit a map, choose a map and click Open in My Maps. You'll be taken to My Maps, where you can edit your map.


2 Answers

Issue created with Google: http://code.google.com/p/gmaps-api-issues/issues/detail?id=5213 Hope it gets more "likes"

like image 136
Dmytro Avatar answered Sep 29 '22 04:09

Dmytro


PolylineOptions in DrawingManagerOptions ignores the path atribute. So what you could do is to draw a new polyline between the end of the las polyline and the begining of the new polyline when it is drawn (on polylinecomplete event).

google.maps.event.addListener(drawingManager, 'polylinecomplete', function(event) {
      if (event.type == google.maps.drawing.OverlayType.POLYLINE) {
        //save last point
        //draw a new polyline to join last final point and this first point if this isn't the first polyline
      }
});

Hope it helps

like image 42
Javier Candalaft Avatar answered Sep 29 '22 05:09

Javier Candalaft