Skip to content

Instantly share code, notes, and snippets.

@apfister
Last active December 18, 2015 18:37
Show Gist options
  • Save apfister/3fea5e43159cd1612d3e to your computer and use it in GitHub Desktop.
Save apfister/3fea5e43159cd1612d3e to your computer and use it in GitHub Desktop.
GIS_PLANNING.Schools
<!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=3fea5e43159cd1612d3e"
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/3fea5e43159cd1612d3e", 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": "GIS_PLANNING.Schools",
"extent": [
[
-75.56901972966003,
39.79952217606131
],
[
-74.76358454899703,
40.198235524740056
]
]
},
"itemData": {
"operationalLayers": [
{
"url": "https://services.arcgis.com/fLeGjb7u4uXqeF9q/arcgis/rest/services/Schools/FeatureServer/0",
"visibility": true,
"opacity": 0.78,
"mode": 1,
"id": "d46a7e59e2c246c891fbee778759717e_0",
"minScale": 0,
"maxScale": 0,
"layerDefinition": {
"drawingInfo": {
"renderer": {
"visualVariables": [
{
"type": "colorInfo",
"field": "ENROLLMENT",
"stops": [
{
"value": 0,
"color": [
255,
247,
251,
200
],
"label": null
},
{
"value": 370.625,
"color": [
236,
226,
240,
200
],
"label": null
},
{
"value": 741.25,
"color": [
208,
209,
230,
200
],
"label": null
},
{
"value": 1111.875,
"color": [
166,
189,
219,
200
],
"label": null
},
{
"value": 1482.5,
"color": [
103,
169,
207,
200
],
"label": null
},
{
"value": 1853.125,
"color": [
54,
144,
192,
200
],
"label": null
},
{
"value": 2223.75,
"color": [
2,
129,
138,
200
],
"label": null
},
{
"value": 2594.375,
"color": [
1,
100,
80,
200
],
"label": null
}
]
}
],
"type": "classBreaks",
"field": "ENROLLMENT",
"defaultSymbol": {
"color": [
140,
150,
198,
200
],
"size": 3,
"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": [
140,
150,
198,
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": [
140,
150,
198,
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 370.625",
"classMaxValue": 370.625
},
{
"symbol": {
"color": [
140,
150,
198,
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": "> 370.625 to 741.25",
"classMaxValue": 741.25
},
{
"symbol": {
"color": [
140,
150,
198,
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": "> 741.25 to 1111.875",
"classMaxValue": 1111.875
},
{
"symbol": {
"color": [
140,
150,
198,
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": "> 1111.875 to 1482.5",
"classMaxValue": 1482.5
}
]
}
}
}
}
],
"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