I'm trying to load features from a GeoJSON into the graphics layer by converting it to ArcGIS JSON and creating a graphic out of each feature so that I can edit them using the Sketch Widget. However, the features are blacked out and I'm not able to edit them. Is it not possible to edit features using the Sketch widget? I'm using the Sketch widget to draw features on the map and I'm concerned about using the editor widget just to be able to edit features that were loaded from a GeoJSON file.
Here's the code for your reference:
const arcGisJson = geojsonToArcGIS(geoJSON);
const blob = new Blob([JSON.stringify(geoJSON)], {
type: "application/json"
});
const url = URL.createObjectURL(blob);
const layer = new GraphicsLayer();
arcGisJson.forEach(json => {
layer.add(Graphic.fromJSON(json));
});
const map = new Map({
basemap: "topo-vector",
layers: [layer]
});
const view = new MapView({
container: "viewDiv",
map: map,
zoom: 5,
center: [90, 45]
});
const sketch = new Sketch({
layer: layer,
view: view,
// graphic will be selected as soon as it is created
creationMode: "update",
defaultCreateOptions: {
mode: "freehand"
},
});
const editor = new Editor({
view: view
});
view.ui.add(editor, "top-left");
view.ui.add(sketch, "top-right");
Here's how the features appear on the map: