From http://help.arcgis.com/en/webapi/javascript/arcgis/demos/util/util_measureline.html, I loaded the JavaScript, which provides the function to draw a polyline and receives the line's lengh. I followed the approach in Google Maps Layer for ArcGIS JavaScript API: Examples (http://gmaps-utility-gis.googlecode.com/svn/tags/gmapslayer/1.0/docs/examples.html) to try to add a google map layer on the top of ESRI's map. But I can't see the google map. The code is presented below. If you want to try, please copy, paste it onto Notepad, and then save it as htm file. Then, you can open it locally. Hopefully, you can hint me something. Thanks. I also tried in several other samples *see my other post threads). The common thing is that once I get ESRI's maps, I can't add google map layer on the top. I tried another way, add ESRI maps on top of Google Maps. It works for an ESRI dynamic layer but not for an ESRI cached tiled layer.
<html lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=7,IE=9" /> <!--The viewport meta tag is used to improve the presentation and behavior of the samples on iOS devices--> <meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no"/> <title>Measure Distances</title> <link rel="stylesheet" type="text/css" href="http://serverapi.arcgisonline.com/jsapi/arcgis/2.4/js/dojo/dijit/themes/claro/claro.css">
function init() { //identify proxy page to use if the toJson payload to the geometry service is greater than 2000 characters. //If this null or not available the project and lengths operation will not work. Otherwise it will do a http post to the proxy. esriConfig.defaults.io.proxyUrl = "/arcgisserver/apis/javascript/proxy/proxy.ashx"; esriConfig.defaults.io.alwaysUseProxy = false;
var startExtent = new esri.geometry.Extent(-80.0571,41.3697,-74.4321,44.0822, new esri.SpatialReference({wkid:4326}) ); var map = new esri.Map("map", {extent:startExtent}); dojo.connect(map, "onLoad", initFunctionality);
</head> <body> Click and hold down on the map to draw a line that will be added to the map. The application will then use the geometry service to project and compute the length of the line. <div id="map" class="claro" style="width:1024px; height:512px; border:1px solid #000;"></div>