Add ArcGIS Server dynamic layer in Google Earth using the GE api

487 views
Skip to first unread message

d_rOck

unread,
Oct 22, 2009, 8:38:54 PM10/22/09
to KML Developer Support - Google Earth Plug-in
Hello!
I'm trying to add a dynamic layer from ESRI's sample server into
Google Earth using the GE api.

I know it's possible using the Google Maps API, but the api isn't the
same.

Any help or tips will be greatly appreciated!

Here's the simple code for Google Maps:

<!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>My Test</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/
>

<script src="http://maps.google.com/maps?file=api&v=2&key=abcdefg"
type="text/javascript"></script>
<script src="http://serverapi.arcgisonline.com/jsapi/gmaps/?v=1.4"
type="text/javascript" ></script>

<script type="text/javascript">

var gmap = null;
var dynamicMap;

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);

dynamicMap = new esri.arcgis.gmaps.DynamicMapServiceLayer
("http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/
Demographics/ESRI_Population_World/MapServer");
}

function addDM (){
gmap.addOverlay(dynamicMap);
}

function removeDM (){
gmap.removeOverlay(dynamicMap);
}

</script>
</head>

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

<input type="button" value="On" onclick="addDM();"/>
<input type="button" value="Off" onclick="removeDM();"/>
</body>

</html>

jnewmoyer

unread,
Oct 25, 2009, 11:09:53 PM10/25/09
to KML Developer Support - Google Earth Plug-in
If the web service provides KML support then all you need to do is use
the GE API fetchKml method with the appropriate URL. Since the Earth
API is much different than the Maps API there is no Overlay object to
extend as is the case with the ESRI provided DynamicMapServiceLayer
object. Here is a good example of a GE API - ArcGIS mashup which adds
goes down to the lower level geometry objects to add the KML to the
Globe.

http://www.flex888.com/618/google-earth-for-browser-mashup-with-arcgis-javascript.html

Jason
http://newmoyergeospatial.com
Reply all
Reply to author
Forward
0 new messages