Skip to content

Instantly share code, notes, and snippets.

@RalucaNicola
Last active May 12, 2020 11:38
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 RalucaNicola/9b00722c0b0c21e840479f6eeaeaea0a to your computer and use it in GitHub Desktop.
Save RalucaNicola/9b00722c0b0c21e840479f6eeaeaea0a to your computer and use it in GitHub Desktop.
const sketchLayer = new GraphicsLayer({
elevationInfo: {
mode: "on-the-ground"
}
});
webscene.add(sketchLayer);
const sketchViewModel = new SketchViewModel({
layer: sketchLayer,
view: view
});
sketchViewModel.on("create", function (event) {
if (event.state === "complete") {
console.log(event.graphic.geometry);
// apply a spatial filter on the buildings
// using the graphic's geometry
}
});
document.getElementById("drawPolygon").addEventListener("click", function () {
sketchViewModel.create("polygon");
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment