I am trying to figure out how to delete duplicate vertices. I have successfully determined that there are duplicate vertices using PLTS Data Reviewer, but I am confounded as to how I identify and remove individual vertices. I have tried repair geometry to no avail, and I was wondering if anyone had some advice. I am working in a file geodatabase in ArcMap 10.0 with Data Reviewer extension.
ArcGIS 10.0 – How to Identify and Delete Duplicate Vertices
arcgis-10.0data-reviewergeometrytopologyvertices
Related Solutions
Below are a couple of extension methods for IFeature/IRow that show the actual setting of a value. You'll want to check out cursors and row/feature buffers if you need better performance: http://help.arcgis.com/en/sdk/10.0/arcobjects_net/conceptualhelp/index.html#/d/0001000002rs000000.htm
the extension methods would need to be called when you are already in an edit operation (editor.StartOperation()/editor.StopOperation()): http://resources.esri.com/help/9.3/ArcGISDesktop/dotnet/abbd6e92-04f8-4957-a205-a53773fbf023.htm
/// <summary>
/// Sets the value on IFeature
/// </summary>
/// <param name="feature">The feature with the field to be set</param>
/// <param name="fieldName">Name of the field.</param>
/// <param name="value">The new field value</param>
/// <param name="ignoreMissingFields">if set to <c>true</c> [ignore missing fields].</param>
public static void SetValue(this IFeature feature, string fieldName, object value, bool ignoreMissingFields)
{
(feature as IRow).SetValue(fieldName, value, ignoreMissingFields);
}
/// <summary>
/// Sets the value on IRow
/// </summary>
/// <param name="row">The row with the field to update</param>
/// <param name="fieldName">Name of the field.</param>
/// <param name="value">The new field value</param>
/// <param name="ignoreMissingFields">if set to <c>true</c> [ignore missing fields].</param>
public static void SetValue(this IRow row, string fieldName, object value, bool ignoreMissingFields)
{
int index = row.Fields.FindField(fieldName);
if (index != -1)
{
if (row.Fields.get_Field(index).Editable)
{
row.set_Value(index, value);
}
}
else
{
if (!ignoreMissingFields)
{
throw new System.ArgumentException("Field '{0}' Not Found.".FormatString(fieldName));
}
}
}
You could use an update cursor for this:
attribs = {}
rows = arcpy.UpdateCursor (your_shapefile, "WHERE SQL", "", "FIELDS;SEPARATED;BY;SEMICOLON", "SORTFIELD A; SORTFIELD2 D")
##UpdateCursor (dataset, {where_clause}, {spatial_reference}, {fields}, {sort_fields})
for row in rows:
if row.FIELD_OF_INTEREST in attribs:
attribs[row.FIELD_OF_INTEREST] += 1
else:
attribs[row.FIELD_OF_INTEREST] = 1
row.FIELD_OF_INTEREST = "%s_%i" % (row.FIELD_OF_INTEREST, attribs[row.FIELD_OF_INTEREST])
rows.updateRow(row)
Best Answer
Because Check Geometry and Data Reviewer seem to be contradictory in your case, I suggest to use Feature Vertices To Points and then Collect Events. The events with
ICOUNT > 1
are the duplicate vertices you are looking for.In order to delete duplicate vertices from the original geometries, for instance I'd use GDAL/OGR (>= 1.10 with SpatiaLite support):