Trying to update vertices of a line

623
4
Jump to solution
10-19-2024 04:58 PM
clc
by
Regular Contributor

I am writing a custom widget to allow user to modify the z value of the vertices of a line, but I can't figure out how to apply the changes.

Right now my widget is connected to a map widget and a feature layer datasource. I listen to double click to retrieve a line feature in the map. I then loop over all the vertices in the line and display their z value in an input. I can update the paths of the line with the values entered, but I can't figure out how to save these changes in my feature layer datasource so that these changes are available to all the other widgets in my experience.

0 Kudos
1 Solution

Accepted Solutions
JeffreyThompson2
MVP Frequent Contributor

https://developers.arcgis.com/javascript/latest/api-reference/esri-rest-support-Query.html#returnZ

I think to get the z values you must explicitly add returnGeometry = true and returnZ = true to your query.

GIS Developer
City of Arlington, Texas

View solution in original post

0 Kudos
4 Replies
JeffreyThompson2
MVP Frequent Contributor

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

So you are using the applyEdits() function, it updates the FeatureLayer, but the other widgets do not acknowledge the change?

GIS Developer
City of Arlington, Texas
0 Kudos
clc
by
Regular Contributor

I am so lost!

I wanted to edit the records of my datasource directly. This does not seem to be possible... So I use createJSAPILayerByDataSource() to get a feature layer. I then query the feature layer with the objectid of the polyline I double-click on to get the feature. I then can use applyEdits(). This works fine for updating any attributes  but not for changing the z of its vertices for the simple reason that there is no z in the vertices of the feature returned by the query. I used the same code for looping through the path of the polyline. When the polyline is obtained from the datasource it shows x, y and z (as it should because it is z-aware), when the polyline is obtained from the feature layer it shows only x and y!

0 Kudos
JeffreyThompson2
MVP Frequent Contributor

https://developers.arcgis.com/javascript/latest/api-reference/esri-rest-support-Query.html#returnZ

I think to get the z values you must explicitly add returnGeometry = true and returnZ = true to your query.

GIS Developer
City of Arlington, Texas
0 Kudos
clc
by
Regular Contributor

You are right, I did not know about returnZ, I thought return Geometry was enough.

Thanks a lot for your help and all your posts.

Catherine

0 Kudos