Skip to content

Instantly share code, notes, and snippets.

@benheb
Last active August 29, 2015 14:26
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 benheb/1e2eabd0a7b39fb52b84 to your computer and use it in GitHub Desktop.
Save benheb/1e2eabd0a7b39fb52b84 to your computer and use it in GitHub Desktop.
World_Cities
<!DOCTYPE html> <meta charset="utf-8"> <link rel="stylesheet" href="http://js.arcgis.com/3.14/esri/css/esri.css"> <style> #map { height:500px; } </style> <body> <div id="map"></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="http://js.arcgis.com/3.14/"></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) { $.getJSON("https://api.github.com/gists/1e2eabd0a7b39fb52b84", 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(); }); }); }); }); </script> </body>
{"item":{"title":"New Map","snippet":"World_Cities","extent":[[-116.32616626133208,-27.788306074448332],[118.6933649886055,59.917721560713375]]},"itemData":{"operationalLayers":[{"url":"https://services.arcgis.com/P3ePLMYs2RVChkJx/arcgis/rest/services/World_Cities/FeatureServer/0","visibility":true,"opacity":0.78,"mode":1,"id":"graphicsLayer0","minScale":0,"maxScale":0,"layerDefinition":{"drawingInfo":{"renderer":{"visualVariables":[{"type":"colorInfo","field":"POP_RANK","stops":[{"value":1,"color":[255,255,204,153],"label":null},{"value":1.75,"color":[255,237,160,153],"label":null},{"value":2.5,"color":[254,217,118,153],"label":null},{"value":3.25,"color":[254,178,76,153],"label":null},{"value":4,"color":[253,141,60,153],"label":null},{"value":4.75,"color":[252,78,42,153],"label":null},{"value":5.5,"color":[227,26,28,153],"label":null},{"value":6.25,"color":[177,0,38,153],"label":null}]}],"type":"simple","label":"","description":"","symbol":{"color":[43,140,190,153],"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"}}}}}}],"baseMap":{"baseMapLayers":[{"opacity":1,"visibility":true,"url":"http://services.arcgisonline.com/arcgis/rest/services/Canvas/World_Light_Gray_Base/MapServer"},{"opacity":0.3,"visibility":true,"url":"http://services.arcgisonline.com/arcgis/rest/services/Elevation/World_Hillshade/MapServer"}],"title":"basemap"},"version":"1.0"}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment