<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Unexpected Result With esriSpatialRelEnvelopeIntersects and Shapefiles in ArcObjects SDK Questions</title>
    <link>https://community.esri.com/t5/arcobjects-sdk-questions/unexpected-result-with/m-p/590267#M15933</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Original User: jflorey&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Hi All,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;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.&amp;nbsp; The shapefiles are projected into NAD_1983_UTM_Zone_17N.&amp;nbsp; 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).&amp;nbsp; 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.&amp;nbsp; 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.&amp;nbsp; 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.&amp;nbsp; I tested similar code with a VBA macro in Arc 9.3.1 and got the same result.&amp;nbsp; 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.&amp;nbsp; 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.&amp;nbsp; 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.&amp;nbsp; I will also attach the bounding box values (NorthBayResults.txt).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Any assistance would be greatly appreciated.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Cheers,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Jay&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 20 Mar 2013 23:21:59 GMT</pubDate>
    <dc:creator>Anonymous User</dc:creator>
    <dc:date>2013-03-20T23:21:59Z</dc:date>
    <item>
      <title>Unexpected Result With esriSpatialRelEnvelopeIntersects and Shapefiles</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/unexpected-result-with/m-p/590267#M15933</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Original User: jflorey&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Hi All,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;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.&amp;nbsp; The shapefiles are projected into NAD_1983_UTM_Zone_17N.&amp;nbsp; 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).&amp;nbsp; 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.&amp;nbsp; 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.&amp;nbsp; 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.&amp;nbsp; I tested similar code with a VBA macro in Arc 9.3.1 and got the same result.&amp;nbsp; 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.&amp;nbsp; 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.&amp;nbsp; 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.&amp;nbsp; I will also attach the bounding box values (NorthBayResults.txt).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Any assistance would be greatly appreciated.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Cheers,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Jay&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 Mar 2013 23:21:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/unexpected-result-with/m-p/590267#M15933</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2013-03-20T23:21:59Z</dc:date>
    </item>
  </channel>
</rss>

