Skip to content

Instantly share code, notes, and snippets.

@ajturner
Last active August 29, 2015 14:26
Show Gist options
  • Select an option

  • Save ajturner/e2939fe2cab70efd4ec9 to your computer and use it in GitHub Desktop.

Select an option

Save ajturner/e2939fe2cab70efd4ec9 to your computer and use it in GitHub Desktop.
Counties
{"item":{"title":"New Map","snippet":"Counties","extent":[[-145.3957182813038,25.9568928156433],[-89.98067921881854,44.5582505937907]]},"itemData":{"operationalLayers":[{"url":"https://services.gis.ca.gov/arcgis/rest/services/Economy/GOBiz_Business_Assistance/MapServer/14","visibility":true,"opacity":0.78,"mode":1,"id":"graphicsLayer0","minScale":0,"maxScale":0,"layerDefinition":{"drawingInfo":{"renderer":{"visualVariables":[{"type":"colorInfo","field":"AREA_ID","stops":[{"value":21009409,"color":[255,247,251,200],"label":null},{"value":21009551.75,"color":[236,226,240,200],"label":null},{"value":21009694.5,"color":[208,209,230,200],"label":null},{"value":21009837.25,"color":[166,189,219,200],"label":null},{"value":21009980,"color":[103,169,207,200],"label":null},{"value":21010122.75,"color":[54,144,192,200],"label":null},{"value":21010265.5,"color":[2,129,138,200],"label":null},{"value":21010408.25,"color":[1,100,80,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":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"}}
<!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/e2939fe2cab70efd4ec9", 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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment