As announced on the Google Lat Long Blog last week, Google Maps has added a new Terrain map type that displays physical features and, quite frankly, is just dang pretty to look at. If you haven't tried it out yet, search for Mount Everest, the Grand Canyon, Glacier Bay National Park, or any other place that's suffered (enjoyed?) the natural forces of erosion and tectonic activity. We didn't enable the Terrain map type by default in the API as we didn't want to "surprise" developers and suddenly pop a new button on your maps, but we have made it very easy to add this type. Just insert code like this after initializing
GMap2 to get a Terrain button on your map:
In addition to the new map type, another subtle change was made to the Google Maps interface: the Hybrid button was removed, and was replaced with a drop-down menu under the Satellite button with a Show Labels checkbox. This new UI reflects the fact that the hybrid layer really just consists of satellite tiles combined with a transparent tile layer of information from the standard map tiles. We've released this new UI functionality to developers within the
GHierarchicalMapTypeControl. The new control defines functions to add relationships to the control so you can specify how these drop-down lists will appear. For information on how to set up these relationships, see Modifying the Makeup of Standard Controls in the API documentation.
For those who want to mimic the current maps UI, just replace your
GMapTypeControl object with a
GHierarchicalMapTypeControl object — the existing
G_HYBRID_MAP relationship is specified by default. For those who want to use this control for their custom maps, however, you can clear the defaults and specify whatever relationships make sense for you.
As an example, I used the awesome Google Maps Creator java application from UCL-CASA to turn freely available ESRI SHP files into tile layers. After getting the custom map API code generated automatically by the application for all my layers, I combined them into one map and added in the new map type control. The result is a map with a drop-down that lets you switch between the four tile layers (various data for San Francisco county). Try it out below — and hopefully you'll be inspired to use the control for your own custom maps! As always, please post questions in the forum.