Problem with merging features created using ICircularArc

576
2
Jump to solution
06-25-2012 07:44 AM
YukunXing
New Contributor III
I need a tool to creat buffer around a point, which is a typicall round buffer, but with one side cut depending on some parameters. Looks like ICircularArc is the perfect class. I get the tool to creat all the buffers as I need and output to either a shapefile or database. However, as a last step I need to merge all the individual buffers to creat a single feature, for which a manual operation is convenient enough. But as soon as I merge them, everything disappears. Doesn't matter if the output is in a GDB or shapefile. Anyone has idea what is going on and what I can do to fix the problem? I'm including the code snippet I used for creating the individual buffers, and a shapefile which if you merge all features, everything will disappear.

Interestingly, if the geometries of all features are somewhat touched before merging, for example, all polygons selected and cut, merging would work as expected.

Thanks in advance!

... IPoint point = feature.Shape as IPoint;  if (!CompareSpatialRefs(spatialReferenceOut,spatialReferenceSiren))                     point.Project(spatialReferenceOut);                 ICircularArc circArc = new CircularArcClass();                 ILine2 lineClosePolygon = new LineClass(); ISegmentCollection ring1 = new RingClass();                 ring1.AddSegment(circArc as ISegment, ref missing, ref missing);                 ring1.AddSegment(lineClosePolygon as ISegment, ref missing, ref missing);                  IPolygon4 polygon = new PolygonClass();                 polygon.SpatialReference = spatialReferenceOut;                  IGeometryCollection geometryCollection = polygon as IGeometryCollection;                 geometryCollection.AddGeometry(ring1 as IGeometry, ref missing, ref missing); circArc.PutCoordsByAngle(point, start_angle, central_angle_span, radius * HorizontalUnit_FT2OutputUnit); lineClosePolygon.PutCoords(circArc.ToPoint, circArc.FromPoint); geometryCollection.GeometriesChanged(); outputFeatureBuffer.Shape = polygon;                 outputFCcursor.InsertFeature(outputFeatureBuffer); ...
0 Kudos
1 Solution

Accepted Solutions
NeilClemmons
Regular Contributor III
The polygons in your shapefile are oriented in the wrong direction.  When you create a polygon, exterior rings should be oriented clockwise.  A ring that is oriented counter-clockwise is considered a "hole" and will have a negative area.

View solution in original post

0 Kudos
2 Replies
NeilClemmons
Regular Contributor III
The polygons in your shapefile are oriented in the wrong direction.  When you create a polygon, exterior rings should be oriented clockwise.  A ring that is oriented counter-clockwise is considered a "hole" and will have a negative area.
0 Kudos
YukunXing
New Contributor III
The polygons in your shapefile are oriented in the wrong direction.  When you create a polygon, exterior rings should be oriented clockwise.  A ring that is oriented counter-clockwise is considered a "hole" and will have a negative area.


I noticed the negative area when I was trying to figure this out but unfortunately didn't follow that up. Seeing your reply I reversed the direction of the circular arc and that resolved the issue! Thank you so much Neil. I've marked your reply as the answer.
0 Kudos