[Google Maps API v3] retrieving all the coordinates of polylines

3,065 views
Skip to first unread message

Mark

unread,
Apr 17, 2010, 1:12:25 PM4/17/10
to Google Maps JavaScript API v3
I am using the polyline arrays tutorial at
http://code.google.com/apis/maps/documentation/v3/overlays.html#Polylines

I can not seem to get all of the coordinates into a form - at the
moment just the latest click show -
document.getElementById('textarea').value =
path.getAt(pathCoordinates.length, event.latLng);

How can I return all of the coordinates like "(54,0), (53,0)" etc?

--
You received this message because you are subscribed to the Google Groups "Google Maps JavaScript API v3" group.
To post to this group, send email to google-map...@googlegroups.com.
To unsubscribe from this group, send email to google-maps-js-a...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-maps-js-api-v3?hl=en.

Luke Mahé

unread,
Apr 20, 2010, 6:48:10 PM4/20/10
to google-map...@googlegroups.com
Hi Mark,

Can you please supply a link to your example? It will help in understanding what you are doing.

Thanks

- Luke

rccc

unread,
May 18, 2010, 12:21:08 PM5/18/10
to Google Maps JavaScript API v3
Hello Mark,

i found a response here :

http://groups.google.com/group/google-maps-js-api-v3/browse_thread/thread/fa1347fc6e15b234/aa5feb1665e30d48?lnk=gst&q=polyline+getPath#aa5feb1665e30d48

var coordinates = [];
poly.getPath().forEach(function(latLng) {
coordinates.push(latLng);
});

...

On 17 avr, 19:12, Mark <m...@marksmusiconline.co.uk> wrote:
> I am using thepolylinearrays tutorial athttp://code.google.com/apis/maps/documentation/v3/overlays.html#Polyl...
>
> I can not seem to get all of the coordinates into a form - at the
> moment just the latest click show -
> document.getElementById('textarea').value =path.getAt(pathCoordinates.length, event.latLng);

Jefferson Maretti

unread,
Sep 10, 2015, 6:34:23 PM9/10/15
to Google Maps JavaScript API v3, ma...@marksmusiconline.co.uk
You can do 

yourPolyLine.getPath().getArray();



Em sábado, 17 de abril de 2010 14:12:25 UTC-3, Mark escreveu:
I am using the polyline arrays tutorial at
http://code.google.com/apis/maps/documentation/v3/overlays.html#Polylines

I can not seem to get all of the coordinates into a form - at the
moment just the latest click show -
document.getElementById('textarea').value =
path.getAt(pathCoordinates.length, event.latLng);

How can I return all of the coordinates like "(54,0), (53,0)" etc?

--
You received this message because you are subscribed to the Google Groups "Google Maps JavaScript API v3" group.
To post to this group, send email to google-map...@googlegroups.com.
To unsubscribe from this group, send email to google-maps-js-api-v3+unsub...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages