Skip to content

Instantly share code, notes, and snippets.

@ajturner
Last active December 1, 2015 16:29
Show Gist options
  • Save ajturner/10e03c029512e52ef9d1 to your computer and use it in GitHub Desktop.
Save ajturner/10e03c029512e52ef9d1 to your computer and use it in GitHub Desktop.
Commercial (CAMA)
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<link rel="stylesheet" href=
"http://js.arcgis.com/3.14/esri/css/esri.css">
<link rel="stylesheet" type="text/css" href=
"https://rawgit.com/benheb/legend/master/legend.css">
<title>Webmap created with Mundi</title>
<style>
#map { height:500px; } #mundi-link { position: absolute; right: 5px; z-index: 200; display: block; background: #FFF; text-decoration: none; color: #4C4C4C; top: 5px; padding: 5px; border-radius: 2px; } #legend-container { width: 218px; position: absolute; bottom: 20px; left: 13px; }
</style>
</head>
<body>
<div id="map">
<a id="mundi-link" href=
"http://benheb.github.io/mundi/?id=10e03c029512e52ef9d1"
target="_blank">View map in Mundi</a>
<div id="legend-container"></div>
</div><script src="//code.jquery.com/jquery-1.11.3.min.js">
</script> <script src=
"//code.jquery.com/jquery-migrate-1.2.1.min.js">
</script> <script src=
"https://rawgit.com/benheb/legend/master/sortable.js">
</script> <script src="http://js.arcgis.com/3.14/">
</script> <script src=
"https://rawgit.com/benheb/legend/master/legend.js">
</script> <script>
require(["esri/map","esri/urlUtils","esri/arcgis/utils","esri/layers/FeatureLayer","esri/renderers/SimpleRenderer","esri/renderers/jsonUtils","dojo/domReady!"], function(Map,urlUtils,arcgisUtils,FeatureLayer,SimpleRenderer,jsonUtils) { var legend = new Legend("legend-container", { editable: false, layers: [] }); $.getJSON("https://api.github.com/gists/10e03c029512e52ef9d1", function(data) { var webmap; for (var file in data.files ) { if ( file !== "index.html" ) { webmap = JSON.parse(data.files[file].content); } }; arcgisUtils.createMap(webmap, "map").then(function(response){ var map = response.map; map.graphicsLayerIds.forEach(function(layer) { var layer = map.getLayer(layer); layer.setMinScale(0); layer.setMaxScale(0); layer.redraw(); legend.addLayer({ "id": layer.id, "name": layer.name, "renderer": layer.renderer.toJson() }); }); }); }); });
</script>
</body>
</html>
{
"item": {
"title": "New Map",
"snippet": "Commercial (CAMA)",
"extent": [
[
-77.27664812983748,
38.855086161397324
],
[
-76.62330492915477,
39.079311684226546
]
]
},
"itemData": {
"operationalLayers": [
{
"url": "http://maps2.dcgis.dc.gov/dcgis/rest/services/DCGIS_DATA/Education_WebMercator/MapServer/5",
"visibility": true,
"opacity": 0.78,
"mode": 1,
"id": "4ac321b2d409438ebd76a6569ad94034_5",
"minScale": 0,
"maxScale": 0,
"layerDefinition": {
"drawingInfo": {
"renderer": {
"visualVariables": [
{
"type": "colorInfo",
"field": "TOTAL_STUD",
"stops": [
{
"value": 0,
"color": [
255,
247,
251,
200
],
"label": null
},
{
"value": 204.125,
"color": [
236,
226,
240,
200
],
"label": null
},
{
"value": 408.25,
"color": [
208,
209,
230,
200
],
"label": null
},
{
"value": 612.375,
"color": [
166,
189,
219,
200
],
"label": null
},
{
"value": 816.5,
"color": [
103,
169,
207,
200
],
"label": null
},
{
"value": 1020.625,
"color": [
54,
144,
192,
200
],
"label": null
},
{
"value": 1224.75,
"color": [
2,
129,
138,
200
],
"label": null
},
{
"value": 1428.875,
"color": [
1,
100,
80,
200
],
"label": null
}
]
}
],
"type": "classBreaks",
"field": "TOTAL_STUD",
"defaultSymbol": {
"color": [
43,
140,
190,
200
],
"size": 6,
"angle": 0,
"xoffset": 0,
"yoffset": 0,
"type": "esriSMS",
"style": "esriSMSCircle",
"outline": {
"color": [
255,
255,
255,
255
],
"width": 1.3,
"type": "esriSLS",
"style": "esriSLSSolid"
}
},
"minValue": 1,
"classBreakInfos": [
{
"symbol": {
"color": [
43,
140,
190,
200
],
"size": 4,
"angle": 0,
"xoffset": 0,
"yoffset": 0,
"type": "esriSMS",
"style": "esriSMSCircle",
"outline": {
"color": [
255,
255,
255,
255
],
"width": 1.3,
"type": "esriSLS",
"style": "esriSLSSolid"
}
},
"label": 0,
"classMaxValue": 0
},
{
"symbol": {
"color": [
43,
140,
190,
200
],
"size": 10,
"angle": 0,
"xoffset": 0,
"yoffset": 0,
"type": "esriSMS",
"style": "esriSMSCircle",
"outline": {
"color": [
255,
255,
255,
255
],
"width": 1.3,
"type": "esriSLS",
"style": "esriSLSSolid"
}
},
"label": "> 0 to 204.125",
"classMaxValue": 204.125
},
{
"symbol": {
"color": [
43,
140,
190,
200
],
"size": 16,
"angle": 0,
"xoffset": 0,
"yoffset": 0,
"type": "esriSMS",
"style": "esriSMSCircle",
"outline": {
"color": [
255,
255,
255,
255
],
"width": 1.3,
"type": "esriSLS",
"style": "esriSLSSolid"
}
},
"label": "> 204.125 to 408.25",
"classMaxValue": 408.25
},
{
"symbol": {
"color": [
43,
140,
190,
200
],
"size": 22,
"angle": 0,
"xoffset": 0,
"yoffset": 0,
"type": "esriSMS",
"style": "esriSMSCircle",
"outline": {
"color": [
255,
255,
255,
255
],
"width": 1.3,
"type": "esriSLS",
"style": "esriSLSSolid"
}
},
"label": "> 408.25 to 612.375",
"classMaxValue": 612.375
},
{
"symbol": {
"color": [
43,
140,
190,
200
],
"size": 30,
"angle": 0,
"xoffset": 0,
"yoffset": 0,
"type": "esriSMS",
"style": "esriSMSCircle",
"outline": {
"color": [
255,
255,
255,
255
],
"width": 1.3,
"type": "esriSLS",
"style": "esriSLSSolid"
}
},
"label": "> 612.375 to 816.5",
"classMaxValue": 816.5
}
]
}
}
}
},
{
"url": "http://maps2.dcgis.dc.gov/dcgis/rest/services/DCGIS_DATA/Recreation_WebMercator/MapServer/9",
"visibility": true,
"opacity": 0.78,
"mode": 1,
"id": "287eaa2ecbff4d699762bbc6795ffdca_9",
"minScale": 0,
"maxScale": 0,
"layerDefinition": {
"drawingInfo": {
"renderer": {
"type": "simple",
"label": "",
"description": "",
"symbol": {
"color": [
177,
0,
38,
200
],
"outline": {
"color": [
255,
255,
255,
255
],
"width": 0.5,
"type": "esriSLS",
"style": "esriSLSSolid"
},
"type": "esriSFS",
"style": "esriSFSSolid"
}
}
}
}
},
{
"url": "http://maps2.dcgis.dc.gov/dcgis/rest/services/DCGIS_DATA/Property_and_Land_WebMercator/MapServer/23",
"visibility": true,
"opacity": 0.78,
"mode": 1,
"id": "e53572ef8f124631b965709da8200167_23",
"minScale": 0,
"maxScale": 0,
"layerDefinition": {
"drawingInfo": {
"renderer": {
"visualVariables": [
{
"type": "colorInfo",
"field": "NUM_UNITS",
"stops": [
{
"value": 0,
"color": [
255,
255,
217,
200
],
"label": null
},
{
"value": 332.5,
"color": [
237,
248,
177,
200
],
"label": null
},
{
"value": 665,
"color": [
199,
233,
180,
200
],
"label": null
},
{
"value": 997.5,
"color": [
127,
205,
187,
200
],
"label": null
},
{
"value": 1330,
"color": [
65,
182,
196,
200
],
"label": null
},
{
"value": 1662.5,
"color": [
29,
145,
192,
200
],
"label": null
},
{
"value": 1995,
"color": [
34,
94,
168,
200
],
"label": null
},
{
"value": 2327.5,
"color": [
12,
44,
132,
200
],
"label": null
}
]
}
],
"type": "classBreaks",
"field": "NUM_UNITS",
"defaultSymbol": {
"color": [
43,
140,
190,
200
],
"size": 6,
"angle": 0,
"xoffset": 0,
"yoffset": 0,
"type": "esriSMS",
"style": "esriSMSCircle",
"outline": {
"color": [
255,
255,
255,
255
],
"width": 0.5,
"type": "esriSLS",
"style": "esriSLSSolid"
}
},
"minValue": 1,
"classBreakInfos": [
{
"symbol": {
"color": [
43,
140,
190,
200
],
"size": 4,
"angle": 0,
"xoffset": 0,
"yoffset": 0,
"type": "esriSMS",
"style": "esriSMSCircle",
"outline": {
"color": [
255,
255,
255,
255
],
"width": 0.5,
"type": "esriSLS",
"style": "esriSLSSolid"
}
},
"label": 0,
"classMaxValue": 0
},
{
"symbol": {
"color": [
43,
140,
190,
200
],
"size": 10,
"angle": 0,
"xoffset": 0,
"yoffset": 0,
"type": "esriSMS",
"style": "esriSMSCircle",
"outline": {
"color": [
255,
255,
255,
255
],
"width": 0.5,
"type": "esriSLS",
"style": "esriSLSSolid"
}
},
"label": "> 0 to 332.5",
"classMaxValue": 332.5
},
{
"symbol": {
"color": [
43,
140,
190,
200
],
"size": 16,
"angle": 0,
"xoffset": 0,
"yoffset": 0,
"type": "esriSMS",
"style": "esriSMSCircle",
"outline": {
"color": [
255,
255,
255,
255
],
"width": 0.5,
"type": "esriSLS",
"style": "esriSLSSolid"
}
},
"label": "> 332.5 to 665",
"classMaxValue": 665
},
{
"symbol": {
"color": [
43,
140,
190,
200
],
"size": 22,
"angle": 0,
"xoffset": 0,
"yoffset": 0,
"type": "esriSMS",
"style": "esriSMSCircle",
"outline": {
"color": [
255,
255,
255,
255
],
"width": 0.5,
"type": "esriSLS",
"style": "esriSLSSolid"
}
},
"label": "> 665 to 997.5",
"classMaxValue": 997.5
},
{
"symbol": {
"color": [
43,
140,
190,
200
],
"size": 30,
"angle": 0,
"xoffset": 0,
"yoffset": 0,
"type": "esriSMS",
"style": "esriSMSCircle",
"outline": {
"color": [
255,
255,
255,
255
],
"width": 0.5,
"type": "esriSLS",
"style": "esriSLSSolid"
}
},
"label": "> 997.5 to 1330",
"classMaxValue": 1330
}
]
}
}
}
}
],
"baseMap": {
"baseMapLayers": [
{
"opacity": 0.5,
"visibility": true,
"url": "http://services.arcgisonline.com/arcgis/rest/services/Specialty/DeLorme_World_Base_Map/MapServer"
},
{
"opacity": 0.8,
"visibility": false,
"url": "http://services.arcgisonline.com/arcgis/rest/services/Canvas/World_Light_Gray_Base/MapServer"
},
{
"opacity": 1,
"visibility": false,
"url": "http://services.arcgisonline.com/arcgis/rest/services/Canvas/World_Dark_Gray_Base/MapServer"
}
],
"title": "basemap"
},
"version": "1.0"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment