Skip to content

Instantly share code, notes, and snippets.

@dbouwman
Last active August 27, 2015 21:34
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 dbouwman/772fe31b669f16809a5c to your computer and use it in GitHub Desktop.
Save dbouwman/772fe31b669f16809a5c to your computer and use it in GitHub Desktop.
Drought_Exposure_Area_District
<!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=772fe31b669f16809a5c"
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/772fe31b669f16809a5c", 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": "Drought_Exposure_Area_District",
"extent": [
[
97.9495034825019,
5.985527924924913
],
[
112.01200348249817,
18.91470230671646
]
]
},
"itemData": {
"operationalLayers": [
{
"url": "http://107.181.94.20/arcgis/rest/services/ADPC_Cambodia/CAMDS_Exposure/MapServer/4",
"visibility": true,
"opacity": 0.78,
"mode": 1,
"id": "4b23b3b995084568b7f35a76db1e85e9_4",
"minScale": 0,
"maxScale": 0,
"layerDefinition": {
"drawingInfo": {
"renderer": {
"visualVariables": [
{
"type": "colorInfo",
"field": "From_5to10",
"stops": [
{
"value": 0,
"color": [
255,
255,
204,
200
],
"label": null
},
{
"value": 392.33986345125,
"color": [
255,
237,
160,
200
],
"label": null
},
{
"value": 784.6797269025,
"color": [
254,
217,
118,
200
],
"label": null
},
{
"value": 1177.01959035375,
"color": [
254,
178,
76,
200
],
"label": null
},
{
"value": 1569.359453805,
"color": [
253,
141,
60,
200
],
"label": null
},
{
"value": 1961.69931725625,
"color": [
252,
78,
42,
200
],
"label": null
},
{
"value": 2354.0391807075,
"color": [
227,
26,
28,
200
],
"label": null
},
{
"value": 2746.37904415875,
"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": false,
"url": "http://services.arcgisonline.com/arcgis/rest/services/Canvas/World_Light_Gray_Base/MapServer"
},
{
"opacity": 1,
"visibility": true,
"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