3

I have a polyline that I would like to query features that are on it's left, right, top, bottom. I am not looking for the features surrounding it but for features that are on a certain location from the polyline. Example: I am trying to query features that are on the left side of the polyline. The pictures below demonstrate what I am looking for.

I tried ItopologicalOporator, but the buffering takes all the features surrounding it which is not what I want. any Ideas ?

enter image description here

ZZZ
  • 574
  • 4
  • 18
  • Possibly related questions http://gis.stackexchange.com/questions/156578/how-to-detect-if-point-is-on-the-left-or-right-side-of-the-line-in-postgis http://gis.stackexchange.com/questions/120794/selecting-points-on-one-side-of-the-road http://gis.stackexchange.com/questions/149661/how-to-determine-if-two-points-are-on-the-same-side-of-a-linestring – user30184 Sep 06 '15 at 12:50
  • I would start with a simple solution and see if the results are good enough. Create a new line with 0.01 m offset to the left of the original file. Compute distances. If feature is closer to the leftside offset line than to the original line, it belongs to your leftside group. – user30184 Sep 06 '15 at 14:58
  • Does a simple bounding box test? For left of polyline s, select polygons i where xmax(i) > xmin(s) and ymin(i)>ymin(s) & ymax(i)<ymax(s) assuming you want polygons that are fully within the N-S limits of s... – Spacedman Sep 07 '15 at 09:43

2 Answers2

3

You can try to use a Spatial Query. Just define the geometry, and you will get features depending on that geometry.

// create a spatial query filter
ESRI.ArcGIS.Geodatabase.ISpatialFilter spatialFilter = new ESRI.ArcGIS.Geodatabase.SpatialFilterClass();

// specify the geometry to query with
spatialFilter.Geometry = searchGeometry;

// perform the query and use a cursor to hold the results
ESRI.ArcGIS.Geodatabase.IQueryFilter queryFilter = new ESRI.ArcGIS.Geodatabase.QueryFilterClass();
queryFilter = (ESRI.ArcGIS.Geodatabase.IQueryFilter)spatialFilter;
ESRI.ArcGIS.Geodatabase.IFeatureCursor featureCursor = featureClass.Search(queryFilter, false);

The question now is which geometry you should use. My suggestion is to create a circle, and divide the circle in 4 portions, so every portion is related with one option: left, top, right, bottom.

Katah
  • 1,070
  • 7
  • 11
  • I also came to this solution but using polygons instead of circles. I called it the long way since I have to build a polygon from each edge, decide if the polygon is in the right direction, and get the features that intersect the polygon. I was hoping I would find a quick way through a method or interface within the arcobjects apis. It seems the long way is the way to go, I will post my solution soon. – ZZZ Sep 08 '15 at 10:09
1

Here is the solution to my problem, I was hoping I would find an interface or some class that would do this for me, but I guess I'll have to do it manually. Simply, my problem was I have a polygon named "A". This polygon is made up from segments, and I want to decide which segment has the most features that are on its outer side.

then I get the segments that make up Polygon A and start analyzing and examining it. I used queryNormal twice on the segment being examined (once for using from point and once using the to point as the distance). The resulting lines will be parallel, so I get those lines ToPoint and create a line that connects them now I have 3 new lines plus the examined segment from Polygon A. I used IsegmentCollection interface and added those 4 segments, thus creating a polygon shape(casted it to Ipolygon). once I had the geomatry that I want to use in my search, I used the spatial reference to query those features that intersect the new polygon I created. This process is repeated for all the segments that make up Polygon A.

ZZZ
  • 574
  • 4
  • 18