Using the Sketch Widget to edit features

02-10-2021 10:09 PM
New Contributor

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 => {

const map = new Map({
  basemap: "topo-vector",
  layers: [layer]

const view = new MapView({
  container: "viewDiv",
  map: map,
  zoom: 5,
  center: [9045]

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

Here's how the features appear on the map:


0 Kudos
2 Replies
Esri Regular Contributor

Hi there,

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,



0 Kudos
New Contributor


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.



0 Kudos