ArcGIS Server KML with Google Maps

1468
3
07-28-2011 06:55 AM
BrianGustafson
New Contributor III
Is there a way to use the kml that is served from ArcGIS server in an app created with the Google Maps api?  When I try it with my service it never loads.
0 Kudos
3 Replies
HemingZhu
Occasional Contributor III
Is there a way to use the kml that is served from ArcGIS server in an app created with the Google Maps api?  When I try it with my service it never loads.


I had used kml in Google Map Api with Google Earth plug. You can get the kmz for the mapserver through REST:
Here is the part of code that my give me some clue:
kmlUrl="http://xxx/ArcGIS/rest/services/yourmapservice/MapServer/kml/mapImage.kmz";
geoXml = new GGeoxml(kmlUrl);
map.addOverlay(geoXml);
0 Kudos
BrianGustafson
New Contributor III
My map shows up correctly but when I go to add in my kmz file nothing happens.  I have tested it with other kmz and kml files and it works sometimes.  when I try and open my kmz in Google Earth it works every time.

var url = "http://XXXXX/ArcGIS/rest/services/MyService/MapServer/kml/mapImage.kmz";           
    var TSGTLayer = new google.maps.KmlLayer(url, {preserveViewport:false, map:map});
0 Kudos
HemingZhu
Occasional Contributor III
My map shows up correctly but when I go to add in my kmz file nothing happens.  I have tested it with other kmz and kml files and it works sometimes.  when I try and open my kmz in Google Earth it works every time.

var url = "http://XXXXX/ArcGIS/rest/services/MyService/MapServer/kml/mapImage.kmz";           
    var TSGTLayer = new google.maps.KmlLayer(url, {preserveViewport:false, map:map});


If your kmz works on google earth, I suggest that you add google earth plugin as a base layer and add kmz on it when you switch your base layer to google earth plug in. One approach i did is save kmz from the map service to a specific location (saying sub folder under your web application). I find it more stable. One down side is that it is a snapshot.
0 Kudos