I note that there is the Google Elevation API.

I see they have an example at the bottom showing an elevation profile for a line. Is there a premade service someone has put up on a website for me to submit a line and it will return elevation values at preset distances along the line?

I have downloaded the SRTM data for the area I'm interested in and can do this using ArcGIS, but it would be good to compare it to what Google Elevation API has as well.

I see someone has done this with Mathematica, but I have never used this program and don't understand how easy it would be for a beginner to produce what they have done on the blog. General comments about this are welcome.

  • I also see someone has written a lovely little tool comparing SRTM and GE API data, but there doesn't seem to be anything from SRTM in Australia. members.chello.at/stephen.joung/indexGoogleHeights_v3_2.html
    – ndthl
    Mar 7 '13 at 7:52
  • I also found this demo of the API, returning an elevation for a lat/long pair: maps.google.com/maps/api/elevation/…
    – ndthl
    Mar 7 '13 at 8:01
  • Using the above API example, I'm guessing I could develop a Python script that iterates through a list of coordinates, adding the resulting elevation to the list or creating another list with them in. So I could create a bunch of points along the lines using a line to point sampling tool, then feed their coordinates into this script. Anyone know how to make such a script?
    – ndthl
    Mar 7 '13 at 8:06

You can use the Official Example


The Code is well documented so should be easy (with javascript knowledge) to use your own paths to calculate values.

Takes an array of ElevationResult objects, draws the path on the map and plots the elevation profile on a Visualization API ColumnChart.

THE KEY PART OF THIS IS: You can specifiy the number of samples along that path - in this case 256

// Create a PathElevationRequest object using this array.
    // Ask for 256 samples along that path.
    var pathRequest = {
      'path': path,
      'samples': 256

Notes: Values are in Meters

Elevation API is required to be used with Google Services

Example Request:


  • Hi, thanks for the suggestion and yes I saw this example. I guess my interest in the simple elevation-at-coordinates example was it returned an actual number on the screen. Basically I'm interested in getting my hands on actual elevation values via this API. The section of code from your example that I'm most interested in is // Extract the elevation samples from the returned results // and store them in an array of LatLngs. var elevationPath = []; for (var i = 0; i < results.length; i++) { elevationPath.push(elevations[i].location);
    – ndthl
    Mar 7 '13 at 22:57
  • Is there a way to dump this array into a CSV file or something? Then I can have the values myself rather than giving them to Google Charts.
    – ndthl
    Mar 7 '13 at 22:59
  • This service needs to be used with Google Services.
    – Mapperz
    Mar 8 '13 at 2:45
  • ok so there's no way to get actual numbers out of it?
    – ndthl
    Mar 8 '13 at 2:52
  • 1
    you will get the same for individual as bulk, but limited to 1500 request per IP address every 24hrs. We use FME for bulk geocoding (fmepedia.safe.com/articles/How_To/Using-the-HTTPFetcher) for geocoding (yahoo and google) though have enterprise licensing for both.
    – Mapperz
    Mar 15 '13 at 1:35

If you want to duplicate the functionality of the Google Elevation service using your own data, you might want to consider using GDAL. I wrote just such a service and it is very fast. I wrote mine using the C# implementation of GDAL. I had never used GDAL before, but with the sample code provided with the library, it didn't take me very long to figure it out.

The steps include:

  • Loading the raster with GDAL
  • Getting the XY coordinates of the raster as well as the pixel width & height.
  • Determining the location of the pixel you want (in my case, I assume they're in the same coordinate system).
  • Reading that pixel's value and returning it.

If you want the points along a line, just determine an interval and get the points along the line at that interval and use the same code to get the elevation at each location.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.