Question

I have readed the API for elevation for Google Maps and what I can understands I must have the map visible to get the elevation for a point (coordinates). But almost nothing is impossible with JavaScript so I wonder now, is it possible to get the elevation from a point without viewing the map?

Thanks in advance.

Was it helpful?

Solution

Do you know what the co-ordinates are for the point? If so, the API for elevation will return the elevation, in both JSON and XML formats. I use the following URL (albeit in PHP, it should work the same for Javascript):

http://maps.googleapis.com/maps/api/elevation/xml?sensor=false&locations=1.111,1.111.

You'll need to parse the results in JS. Switch XML out for JSON in the URL to change the result type.

Edit: If you use this service, you need to use it in conjunction with a Google Map as per their terms and conditions.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top