(1) create a simple Google map page, which can be found in the Google Maps documentation.
(2) Add reference of ArcGIS javascript API to Javascript, for example:
<MCE: script src = "http://serverapi.arcgisonline.com/jsapi/gmaps? V = 1.4 "mce_src =" http://serverapi.arcgisonline.com/jsapi/gmaps? V = 1.4 "type =" text/JavaScript "> </MCE: SCRIPT>
(3) Use WebService in the initialize () function to create a layer provided by ArcGIS online, for example:
VaR dynamicmap = new ESRI. ArcGIS. Gmaps. dynamicmapservicelayer <br/> ("http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Demographics/ESRI_Population_World/MapServer ")
(4) add this layer to the GMAP object, for example:
GMAP. addoverlay (mapservicelayer );
(5) Save and open it in the browser.
There is another more flexible method to load the layers obtained by external services.
(3) Use the constructor with four parameters to create a layer object in initialize (), for example:
VaR dynamicmap = new ESRI. ArcGIS. Gmaps. dynamicmapservicelayer <br/> ("http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Demographics/ESRI_Population_World/MapServer", <br/> null, 0.75, dynmapcallback );
The four parameters are:
1. Map Service URL
2. Image Format parameter, set to null
3. Transparency: 0-1. The smaller the number, the more transparent it is.
4. callback function. That is, after executing this constructor, execute this function immediately. And pass itself as a parameter to the callback function.
(4) add this layer to GMAP In the callback function.
Function dynmapcallback (mapservicelayer) {<br/> GMAP. addoverlay (mapservicelayer); <br/>}