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


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.

| improve this answer | |
  • 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 8 '15 at 10:09

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.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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