Displaying a Google Map in IDL
QUESTION: I would like to be able to display a Google map in an IDL graphics window. Is this possible?
ANSWER: If you mean display a Google map with a limited set of the outstanding interactivity you get with a Google map in a browser window, then the answer is yes, you can display a Google map in an IDL graphics window. To do so, you must take advantage of the Google Static Maps API.
I have implemented much of this functionality for you in a compound widget-object named cgGoogleMapWidget. This program creates a draw widget in a user interface, and populates the draw widget with a Google map that is obtained at run-time from the Google Static Map web page. The map will be displayed in it's own top-level base widget if you do not provide the identifier or a parent widget, and it will pull down a map of Coyote's home town if you don't supply another location.
You can see how this works, by typing this command.
IDL> void = cgGoogleMapWidget()
The result is shown in the figure below.
|A Google map shown in an IDL graphics window.|
There are significant limitations for how you can interact with a static Google map. In the first place, the static map is returned from Google as a raster file in JPEG, GIF, or PNG format. It is not possible to zoom and pan the map as you might do with a Google map in a browser window. Nevertheless, if you can accept a momentary delay while a new map is fetched, you can zoom into and out of the map with the buttons provided, and even change the type of map displayed. Terrain maps (shown in the figure), satellite maps, road maps, and hybrid maps are all supported. Although not shown here, the widget also supports a limited set of Google markers that can be placed on the map image.
The most interesting aspect of the cgGoogleMapWidget is that it automatically creates a map coordinate object (cgMap) that can be use to navigate the image and annotate it. This gives you the ability to do things like add box axes, grid lines, user-written markers, and all manner of other annotations to the map, using other Coyote Library mapping routines. Here, for example, is a cgGoogleMapWidget that I have modified to show a LiDAR track in the MABEL LiDAR data browser I built to work with MABEL LiDAR data.
|An annotated Google map from the MableBrowser program, showing a LiDAR elevation data track on a satellite map.|
The programs required to use this Google map functionality can be found in the Coyote Library.
Version of IDL used to prepare this article: IDL 7.1.2.