A Pen by Simon Phillips on CodePen.
Created
August 9, 2019 07:30
-
-
Save spSlaine/687535b245dc3728fc930da4e3aab3ed to your computer and use it in GitHub Desktop.
Sketch widget - 4.12
This file contains hidden or 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
<!-- | |
ArcGIS API for JavaScript, https://js.arcgis.com | |
For more information about the sketch-geometries sample, read the original sample description at developers.arcgis.com. | |
https://developers.arcgis.com/javascript/latest/sample-code/sketch-geometries/index.html | |
--> | |
<div id="viewDiv"></div> |
This file contains hidden or 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/widgets/Sketch", | |
"esri/Map", | |
"esri/layers/GraphicsLayer", | |
"esri/views/MapView" | |
], function(Sketch, Map, GraphicsLayer, MapView) { | |
const layer = new GraphicsLayer(); | |
const map = new Map({ | |
basemap: "streets", | |
layers: [layer] | |
}); | |
const view = new MapView({ | |
container: "viewDiv", | |
map: map, | |
zoom: 5, | |
center: [90, 45] | |
}); | |
const sketch = new Sketch({ | |
layer: layer, | |
view: view, | |
availableCreateTools: ['polygon'] | |
}); | |
view.ui.add(sketch, "top-right"); | |
}); |
This file contains hidden or 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
<script src="https://js.arcgis.com/4.12/"></script> |
This file contains hidden or 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
html, | |
body, | |
#viewDiv { | |
padding: 0; | |
margin: 0; | |
height: 100%; | |
width: 100%; | |
} |
This file contains hidden or 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
<link href="https://js.arcgis.com/4.12/esri/themes/light/main.css" rel="stylesheet" /> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment