Unexpected Result With esriSpatialRelEnvelopeIntersects and Shapefiles

631
0
03-20-2013 04:21 PM
by Anonymous User
Not applicable
Original User: jflorey

Hi All,

I am getting an unexpected result when I query a shapefile source feature class with a Spatial Filter using the esriSpatialRelEnum.esriSpatialRelEnvelopeIntersects for my spatial filter SpatialRel property.  The shapefiles are projected into NAD_1983_UTM_Zone_17N.  I will post the C# code I wrote to be used with an Add-In as EndpointSpatialSelection.txt (I can't upload a file with a .cs extension).  Essentially the code grabs a user selected polyline feature, gets the from point of the feature and performs a spatial search on a point feature class around the from point of the polyline.  When I set the spatial filter's SpatialRel property to esriSpatialRelEnvelopeIntersects, the search is returning point features that are as far as 71 meters away from the line's from point.  If I change the SpatialRel property to esriSpatialRelIntersects, the search returns just a single point that is directly above the from point of the line.  I tested similar code with a VBA macro in Arc 9.3.1 and got the same result.  If I change the datasource to a file geodatabase projected into the same coordinate space, both searches return just the expected result, a single point that lies directly on top of the linear feature endpoint.  When I wrote out the bounding coordinates of the envelopes of the search point and all of the points returned by the spatial search, only one returned feature had a bounding box that overlay the bounding box of the search point.  The attached C# code will select all of the point features returned by the search, and will write out the envelope X and Y Min and Max for every found point.  I will also attach the bounding box values (NorthBayResults.txt).

Any assistance would be greatly appreciated.

Cheers,
Jay
0 Kudos
0 Replies