Google Maps Tiled Terrain Layer demo

If you want 'mouse over with altitude' on your web map mashup, then here is a way of doing it. As you scroll over the map below, the altitude under the map pointer should be shown. This should have a very good correspondance to the Google Physical layer contours which I believe have been obtained from the same 3 arc second SRTM data. The Terrain data is updated at the end of each pan/zoom of the map. Bilinear interpolation is used when computing the terrain altitude under the mousepointer.

The demo uses a terrain tile server hosted on Google App Engine to serve tiles of terrain data holding 15x15 terrain heights in JSON format. The source data is SRTM which has 3 arc second (approximately 90m) horizontal sample spacing. The demo server covers the area 8W to 2E and 49N to 60N which includes most of the UK. Terrain data is served at resolutions of 240, 120, 60, 40, 20, 12, 6 and 3 arc seconds which together amount to around just 570Mbytes.

Using around one terrain sample for each 8 map pixels enables good responsiveness without using excessive server bandwidth. The following mapping is suggested between Google Maps zoom and Terrain Resolution.

Google Maps Zoom GMaps Metres Per Pixel Terrain Data Arc Seconds Meters per Arc Second Map Pixels per Terrain Sample
8 611 240 7423 6.1
9 306 120 3711 6.1
10 153 60 1855 6.1
11 76 40 1237 8.1
12 38 20 618 8.1
13 19 12 371 9.7
14 9.5 6 186 9.7
15 4.8 3 93 9.7
16 2.4 3 93 19.4
17 1.2 3 93 38.8

The server is at . URL parameters are e= longitude in whole arc seconds (-648000 to 648000), n=latitude in whole arc seconds (-324000 to 324000) , s= resolution in whole seconds, id= user's request id. A typical request looks like this>  

which gives a response like this  


The response will include the 15 x 15 terrain tile that includes the location given, on a raster of 15 x the resolution in arc seconds. Each terrain cell is base64 encoded as two digits using the following alphabet.


This gives a range of 0 to 4095 metres, quite sufficient for the UK. Below sea level samples have been clamped to 0m. If the tile is all 0m then "sea level" is returned instead of all As. If the tile is out of area then "no data" is returned.

Source code for the Terrain Layer is here. It should be usable with any web mapping API.

For now, please don't use my UK terrain server in your own applications.

For any enquires please email to bill-dot-chadwick2-at-gmail-dot-com.

(C) Bill Chadwick Jan 2010.