This template provides a starting point for creating your Web application. This easily configurable template allows you to define the map, title and subtitle for the site. You've downloaded the Chrome template which was designed to have a clean, fresh look and rounded corners. This read-me file explains how to setup and configure the template to run on your web server. We've also provided a few tips on how to personalize the template by adding a company logo, customizing the content in the sidebar and adding an overview map.
These instructions assume that you have a Web server like Internet Information Services(IIS) installed and setup on your machine. If you are using another Web server the general installation steps will be the same but you will need to check your Web server's documentation for specific information on deploying and testing the application.
c:\inetpub\wwwroot
. Now let's configure the application to use a different map, title or subtitle.
function init(){
//The ID for the map from ArcGIS.com
webmap = "dbd1c6d52f4e447f8c01d14a691a70fe";
bingMapsKey = "Enter your Bing Maps Key here";
title = "This is a custom title for your map"; subtitle = "This is a custom subtitle";
When creating a new map you can specify optional parameters that define various map options like whether pan arrows or a slider are displayed, if popups defined in ArcGIS.com display and if the map supports continous pan across the dateline. View the API reference for the Map class for more details. Note: continous pan across the dateline is only supported if the map's spatial reference is WGS84 or Web Mercator.
To change the map options in your application open the layout.js file search for mapOptions then add or remove map options. In this example, we turn off the map slider, display the pan arrows and enable support for continous pan across the dateline.
mapOptions: { slider: false, nav: true, wrapAround180:true }
In this section, you'll see how to personalize the application by adding a logo, moving the sidebar and modifying the sidebar content.
TopYou can personalize your site by adding a custom logo to the application's header next to the map title.
<div id="header" dojotype="dijit.layout.ContentPane" region="top">
<div id="logo"></div>
<div id="title">
</div>
<div id="subtitle">
</div>
</div>
#logo {
float:left;
width:65px;
height:65px;
margin:4px;
background:url(../images/santabarbara.png) top left no-repeat;
}
#header{
border:solid 1px #999;
height:80px;
The ArcGIS API for JavaScript has several dijits that you can use to add additional functionality to the application. Let's look at how to add the OverviewMap dijit to the application. The OverviewMap dijit shows the current extent for the map within the context of a larger area.
dojo.require("esri.map");
dojo.require("esri.arcgis.utils");
dojo.require("dijit.layout.StackContainer");
dojo.require("esri.dijit.OverviewMap");
mapOptions: {
slider: true,
nav: false
map
to response.map
and paste the code in red beneath that line. This code checks to see if the map is loaded, if it is it runs a function that adds the overview map to the application.
map = response.map;
if(map.loaded){
addOverviewMap();
}
else{
dojo.connect(map,"onLoad",addOverviewMap);
}
if (bingMapsKey) {
addOverviewMap
function to the very bottom of the layout.js file.
function addOverviewMap() { var overviewMapDijit = new esri.dijit.OverviewMap({ map: map, attachTo: "top-right", visible: true }); overviewMapDijit.startup(); }
The code above adds an overview map to the upper right corner of the map. You can modify this location by specifying one of the other options ("top-right","bottom-right","bottom-left"). The visible parameter is set to true which expands the overview map when the applciation is first displayed. You can use additional parameters to modify the color and opacity of the rectangle, set the width and height etc. View the API Reference for the OverviewMap for more information.