Earlier this year I posted an article on how to display MapViewer generated tiles in a Google Maps application. In this post I will discuss how to display Google Maps tiles in a MapViewer/Oracle Maps application.
This API class is a thin wrapper of the official Google Maps API, and as such you will need to get your own Google Maps key for your application.
The basic steps for displaying Google Maps in your Oracle Maps application are:
Again you will need to get your own Google Maps key from Google and set it in the above script tag.
Step 2. Add a Google Maps tile layer to the MVMapView object
mapview = new MVMapView(document.getElementById("map"), baseURL);
baseMap = new MVGoogleTileLayer() ;
That's all it takes to display a basic Google Maps map in your MapViewer application.
You can also change the type of map you get from Google Maps. Here is an example:
var mapType = G_HYBRID_MAP;
Where basemap is a MVGoogleTileLayer instance. Note that G_HYBRID_MAP is a constant defined by the imported Google Maps API library and represents a hybrid Google Maps type. The full description for this method is:
This method sets the type of the map, which can be one of the following predefined Google Map types, G_NORMAL_MAP, G_SATELLITE_MAP, G_HYBRID_MAP and G_PHYSICAL_MAP.
The only other method defined on the MVGoogleTileLayer class is getMapType(), which returns the current map type of the Google Maps being displayed.
Finally, as part of your application cleanup, please call Google Maps' clean-up method GUnload() (such as in the HTML page's unload event listener).