More fun with contours

Last week we had a look at drawing contour lines using the Google Maps Elevation API. Because of restrictions on what you are allowed to do with Google’s elevation data, we chose not to create KML files from it. We have since talked to another elevation API provider, Mapzen and they assure us that they use open data from USGS and NOAA and we may do whatever we like with it.

Google’s elevation data, as used in Google Earth is higher resolution in many locations than the Mapzen data because Google also has access to the USGS and NOAA data, but have supplemented it with other sources that are not as open.

Here is an example of what is possible with the new version of our tool:

To try it out with default settings, just click the ‘Draw Contour’ button and see what happens. The default settings should take about 30 seconds to complete. When it is done, it shows the result in the Google Map below as well as downloading a KML file, so you can view the contours in Google Earth.

To use it with your own settings, draw a polygon in Google Earth of the approximate area you are interested in, save it as a KML then select it below. If you do not select a KML file then it will default to using an area in British Columbia, Canada that we selected for its very mountainous terrain.

You can choose how many rows and columns of altitude data to obtain. The Mapzen elevation API limits the number of queries you can make in a given time to prevent individual users from degrading the overall system performance, so very high resolutions take a long time. Remember that doubling the rows and columns will take four times as long to complete.

Selecting ‘Show Altitude Grid’ only works in conjunction with the ‘Single contour’ mode. It displays the grid of the altitudes that were obtained from the Mapzen API and shows them in red if they were above the selected altitude, or green if they were below the selected altitude. Zoom in to see how they relate to the contour line.

[ Update: Also see this post regarding improvements we made to the algorithm. ]

Create KML
Curves (experimental)
Show Altitude Grid
Altitude: m above sea level
Contour every: m

If you don’t like the styling of the contour lines in the KML, you can change them in Google Earth from the properties of the containing folder rather than having to modify each individual contour.

Let us know in the comments if you find any bugs or have suggestions for improvements. We would also love to know if anyone finds this tool useful for anything.

About Timothy Whitehead

Timothy has been using Google Earth since 2004 when it was still called Keyhole before it was renamed Google Earth in 2005 and has been a huge fan ever since. He is a programmer working for Red Wing Aerobatx and lives in Cape Town, South Africa.

PLEASE NOTE: Google Earth Blog is no longer writing regular posts. As a result, we are not accepting new comments or questions about Google Earth. If you have a question, use the official Google Earth and Maps Forums or the Google Earth Community Forums.


  1. I think the tool does not cope well with smaller scales. Tried it with a 30 sq km polygon, 50×50 row/col, 5 m contour. I get an abstract geometric drawing – nice by itself 🙂 and certainly trying to show the contour, but nowhere near as clear and precise as yours.

  2. Hey Timothy! This looks great.

    You should definitely look at extracting contours from our elevation tiles — it will be much faster than hitting the API. We recommend generating a contour using our GeoTIFF elevation tiles and GDAL. More information is here:{z}/{x}/{y}.tif

  3. Timothy… Well, I’ve noticed some kind of issue. I took the kml file that I gave to you before [ ] – and ran it through this tool. I guess it doesn’t really use the exact polygon and I found I needed to increase the grid size to 200 x 200 to get all the edges included.

    Additionally, I have no real way at present of knowing the true altitude of the top of the existing dam so I just used the value GoogleEarth Pro gives when I cursor over the dam = 1500 meters. I also just wanted only one contour line so I changed that value.

    The file it created – draws the contour line about 100 meters higher than the top of the dam and floods 10 surrounding towns! I just wanted to know what the border of the lake would be if the thing was “full.” [ and perhaps 10 ft higher ]

    For some reason the elevation numbers don’t match with Google Earth. – guess that’s a bug?? or a calculation error?? or using different dataset?? or ______??

    • Timothy Whitehead says:

      Have a look at this file. I used a grid of 200×200 and contours every 10 m. It is always worth using multiple contours as it doesn’t take longer and you can turn off the ones you don’t want. I have only selected three contours: 1490 m in Green. 1500 m in blue and 1510 m in black. You can easily turn on other altitudes in the KML file.
      I believe the water is currently around 1490 to 1495 m and the top of the dam is at 1500 m. You will notice that there are almost no buildings withing the blue contour (keeping in mind its relatively low resolution).

  4. I’m an amateur trying to find whether current topo data exist that would let me get to contours. General plan is to import and use in a 3D CAD model, for a residential excavation/building project, so as to show retaining-walls, cuts & fills, etc. I’d need something better than the standard mapping intervals that I’ve seen, to please permitting people, who probably want to see something like 2-foot contours. I would be willing to pay for the data. Last time I checked, the standard local alternative was to beg a surveying company to do the work for several thousand US dollars (and that’s if they will even consider it, because of the steep terrain involved) and provide me with a very limited set of coordinates for that cost, so just about any alternative is preferable. Any recommendations along the lines of what’s being covered in this thread?

  5. salvador says:

    Hi Timothy. Excellent tool. Of course, it has some limitations, but the bottom line is really useful. Yesterday it worked perfectly. Today it doesn’t. I hope everything will be sorted out.

PLEASE NOTE: Google Earth Blog is no longer writing regular posts. As a result, we are not accepting new comments or questions about Google Earth. If you have a question, use the official Google Earth and Maps Forums or the Google Earth Community Forums.