I have a polyline that passes through a polygon, I???m trying to get the two intersect points on the polygon edge. If I try to get the fist and last of what is returned for the intersect point collection I get inconsistent results.

Does anyone have some input as what I might be doing wrong? I have my code block below.

Appreciate the help

vb

Does anyone have some input as what I might be doing wrong? I have my code block below.

Appreciate the help

vb

Polyline outGeometry = new Polyline(); IGeometryCollection geometryCollection = null; if(geometryCollection == null) { IGeometryBag geometryBag = new GeometryBag(); geometryCollection = (IGeometryCollection) geometryBag; geometryBag.setSpatialReferenceByRef(mySpatialRef)); } // union all your polylines for(int i=0; i<featureList.size(); i++) { geometryCollection.addGeometry(featureList.get(i).getShape(), null, null); } outGeometry.constructUnion((IEnumGeometry) geometryCollection); ((ITopologicalOperator) outGeometry).simplify(); ITopologicalOperator topo ; geometry = ((ITopologicalOperator)geometry).getBoundary(); topo = (ITopologicalOperator)geometry ; IGeometry intersects = topo.intersect((IGeometry) outGeometry, esriGeometryDimension.esriGeometry0Dimension); IPointCollection Pts = (IPointCollection)intersects; for (int j=0;j<Pts.getPointCount();j++){ tempIntersectPointList.addPoint(Pts.getPoint(j), null, null); } firstPointOnEdge = tempIntersectPointList.getPoint(0) secondPointOnEdge = tempIntersectPointList.getPoint(tempIntersectPointList.getPointCount() - 1),

It looks like it returns the points from the top to the bottom. I ran a test using the code below on a polygon and line, flashing each point in the geometry collection. The image below shows the direction the line was digitized by the arrows. The upper right intersection point was flashed first.

Is it a polygon with no internal holes? In the sample I ran, I used a donut polygon, which resulted in four intersections. If you look at the help for Boundary, you'll see that it will return all the rings of a polygon, not just the outside boundary.

[ATTACH=CONFIG]17019[/ATTACH]

## Attachments

vb