maptastik
7/10/2015 - 3:17 PM

My first ArcGIS API for JavaScript map

My first ArcGIS API for JavaScript map

<!DOCTYPE html>
<html>
<head>
<title>My first ArcGIS API for JavaScript Map</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">

<link rel="stylesheet" type="text/css" href="http://js.arcgis.com/3.13/esri/css/esri.css">
<style>
  html,body,#mapDiv,.map.container{
    padding:0;
    margin:0;
    height:100%;
  }
  #legendDiv{
    background-color: #fff;
    position: absolute !important;
    z-index: 99;
    top: 10px;
    right: 20px;
  }
</style>

<script>var dojoConfig = { parseOnLoad:true };</script>
<script src="http://js.arcgis.com/3.13compact/"></script>
<script>
  var map;
  require(["esri/map", "esri/arcgis/utils", "esri/dijit/Legend", "dojo/domReady!"], function(Map, arcgisUtils, Legend){
    arcgisUtils.createMap("c79c5f6d8521406e9de6fab075b456b6", "mapDiv").then(function (response) {
      map = response.map;
      
      var legend = new Legend({
        map: map,
        layerInfos: (arcgisUtils.getLegendLayers(response))
      }, "legendDiv");
      
      legend.startup();
    });
  });
</script>
</head>

<body>


  <div id="mapDiv"></div>
  <div id="legendDiv"></div>
</body>
</html>

A simple webmap made with the ArcGIS API for JavaScript. It depicts downtown land use for Georgetown. The land use layer is pulled from ArcGIS Online.

Built based on tutorial, "Build a web map using ArcGIS.com"