Solved! Go to Solution.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <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>OpenStreetMap- default options</title> <link rel="stylesheet" type="text/css" href="http://serverapi.arcgisonline.com/jsapi/arcgis/2.6/js/dojo/dijit/themes/claro/claro.css"> <script type="text/javascript"> var djConfig = { parseOnLoad: true }; </script> <script type="text/javascript" src="http://serverapi.arcgisonline.com/jsapi/arcgis/?v=2.6"></script> <script type="text/javascript"> dojo.require("esri.map"); dojo.require("esri.layers.osm"); var map, osmLayer; function init() { //setup the copyright text http://www.openstreetmap.org/copyright var copyrightText= '© <a href="http://www.openstreetmap.org/" target="_blank">OpenStreetMap</a> contributors, ' + '<a href="http://creativecommons.org/licenses/by-sa/2.0/" target="_blank">CC-BY-SA</a>'; dojo.byId('osmCopy').innerHTML = copyrightText; var extent = new esri.geometry.Extent({"xmin":-10023722.578230502,"ymin":3498675.6586681586,"xmax":-9996969.618330726,"ymax":3517784.9157394273,"spatialReference":{"wkid":102100}}); map = new esri.Map("map",{extent:extent,logo:false}); osmLayer = new esri.layers.OpenStreetMapLayer(); dojo.connect(osmLayer,'onUpdateEnd',function(){ console.log('update end'); }); map.addLayer(osmLayer); var details = ""; details = "loaded: " + osmLayer.loaded + "<br />"; details += "initialExtent: " + dojo.toJson(osmLayer.initialExtent.toJson()) + "<br />"; details += "fullExtent: " + dojo.toJson(osmLayer.fullExtent.toJson()) + "<br />"; details += "spatialReference: " + dojo.toJson(osmLayer.spatialReference.toJson())+ "<br />"; dojo.byId("info").innerHTML = details; } dojo.addOnLoad(init); </script> </head> <body class="claro" style="font-size: small; font-family: Arial Unicode MS,Arial,sans-serif;"> <div id="map" style="position:relative;width:700px; height:500px; border:1px solid #000;"> <div id="osmCopy" style="position:absolute; color:black;font-weight:bold;right:10px; bottom:10px; z-Index:999;"></div> </div> <div id="info" style="padding:5px; margin:5px; background-color:#eee;"></div> </body> </html>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <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>OpenStreetMap- default options</title> <link rel="stylesheet" type="text/css" href="http://serverapi.arcgisonline.com/jsapi/arcgis/2.6/js/dojo/dijit/themes/claro/claro.css"> <script type="text/javascript"> var djConfig = { parseOnLoad: true }; </script> <script type="text/javascript" src="http://serverapi.arcgisonline.com/jsapi/arcgis/?v=2.6"></script> <script type="text/javascript"> dojo.require("esri.map"); dojo.require("esri.layers.osm"); var map, osmLayer; function init() { //setup the copyright text http://www.openstreetmap.org/copyright var copyrightText= '© <a href="http://www.openstreetmap.org/" target="_blank">OpenStreetMap</a> contributors, ' + '<a href="http://creativecommons.org/licenses/by-sa/2.0/" target="_blank">CC-BY-SA</a>'; dojo.byId('osmCopy').innerHTML = copyrightText; var extent = new esri.geometry.Extent({"xmin":-10023722.578230502,"ymin":3498675.6586681586,"xmax":-9996969.618330726,"ymax":3517784.9157394273,"spatialReference":{"wkid":102100}}); map = new esri.Map("map",{extent:extent,logo:false}); osmLayer = new esri.layers.OpenStreetMapLayer(); dojo.connect(osmLayer,'onUpdateEnd',function(){ console.log('update end'); }); map.addLayer(osmLayer); var details = ""; details = "loaded: " + osmLayer.loaded + "<br />"; details += "initialExtent: " + dojo.toJson(osmLayer.initialExtent.toJson()) + "<br />"; details += "fullExtent: " + dojo.toJson(osmLayer.fullExtent.toJson()) + "<br />"; details += "spatialReference: " + dojo.toJson(osmLayer.spatialReference.toJson())+ "<br />"; dojo.byId("info").innerHTML = details; } dojo.addOnLoad(init); </script> </head> <body class="claro" style="font-size: small; font-family: Arial Unicode MS,Arial,sans-serif;"> <div id="map" style="position:relative;width:700px; height:500px; border:1px solid #000;"> <div id="osmCopy" style="position:absolute; color:black;font-weight:bold;right:10px; bottom:10px; z-Index:999;"></div> </div> <div id="info" style="padding:5px; margin:5px; background-color:#eee;"></div> </body> </html>