I notice the sketch widget relies on using a GraphicsLayer to display the output of the sketch. My app is pulling in a webmap over having the layers live in the app. Is it possible to still use this widget / add a layer with the webmap set as the map view? Here is the sample I am following and my concept code.
Sample Code
My Code:
const webmapId = new URLSearchParams(window.location.search).get("webmap")
?? "(insert webmap id) ";
const graphicsLayer = new GraphicsLayer();
const map = new WebMap({
portalItem: {
id: webmapId
}
layers: [graphicsLayer]
});
const view = new MapView({
map,
container: "viewDiv",
padding: {
left: 50
}
});
view.when(() => {
const sketch = new Sketch({
layer: graphicsLayer,
view:view,
//graphi will be selected as soon as it is created
creationMode: "update"
});
view.ui.add(sketch, "top-right");
});