Skip to content

Instantly share code, notes, and snippets.

@nikolaswise
Created January 6, 2014 22:53
Show Gist options
  • Save nikolaswise/8291365 to your computer and use it in GitHub Desktop.
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
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