Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I'm currently working with street intersections trying to find point(or points) where 2 given streets intersect(!disjoin). Streets are all Polyline features, and I have to work with 2 features at given time. I think this way it can be determined if they intersect(haven't yet tested it),

    public List<IPoint> RoadIntersections(IPolyline poly1, IPolyline poly2)
    {
        IRelationalOperator ro = null;
        ro = poly1 as IRelationalOperator;

        ISegmentCollection sc = new PolylineClass() as ISegmentCollection;
        sc.AddSegment((ISegment)poly2);

        if (ro.Disjoint(sc as IGeometry) == false) //if they intersect
        {
            //TODO: find intersection points
        }
     ...

but what I would like to do is to find point (or points) where those two polylines intersect.

Any help would be appreciated.

share|improve this question
    
Have you tried using the "Locate Features Along Routes" tool in ArcGIS 10? –  Aaron Aug 13 '12 at 15:19
add comment

2 Answers 2

up vote 3 down vote accepted

You can use ITopologicalOperator Interface for finding intersections. esriGeometry0Dimension gets you the result in points/multipoints.

        List<IPoint> resultPoints = new List<IPoint>();
        ITopologicalOperator topOperator = (ITopologicalOperator)poly1;
        IGeometry resultGeom = (IGeometry)topOperator.Intersect(poly2, esriGeometryDimension.esriGeometry0Dimension);

        IGeometryCollection pointCollection = (IGeometryCollection)resultGeom;

        for (int i = 0; i < pointCollection.GeometryCount; i++)
        {
            resultPoints.Add((IPoint)pointCollection.get_Geometry(i));
        }
share|improve this answer
    
Thanks, implemented in my code and it works. And I were actually starting to calcualte that point mathematically. :D –  Sunder Aug 13 '12 at 11:45
    
thanks for the edit..it was typed from memory :) –  vinayan Aug 13 '12 at 12:35
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.