My current process is to determine obstructions in an area and determine properties of those obstructions as they relate to a centre polyline. Per the image below I take a polyline which denotes a flight path. I then buffer the polyline by x units to get an accountability polygon. For each of the points inside the polygon I will determine the lateral distance to the centre line and also the distance along the centre line.
I use ArcObjects against ArcGIS 10.4.1 with a Basic License. My process works great when the flight path is simple. however, when the path is more complex (ie it overlaps itself) I am having difficulty in trying to analyse the scenario.
In its basic format my code looks like this:
'For a given point, polyline, and polygon feature class
Dim spatialFilter As ISpatialFilter = New SpatialFilter
spatialFilter.Geometry = pGeomPolygon
spatialFilter.GeometryField = pPointFeatClass.ShapeFieldName
spatialFilter.SpatialRel = esriSpatialRelEnum.esriSpatialRelContains
'from the results above I now iterate through the filtered obstruction points
for each ptObs as IPoint in filteredList
'get the point on the line that is closest to ptObs
Dim pntAlongCenterline As IPoint = New Point
Dim distAlongLineToPnt As Double = 0, distFromPntToLine As Double = 0, IsToRightOfLine As Boolean
pPolyline.QueryPointAndDistance(esriSegmentExtension.esriNoExtension, ptObs, False, pntAlongCenterline, distAlongLineToPnt, distFromPntToLine, IsToRightOfLine)
'we can think of these two values as the "x" and "y" coordinates of the obstruction if we took the polyline as the axis.
'distAlongLineToPnt is the distance along the centerline where the obstruction is located if we were to draw a perpendicular segment
'distFromPntToLine is the lateral distance from the centerline to the obstruction
next ptObs
The problem arises when the flight path is complex and it overlaps itself. In that case a single obstruction can correspond to two locations on the flight path as I have drawn in the image where the polygon intersects itself. In this case I can't use QueryPointAndDistance as that gives me only one point on the centre line: the closest. That obstruction should be accounted for twice in the flight path but am drawing a blank in how I can process this type of scenario.