Last active
March 10, 2016 23:20
-
-
Save ajturner/8caf7306e186ae24ea3d to your computer and use it in GitHub Desktop.
Voting Precinct - 2012
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!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=8caf7306e186ae24ea3d" | |
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/8caf7306e186ae24ea3d", 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> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"item": { | |
"title": "New Map", | |
"snippet": "Voting Precinct - 2012", | |
"extent": [ | |
[ | |
-77.45289574972344, | |
38.57277090510414 | |
], | |
[ | |
-76.13728295675645, | |
39.038293976078286 | |
] | |
] | |
}, | |
"itemData": { | |
"operationalLayers": [ | |
{ | |
"url": "https://services1.arcgis.com/fcrLbZIfZI20fNqr/arcgis/rest/services/JohnMapService5/FeatureServer/15", | |
"visibility": true, | |
"opacity": 0.78, | |
"mode": 1, | |
"id": "cd8c94acb7ec434e9c21816aa82775e4_15", | |
"minScale": 0, | |
"maxScale": 0, | |
"layerDefinition": { | |
"drawingInfo": { | |
"renderer": { | |
"visualVariables": [ | |
{ | |
"type": "colorInfo", | |
"field": "NAME", | |
"stops": [ | |
{ | |
"value": 1, | |
"color": [ | |
255, | |
255, | |
229, | |
200 | |
], | |
"label": null | |
}, | |
{ | |
"value": 1.375, | |
"color": [ | |
247, | |
252, | |
185, | |
200 | |
], | |
"label": null | |
}, | |
{ | |
"value": 1.75, | |
"color": [ | |
217, | |
240, | |
163, | |
200 | |
], | |
"label": null | |
}, | |
{ | |
"value": 2.125, | |
"color": [ | |
173, | |
221, | |
142, | |
200 | |
], | |
"label": null | |
}, | |
{ | |
"value": 2.5, | |
"color": [ | |
120, | |
198, | |
121, | |
200 | |
], | |
"label": null | |
}, | |
{ | |
"value": 2.875, | |
"color": [ | |
65, | |
171, | |
93, | |
200 | |
], | |
"label": null | |
}, | |
{ | |
"value": 3.25, | |
"color": [ | |
35, | |
132, | |
67, | |
200 | |
], | |
"label": null | |
}, | |
{ | |
"value": 3.625, | |
"color": [ | |
0, | |
90, | |
50, | |
200 | |
], | |
"label": null | |
} | |
] | |
} | |
], | |
"type": "simple", | |
"label": "", | |
"description": "", | |
"symbol": { | |
"color": [ | |
43, | |
140, | |
190, | |
200 | |
], | |
"outline": { | |
"color": [ | |
255, | |
255, | |
255, | |
255 | |
], | |
"width": 0.5, | |
"type": "esriSLS", | |
"style": "esriSLSSolid" | |
}, | |
"type": "esriSFS", | |
"style": "esriSFSSolid" | |
} | |
} | |
} | |
} | |
}, | |
{ | |
"url": "https://services1.arcgis.com/fcrLbZIfZI20fNqr/arcgis/rest/services/JohnMapService5/FeatureServer/4", | |
"visibility": true, | |
"opacity": 0.78, | |
"mode": 1, | |
"id": "cd8c94acb7ec434e9c21816aa82775e4_4", | |
"minScale": 0, | |
"maxScale": 0, | |
"layerDefinition": { | |
"drawingInfo": { | |
"renderer": { | |
"visualVariables": null, | |
"type": "simple", | |
"label": "", | |
"description": "", | |
"symbol": { | |
"color": [ | |
177, | |
0, | |
38, | |
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" | |
} | |
} | |
} | |
} | |
} | |
}, | |
{ | |
"url": "http://maps2.dcgis.dc.gov/dcgis/rest/services/DCGIS_DATA/Administrative_Other_Boundaries_WebMercator/MapServer/27", | |
"visibility": true, | |
"opacity": 0.78, | |
"mode": 1, | |
"id": "44cdf2570d8545dd9c9868e2a2f570c8_27", | |
"minScale": 0, | |
"maxScale": 0, | |
"layerDefinition": { | |
"drawingInfo": { | |
"renderer": { | |
"visualVariables": [ | |
{ | |
"type": "colorInfo", | |
"field": "NAME", | |
"stops": [ | |
{ | |
"value": 1, | |
"color": [ | |
255, | |
255, | |
204, | |
200 | |
], | |
"label": null | |
}, | |
{ | |
"value": 1.375, | |
"color": [ | |
255, | |
237, | |
160, | |
200 | |
], | |
"label": null | |
}, | |
{ | |
"value": 1.75, | |
"color": [ | |
254, | |
217, | |
118, | |
200 | |
], | |
"label": null | |
}, | |
{ | |
"value": 2.125, | |
"color": [ | |
254, | |
178, | |
76, | |
200 | |
], | |
"label": null | |
}, | |
{ | |
"value": 2.5, | |
"color": [ | |
253, | |
141, | |
60, | |
200 | |
], | |
"label": null | |
}, | |
{ | |
"value": 2.875, | |
"color": [ | |
252, | |
78, | |
42, | |
200 | |
], | |
"label": null | |
}, | |
{ | |
"value": 3.25, | |
"color": [ | |
227, | |
26, | |
28, | |
200 | |
], | |
"label": null | |
}, | |
{ | |
"value": 3.625, | |
"color": [ | |
177, | |
0, | |
38, | |
200 | |
], | |
"label": null | |
} | |
] | |
} | |
], | |
"type": "simple", | |
"label": "", | |
"description": "", | |
"symbol": { | |
"color": [ | |
43, | |
140, | |
190, | |
200 | |
], | |
"outline": { | |
"color": [ | |
255, | |
255, | |
255, | |
255 | |
], | |
"width": 0.5, | |
"type": "esriSLS", | |
"style": "esriSLSSolid" | |
}, | |
"type": "esriSFS", | |
"style": "esriSFSSolid" | |
} | |
} | |
} | |
} | |
} | |
], | |
"baseMap": { | |
"baseMapLayers": [ | |
{ | |
"opacity": 0.5, | |
"visibility": false, | |
"url": "http://services.arcgisonline.com/arcgis/rest/services/Specialty/DeLorme_World_Base_Map/MapServer" | |
}, | |
{ | |
"opacity": 0.8, | |
"visibility": true, | |
"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