We recently did several posts about drawing contours using altitude data from different Altitude API services. The first version used the Google Maps Elevation API and the second used Mapzen’s elevation API. The biggest problem was that the API’s are throttled, in Google’s case, to stop abuse and in Mapzen’s case due to limited server resources. Mapzen recommended that we instead switch to using a different method for getting the altitude data from them. They provide the option to get the altitude data in the form of tiles similar to the tiles used in various online maps, but with just altitude data. So, we decided to try it out.
We expected some improvement in speed, but it turned out to be a much faster method than we expected and works very well. The tiles are 256 x 256 points of data and we use one to four tiles, depending in the location chosen. The previous method using the elevation API took about 40 seconds to retrieve 100 x 100 data points, but the new method gets all the data in a couple of seconds despite getting many more data points. In fact we found it was so fast and because it was allowing us to get so much more data, what was taking the time was calculating the contours. So we did some work on optimising that code and managed to get that quite a bit faster too. It can still take a little time if you ask for too many contours close together.
We tested it on Rio de Janeiro and discovered that Mapzen’s elevation data is better than Google Earth’s default layer for Rio. We discussed in this post the poor quality of Google Earth’s elevation data for Rio by comparing it to the 3D data. Mapzen assures us that all their elevation data is open data, so Google might want to look into the discrepancies and update their data. There are probably other areas where Google Earth’s data is better quality, as Google has access to a number of different data sources for elevation data, some of which are not in the public domain.
In Google Earth with 3D imagery turned off, Sugarloaf Mountain is entirely at sea level, but the Mapzen data results in reasonably accurate contours of it.
The faster data access allows us to draw more detailed contours than before.
Note that we automatically zoom in or out depending on the size of the area you choose. We could, if if we choose produce much higher resolution contours in most instances although it would take a lot longer to calculate. We chose not to as this is just a ‘for fun’ project that we haven’t really found a use for. If any of our readers has a specific use for it and does require higher resolution contours, then let us know in the comments and we will consider adding that option.
Using it is similar to last time. Just draw a polygon of the area you are interested in, save it as a KML, upload it here, select the desired options then click ‘Draw contour’.
Altitude: m above sea level
Contour every: m