Select to view content in your preferred language

Using ESRI.ArcGIS.DataManagementTools.RepairGeometry

1451
2
01-06-2011 03:31 AM
DaleBridgford
New Contributor III
Hi,

I am trying to update some code from VB6 to VB.Net 2008 and have been generally successful.  However, I come across an issue where, as it processes each polygon in the shapefile and implements the following code.
Dim lngExtRing as Integer
lngExtRing = pPolygon.ExteriorRingCount - 1
ReDim pExtRings(pPolygon.ExteriorRingCount - 1)
pPolygon.QueryExteriorRingsEx(pPolygon.ExteriorRingCount, pExtRings(0))
pExtRings(lngExtRing)

Once that code runs and you hover over the pExtRings portion of pExtRings(lngExtRing) for some polygons (not all), the first popup lists a ComObject but if you expand the plus, it indicates "Nothing".

I have run this on a shapefile that has 5 polygons and the two polygons that it fails on have negative areas.  There are two ways that might resolve this, but I don't know how to implement either.  One was to reverse the orientation if the area was negative, but I tried that on a different shapefile and it still failed on a polygon that did not have a negative area.  The other, perhaps better, approach would be to implement the RepairGeometry class of ESRI.ArcGIS.DataManagementTools, but I have no clue on how to make it happen.

If anyone has any insight or examples of how to use RepairGeometry, I would certainly appreciate being enlightened.

Thanks

Dale
0 Kudos
2 Replies
DuncanHornby
MVP Notable Contributor
Dale,

If I was calling an existing geoprocessing tool in VB then I would use the IGeoProcessor Interface. Search for this in the Help and then may be the forum to see how to set it up and supply the parameters to execute it.

Have a look at this thread, the basic syntax is all there.

Duncan
0 Kudos
DaleBridgford
New Contributor III
Duncan,

Thanks for the reply.  I will pursue that next week when I get a little time to revisit the project.

Thanks,

Dale
0 Kudos