ThinkGeo.com    |     Blog    |     Wiki    |     Support

Features disappear when editing reprojected shapefile

Hi guys,

I am having an issue when editing shapefiles. If a shapefile feature is edited under the following conditions, the feature will no longer draw.

  1. Apply a projection to the shapefile.
  2. Edit the feature and do not commit the transaction.
  3. Feature disappears.

Works OK if you don’t use a projection or if you commit the transaction.

I have attached a sample project to demonstrate the issue.

  1. Start the project.
  2. Click on a line feature with the mouse, you will have to zoom in some.
  3. Move a vertex once or twice.
  4. Click off the feature to de-select.
  5. Feature no longer draws.

Thanks!

Steve
EditShapefileTest.zip (924.6 KB)

Hi Steve,

Thanks for your sample, we reproduce the behavior you mentioned.

But I don’t think it’s a bug, because the projection is assigned to the feature layer, so if you don’t commit the transaction, some inner values cannot get updated, some query result also maybe met problem.

So if you call BeginTransaction you need to call CommitTransaction for avoid unexpected problem.

Without projection is works means the feature get changed when you call EditTools.Update, but we also cannot make sure it won’t introduce other issue if you don’t call CommitTransaction after that.

So I think you should want to add these lines in your Map_Click event:
If moShapefile1.EditTools.IsInTransaction Then
moShapefile1.EditTools.CommitTransaction()
End If

Or maybe you want to share us the scenario why it cannot commit transaction, so we can see whether we can solve that in other way.

Regards,

Ethan

Hi Ethan,

Our application uses both Shapefiles and Sql Server layers. When editing Sql Server layers we don’t want to commit changes to the database until the user is through editing vertices. And we don’t want to treat Feature Layers differently if we can avoid it so we have always used the same method when editing Shapefiles. It has been working fine for years. Also we don’t have the problem of disappearing features with Sql layers. So that’s why I thought it was a bug.

Thanks!

Steve

Hi Steve,

Thanks to let us know your scenario, we tried to make all layers works the same, but because the bottom feature is not the same between all layers and for optimize the process, we cannot make sure everything is the same. Just like here, some layers submit the result in the process, and some layers modfiy some important things at the end submit process.

We did some research and see whether there is a solution for your scenario.

Any update I will let you know.

Regards,

Ethan