<?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 Spatial Query - Geometry Engine Differences in .NET Maps SDK Questions</title>
    <link>https://community.esri.com/t5/net-maps-sdk-questions/spatial-query-geometry-engine-differences/m-p/509456#M6263</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;We use a number of Spatial Queries in our code using a Spatial Query Filter against a Feature Layer (FeatureServiceTable.QueryAsync).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Running a 'Within' query in our application gives different results to running it in ArcMap. So in Arcmap we would get 33 Features (correctly) returned from 'Within' a selected polygon. When performing this query in code we get 39 features returned from the Feature Layer. 6 features difference.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Interestingly if straight after getting those 39 features back querying our Feature Layer we loop through them and perform the same Within operation using the local 'GeometryEngine.Within' function it will only find 33 of them to be valid - as we would have expected in the first place.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sample code snippet below:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="c#" __jive_macro_name="code" class="jive_macro_code jive_text_macro _jivemacro_uid_14151145082528240" jivemacro_uid="_14151145082528240"&gt;
&lt;P&gt;Dim qf As New SpatialQueryFilter() With {.WhereClause = Nothing, .SpatialRelationship = SpatialRelationship.Within, .Geometry = QueryGeometry}&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;Dim results As IEnumerable(Of Esri.ArcGISRuntime.Data.Feature) = Await .FeatureServiceTable.QueryAsync(qf)&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;For Each feature As Esri.ArcGISRuntime.Data.Feature In results&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; Dim validatedCount As Integer = 0&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; If GeometryEngine.Within(feature.Geometry, QueryGeometry) Then&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; validatedCount += 1&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; End If&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;Next&lt;/P&gt;


&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;39 features after querying the Feature Layer. 33 validated using the GeometryEngine against the results.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Am I doing something obviously wrong here? I assumed the SpatialRelationship.Within would return the same results?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Jon&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 04 Nov 2014 15:26:10 GMT</pubDate>
    <dc:creator>JonDicken</dc:creator>
    <dc:date>2014-11-04T15:26:10Z</dc:date>
    <item>
      <title>Spatial Query - Geometry Engine Differences</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/spatial-query-geometry-engine-differences/m-p/509456#M6263</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;We use a number of Spatial Queries in our code using a Spatial Query Filter against a Feature Layer (FeatureServiceTable.QueryAsync).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Running a 'Within' query in our application gives different results to running it in ArcMap. So in Arcmap we would get 33 Features (correctly) returned from 'Within' a selected polygon. When performing this query in code we get 39 features returned from the Feature Layer. 6 features difference.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Interestingly if straight after getting those 39 features back querying our Feature Layer we loop through them and perform the same Within operation using the local 'GeometryEngine.Within' function it will only find 33 of them to be valid - as we would have expected in the first place.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sample code snippet below:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="c#" __jive_macro_name="code" class="jive_macro_code jive_text_macro _jivemacro_uid_14151145082528240" jivemacro_uid="_14151145082528240"&gt;
&lt;P&gt;Dim qf As New SpatialQueryFilter() With {.WhereClause = Nothing, .SpatialRelationship = SpatialRelationship.Within, .Geometry = QueryGeometry}&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;Dim results As IEnumerable(Of Esri.ArcGISRuntime.Data.Feature) = Await .FeatureServiceTable.QueryAsync(qf)&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;For Each feature As Esri.ArcGISRuntime.Data.Feature In results&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; Dim validatedCount As Integer = 0&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; If GeometryEngine.Within(feature.Geometry, QueryGeometry) Then&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; validatedCount += 1&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; End If&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;Next&lt;/P&gt;


&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;39 features after querying the Feature Layer. 33 validated using the GeometryEngine against the results.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Am I doing something obviously wrong here? I assumed the SpatialRelationship.Within would return the same results?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Jon&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 04 Nov 2014 15:26:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/spatial-query-geometry-engine-differences/m-p/509456#M6263</guid>
      <dc:creator>JonDicken</dc:creator>
      <dc:date>2014-11-04T15:26:10Z</dc:date>
    </item>
  </channel>
</rss>

