Created
August 31, 2015 16:43
-
-
Save oevans/f096935441868187a1f5 to your computer and use it in GitHub Desktop.
World_Cities
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=f096935441868187a1f5" | |
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/f096935441868187a1f5", 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": "World_Cities", | |
"extent": [ | |
[ | |
-178.46483813631698, | |
-73.4371172689712 | |
], | |
[ | |
181.53516186358962, | |
84.57181885560539 | |
] | |
] | |
}, | |
"itemData": { | |
"operationalLayers": [ | |
{ | |
"url": "https://services.arcgis.com/P3ePLMYs2RVChkJx/arcgis/rest/services/World_Cities/FeatureServer/0", | |
"visibility": true, | |
"opacity": 0.78, | |
"mode": 1, | |
"id": "6996f03a1b364dbab4008d99380370ed_0", | |
"minScale": 0, | |
"maxScale": 0, | |
"layerDefinition": { | |
"drawingInfo": { | |
"renderer": { | |
"type": "classBreaks", | |
"field": "POP_RANK", | |
"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": 1, | |
"classMaxValue": 1 | |
}, | |
{ | |
"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": "> 1 to 1.75", | |
"classMaxValue": 1.75 | |
}, | |
{ | |
"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": "> 1.75 to 2.5", | |
"classMaxValue": 2.5 | |
}, | |
{ | |
"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": "> 2.5 to 3.25", | |
"classMaxValue": 3.25 | |
}, | |
{ | |
"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": "> 3.25 to 4", | |
"classMaxValue": 4 | |
} | |
] | |
} | |
} | |
} | |
} | |
], | |
"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