acwalker

Problem displaying dynamic map services with ArcGIS Google API

Discussion created by acwalker on May 29, 2012
Latest reply on May 30, 2012 by nliu
The knowledge base article shows how to overlay a service from ArcGIS Server over the google maps base layer.  The code in the article works perfectly until I replace the dynamic URL with my own map service.  I cannot get any of our dynamic map services to overlay like the ESRI one does.  Here's my code:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml">
<head>
  <title>ArcGIS JavaScript Extension for the Google Maps API Example</title>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
  <script src="http://maps.google.com/maps?file=api&v=2&key=AIzaSyDDlcIQ61bcnNSaLKNoBaD6u09Yq1WuUb8" type="text/javascript"></script>
  <script src="http://serverapi.arcgisonline.com/jsapi/gmaps/?v=1.6" type="text/javascript" ></script>

  <script type="text/javascript">
  
    var gmap = null;

    function initialize() {
      gmap = new GMap2(document.getElementById("gmap"));
      var centerat = new GLatLng(0,0);
      gmap.addControl(new GLargeMapControl());
      gmap.addControl(new GMapTypeControl());
      gmap.setCenter(centerat, 1);
      var dynamicMap = new esri.arcgis.gmaps.DynamicMapServiceLayer("http://map.entrix.com/ArcGIS/rest/services/Atlases/USA/MapServer", null, 0.75, dynmapcallback);
    }

    function dynmapcallback(mapservicelayer) {
      gmap.addOverlay(mapservicelayer);
    }

  </script>

</head>
<body onload="initialize();" onunload="GUnload();">
<div id="gmap" style="width: 500px; height:500px;"></div>
</body>
</html>

Outcomes