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:
You should not have to use the sketch widget to create new features in a GeoJSONLayer. You can use the Editor widget to create, update or delete features from a GeoJSONLayer. To use GeoJSONLayer with Editor widget, you must set templates property on the layer.
This simple test app shows how to set up GeoJSONLayer with Editor widget. You'll have to change to code to work with polygons. Another thing I should point out is that, at 4.18, you have enter values for all attributes fields or have to hit enter (without entering values) to get the Add button enabled after creating a new feature. We have an issue for that.
Hope this helps,
Thanks for the reply! The intention here is to make use of a single layer to be able to both edit and add features. Does the editor widget support freehand drawing? I want users to be able to freely draw polygons/shapes. I'm using the sketch widget for this purpose. However, if I'm fetching features from a server, I see that I have to make use of the GeoJSON layer to be able to render/edit these features. Hence, I'm in a situation wherein I need to manage two different layers.