Installation guide
5
//Add the world street map layer to the map. View the ArcGIS Online site for services
http://arcgisonline/home/search.html?t=content&f=typekeywords:service
var basemap = new
esri.layers.ArcGISTiledMapServiceLayer("http://server.arcgisonline.com/ArcGIS/rest/
services/World_Street_Map/MapServer");
map.addLayer(basemap);
dojo.connect(map, 'onLoad', function(theMap) {
//resize the map when the browser resizes
dojo.connect(dijit.byId('map'), 'resize', map,map.resize);
});
}
dojo.addOnLoad(init);
</script>
In the <body></body>, add the following code.
<body class="claro">
<div dojotype="dijit.layout.BorderContainer" design="headline" gutters="false"
style="width: 100%; height: 100%; margin: 0;">
<div id="map" dojotype="dijit.layout.ContentPane" region="center"
style="overflow:hidden;">
</div>
</div>
</body>
Add <style></style> in <head></head>, to control the layout of the webpage.
<style>
html, body { height: 100%; width: 100%; margin: 0; padding: 0; }
#map{padding:0;}
</style>
Add <link>, which is essential to have a valid scale bar on the web map.
<link rel="stylesheet" type="text/css"
href="http://serverapi.arcgisonline.com/jsapi/arcgis/3.1/js/dojo/dijit/themes/clar
o/claro.css">
Lastly, just click the Run button to see the final web ArcGIS API map. You can also copy this
Stockholm.html file to any independent folder to run it. NOTE: IE browser is better.
Part 3 – Optional Home Exercise
Part 1 introduced how to embed a static map into a webpage. Part 2 introduced how to use a
public JavaScript mapping API to make the embedded map more interactive, among others