Created
January 6, 2014 22:53
-
-
Save nikolaswise/8291365 to your computer and use it in GitHub Desktop.
How to put a polyline on a map with the Esri ArcGIS JS SDK
This file contains 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
require([ | |
"esri/map", | |
"esri/geometry/Polyline", | |
"esri/symbols/SimpleLineSymbol", | |
"esri/graphic", | |
"dojo/domReady!"], | |
function(Map, Polyline, SimpleLineSymbol, Graphic) { | |
window.map = new Map("mapDiv", { | |
center: [-122.68,45.53], | |
zoom: 11, | |
basemap: "gray" | |
}); | |
var polylineJson = { | |
"paths":[[[-122.68,45.53], [-122.58,45.55], | |
[-122.57,45.58],[-122.53,45.6]]] | |
}; | |
window.symbol = new SimpleLineSymbol().setWidth(10); | |
window.geometry = new Polyline(polylineJson); | |
window.polyline = new esri.Graphic(geometry, symbol); | |
map.on('load', function () { | |
map.graphics.add(polyline); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment