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.

Table of Contents

Install the Web application

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.

  1. Copy the contents of the zip file into your web server's root directory. In IIS, the default location for the web server's root folder is c:\inetpub\wwwroot.
  2. (Optional). If your application edits features in a feature service or generates requests that exceed 2000 characters you may need to setup and use a proxy page. Common situations where you may exceed the URL length are, using complext polygons as input to a task or specifying a spatial reference using well-known text (wkt). View the Using the proxy page help topic for details on installing and configuring a proxy page.
  3. Test the page using the following URL: http://localhost/[template name]/index.html, where [template name] is the name of the folder where you extracted the zip contents.
Top

Configure the application

Now let's configure the application to use a different map, title or subtitle.

  1. Every saved map on ArcGIS.com has a unique identifier. To find the map id, navigate to ArcGIS.com, and find the map you want to display. If it is one of your maps, make sure it's shared with everyone (public). View the map details and copy the ID from the URL in the top of your browser. The section you need to copy is highlighted in yellow in the image below.



  2. Open the index.html file in a text editor. You can edit this file to set the following application properties:

  3. To modify the map, replace the string for webmap with your map's id.
  4. function init(){
      //The ID for the map from ArcGIS.com
      webmap =  "dbd1c6d52f4e447f8c01d14a691a70fe";
    
  5. If your map contains data from Bing Maps, enter your Bing Maps key.
    bingMapsKey = "Enter your Bing Maps Key here";
     
  6. By default, the application displays the ArcGIS.com map's title as the applications title and the map's summary as the subtitle. You can change this by setting the title and subtitle properties.
  7.     title = "This is a custom title for your map";
        subtitle = "This is a custom subtitle";
     
  8. Save the file then test your application and note that it now displays your map and if specified your custom title and subtitle.

Top

Specify Map Options

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
  }


Top

Personalize the application

In this section, you'll see how to personalize the application by adding a logo, moving the sidebar and modifying the sidebar content.

Top

Add a logo to the application

You can personalize your site by adding a custom logo to the application's header next to the map title.

  1. First copy your custom logo to the images subdirectory.
  2. Open index.html in a text editor.
  3. Find the section of code that has an id of "header" and add the code in red to this section.
    <div id="header" dojotype="dijit.layout.ContentPane" region="top">
      <div id="logo"></div>
      <div id="title">
      </div>
      <div id="subtitle">
      </div>
    </div>
     
  4. Open the layout.css file from the css folder in a text editor. This file defines the look and formatting of the web application. In this step we'll add a new style rule that defines how the custom logo looks. Copy the code below and paste it at the bottom of the css file. Then modify the background url to match the name of your logo image. Modify the width to match the width of your custom logo.
    #logo {
      float:left;
      width:65px;
      height:65px;
      margin:4px;
      background:url(../images/santabarbara.png) top left no-repeat;
    }
    
  5. The header area that contains the logo, title and subtitle has a default height of 80 pixels. If your image is large you may need to increase the height in order for it to display well. To increase the height, open the layout.css file and find the #header section. Try setting the header to the image height plus 8.We add 8 because if you look at the logo style you created in the last step a margin of 4px was specified to add a little extra space around the logo.
    #header{
      border:solid 1px #999;
      height:80px;
    
  6. Run the application and the custom logo should appear to the left of the title in the application header.
Top

Add an overview map

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.

  1. Open layout.js in the javascript folder in a text editor and add the line in red to the dojo.require section.
    dojo.require("esri.map");
    dojo.require("esri.arcgis.utils");
    dojo.require("dijit.layout.StackContainer");
    dojo.require("esri.dijit.OverviewMap");
    
  2. The overview map dijit can display in its own window or attach to a corner of the map. In this example we are going to attach it to the corner of the map. However the map currently has navigation displayed which adds an icon to the map corners. Let's turn this off so we can display the overview map icon in the corner instead.To turn off the navigation images, set the nav value to false in this section of code from layout.js.
    mapOptions: {
      slider: true,
      nav: false
    
  3. Next find the section of code that sets the 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) {
    
  4. Now add the 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.

Top