Is there a way to edit a feature’s shape programmatically without having to go through the manual dragging of a vertex/point?
Basically, I am downloading features from our server. If the feature already exists on the local system, I am updating that feature’s column values and feature’s shape.
For the features I get from our server, I construct a new feature from that and have been trying to update my existing features with the new one. I am having issues actually getting the feature to update though. I have tried going through the EditTools and have tried updating through the FeatureSource. I assign my new server feature the same Id that I have in my local system but nothing happens.
So, to remedy this, I am looking to manually edit the feature by calling each column value, updating the Value of it, and then updating the shape. However, I found that I cannot edit the shape as easily.
Do you have any suggestions on how to make this work? This is more of a workflow question as opposed to an individual project issue question so I don’t have a sample project put together.
What is the appropriate process with the WPF tools to update an existing feature’s column values and shape using a newly created feature? I have tried deleting and replacing that one, but I already have another thread going on how the delete option has been corrupting my shapefiles, so I am looking for alternatives.
Edit Feature Shape Programmatically
I have been trying to figure this out for the past couple hours and came to a possible solution.
I break my update into 2 separate transactions. To update my existing column values, I must iterate through my current column values and replace their values with the corresponding values in my new server feature.
For shape… I create a new feature based off of my new server feature’s shape (without column values). I then assign that new feature the Id from my existing feature and pass that into the Update operation.
Both operations were using the EditTools option.
I am hoping there would be a simpler way to handle this besides the method I got to work. Any suggestions are appreciated.
Hi Brandon,
I think you got a good way, another option is that you can try the codes as following:
FeatureSource featuresource = Getfeaturesource();
featuresource.BeginTransaction();
featuresource.DeleteFeature(id);
Feature newFeature =
new
Feature(…);
featuresource.AddFeature(newFeature);
featuresource.CommitTransaction();
Thanks,
Johnny