Select to view content in your preferred language

Sketch widget in conjunction with FeatureLayer

514
3
Jump to solution
07-20-2022 04:26 AM
Aeseir
by
Frequent Contributor

I am currently using the sketch widget to enable users to map out key objects on the map.

However I want to use the power of Feature Layer for the objects created so that i can leverage key capabilities.

Is there a way to sync the Sketch widget (which uses graphics layer) with my Feature layer?

0 Kudos
1 Solution

Accepted Solutions
ReneRubalcava
Honored Contributor

Technically, this is what the Editor widget is for. But if you really wanted to, you could pass the graphics from the Sketch widget into the featureLayer.applyEdits, but kind of seems like the long way to get there. Plus you would need to populate the attributes in some way. You would need a separate FeatureLayer per geometry type as well.

View solution in original post

0 Kudos
3 Replies
ReneRubalcava
Honored Contributor

Technically, this is what the Editor widget is for. But if you really wanted to, you could pass the graphics from the Sketch widget into the featureLayer.applyEdits, but kind of seems like the long way to get there. Plus you would need to populate the attributes in some way. You would need a separate FeatureLayer per geometry type as well.

0 Kudos
Aeseir
by
Frequent Contributor

Thanks for the insights, i guess there is a bit of fiddling around. What caught my eye is the last item:

You would need a separate FeatureLayer per geometry type as well.


Would love to understand this more and why?

In this scenario i am using polygon, polyline, and point, are you saying i should have 3 different FeatureLayers for each type? How do you differentiate between those featurelayers (i've been  trying to figure out if there is a way to name them and reference them)

0 Kudos
ReneRubalcava
Honored Contributor

FeatureLayers, by design with a FeatureService can only have a single geometry type.

https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#geometry...

So if you have points, lines, polygons, you need a FeatureLayer for each.

0 Kudos