I am playing around with some C# logic to spin line segments indicating if polygons are on the left or right of the line segment. I am using ISpatialFilter and esriSpatialRelEnum.esriSpatialRelTouches relationship to find polygons that touch a line segment. I have seen references to the HitTest method to determine left and right side of the relationship based on the bRightSide flag. However, with my test layer of lines and polygons which looks like

Relative to the highlighted street segment, my program finds that it touches polygons A, B, and C but the polygons that I will be interested in are going to be A and C since they are the ones on the left and right of the line segment. B is just touch -- or in the case of a segment that is truly perpendicular to B -- so I would expect the bRightSide flag to be incorrect for HitTest in this case.

Any suggestions or a better solution?

Thanks

I can think of two ways to do this.

Create two points on either side of the line at its midpoint using the IConstructPoint.ConstructOffset Method.

With each point do the hittest to determine which side of the line it is then find the underlying polygon with a search query.

The other method is to use topology. Programmatically create a topology graph around the line with the line and polygons. Get the topology edge the line belongs to then get the left and right polygons via the ITopologyEdge methods (LeftParents, RightParents).

If you have a bunch of these to do I don't know which approach will be quicker but you're probably more familiar with the code in the first option.