Hi,
We use a number of Spatial Queries in our code using a Spatial Query Filter against a Feature Layer (FeatureServiceTable.QueryAsync).
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.
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.
Sample code snippet below:
Dim qf As New SpatialQueryFilter() With {.WhereClause = Nothing, .SpatialRelationship = SpatialRelationship.Within, .Geometry = QueryGeometry}
Dim results As IEnumerable(Of Esri.ArcGISRuntime.Data.Feature) = Await .FeatureServiceTable.QueryAsync(qf)
For Each feature As Esri.ArcGISRuntime.Data.Feature In results
Dim validatedCount As Integer = 0
If GeometryEngine.Within(feature.Geometry, QueryGeometry) Then
validatedCount += 1
End If
Next
39 features after querying the Feature Layer. 33 validated using the GeometryEngine against the results.
Am I doing something obviously wrong here? I assumed the SpatialRelationship.Within would return the same results?
Thanks,
Jon