Skip to content

Instantly share code, notes, and snippets.

@maptastik
Last active August 29, 2015 14:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save maptastik/4d017c905d63b304bfc5 to your computer and use it in GitHub Desktop.
Save maptastik/4d017c905d63b304bfc5 to your computer and use it in GitHub Desktop.
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment