Select to view content in your preferred language

Find Line Segment Perpendicular to Point

1236
2
Jump to solution
04-20-2012 11:49 AM
LornaMurison
Regular Contributor
Hi everyone,
I am trying to measure distances between points on a river network.  In order to get an accurate distance measure, there has to be a vertex on the river line where each of the points are located.  Some of my points can be as far as 10 or so metres away from the river, but I have set an arbitrary "snapping" threshold to 6 metres.  I use ITopologicalOperator.Buffer to create a 6 metre buffer around the points and then create an ISpatialFilter to catch all of the river segments that intersect the buffer.  In the image I've attached, the blue line represents the river, flowing south-east, the big red dot represents the point I am trying to "snap" and the little red dot represents the point on the stream I want to snap it to, and thus, create a vertex at.  The line is split into segments.  If I create a cursor to loop through the intersecting segments (of which there are 3 in the picture), the bold segment will be the first one selected.  I need a way to tell it that it is in fact the second segment that I need because this is closest to the point.
I believe that in order to use IProximityOperator.ReturnNearestPoint I already need to have a feature (segment) and not a feature class (river) as the input.  Any suggestion on how to identify the correct line segment?
Thanks.
0 Kudos
1 Solution

Accepted Solutions
AlexanderGray
Honored Contributor
Can you merge (union) all the segments inside the buffer into a single polyline?  You could use the polyline's IProximityOperator to querynearest on the point and return a point.

View solution in original post

0 Kudos
2 Replies
AlexanderGray
Honored Contributor
Can you merge (union) all the segments inside the buffer into a single polyline?  You could use the polyline's IProximityOperator to querynearest on the point and return a point.
0 Kudos
KaushikMysorekar
Regular Contributor
If you are still looking for a solution, take a look at this script; it may be what you are looking for.

http://resources.arcgis.com/gallery/file/arcobjects-net-api/details?entryID=08EE7306-1422-2418-34D2-...
0 Kudos