Spatial Query with polygon on query layer with inconsistent results

3859
4
06-18-2019 01:49 AM
FrédéricBarras
New Contributor II

Hi,

I am currently getting confusing results from a spatial query with a polygon on a view based on a feature class.

Depending on the access (REST on Mapservice 10.6 with chrome or or ArcGIS Pro), I do get different results, both wrong. Expected are points all over Switzerland.

See following pictures.

1 ) the polygon : 

2) the results with the REST Call

where=IS_HALTESTELLE+%3D+1+AND+LAENDERCODE+%3D+85+AND+GUELTIG_VON+%3C%3D+DATE+%272019-01-01%27+&outFields=DIDOK_CODE%2C+BEZEICHNUNG_OFFIZIELL%2C+IS_HALTESTELLE%2C+BPVH_BEZEICHNUNG_ALT%2C+BPVH_VERKEHRSMITTEL&returnGeometry=true&returnTrueCurves=false&returnIdsOnly=false&returnCountOnly=false&orderByFields=&returnZ=false&returnM=false&returnDistinctValues=false&resultOffset=&resultRecordCount=&returnExtentOnly=false&geometryType=esriGeometryPolygon&geometry=%7Brings:%5B%5B%5B2461641,1103128%5D,%5B2551481,1282399%5D,%5B2582618,1313301%5D,%5B2646531,1284272%5D,%5B2678370,1336127%5D,%5B2787934,1265309%5D,%5B2768093,1230368%5D,%5B2805551,1207542%5D,%5B2818778,1221940%5D,%5B2841487,1206371%5D,%5B2843126,1157208%5D,%5B2808594,1104182%5D,%5B2752056,1127593%5D,%5B2731806,1067192%5D,%5B2710384,1066021%5D,%5B2677726,1107459%5D,%5B2612760,1061105%5D,%5B2569918,1058764%5D,%5B2531992,1134382%5D,%5B2497577,1077610%5D,%5B2461641,1103128%5D%5D%5D,spatialReference:%7Bwkid:2056%7D%7D&inSR=2056&spatialRel=esriSpatialRelContains&f=json

Only the region Geneva is delivered

3) the results with the query in ArcGIS Pro

Some features outside of the polygon are delivered (highlighted in red)


Does anyone have any suggestion as to why it fails?

The same query directly on the feature class deliver expected results.

A query with an envelope instead of a polygon on the view deliver expected results


Cheers

Frédéric

0 Kudos
4 Replies
CedricDespierreCorporon
Esri Contributor

Hello,

Regarding the rest query, any query made on a map/feature service have a limited number of results returned by the server (usually 1000 or 2000 that can be configured on the service).

Without changing the configuration, there are way to iterate over the full result set to get every point (loop with resultOffset parameter)

The parameters are available here : https://developers.arcgis.com/rest/services-reference/query-feature-service-layer-.htm

For the ArcGIS Pro part, it does not seem a standard behavior, so I'd check the following :

  • if the points are not a somehow a "Multi-point" geometry (that could explain one of the multipoint is inside the polygon and the other outside)
  • if the comportement is the same in the lasted version of ArcGIS Pro
  • if the comportement is the same when you export both the polygon and the data in a simple filegdb

Depending on the result, a contact with Esri support using you usual workflow could help pinpoint the problem.

0 Kudos
FrédéricBarras
New Contributor II

Hi,


Thanks for the input!

The max number of results is not the issue in this particular case (I should have mentioned it in the original post). the features are simple points, but some of them have a "null" geometry. I suspect that having empty geometries could also be a troublemaker.

The false results seem only to occur when both points are true:

* the layer is built on a view (--> queryLayer)

* the spatial element of the query is a polygon

Concerning ArcGIS Pro

I'll install the last version of ArcGIS Pro in the next days, so I'll be able to test it again. Queries with a simple filegdb do work as expected, since I do not have a view.

Before contacting Esri support, I'll have to find some time in order to create a self-contained example to send. But as soon as done, I'll link interesting information on this post.

Cheers
Frédéric

0 Kudos
CedricDespierreCorporon
Esri Contributor

Hello,

Thanks, I should have known it would not be that simple ! However, the REST pic really looked like a feature limit problem.

Also, I guess you still have an ArcMAP laying around ?  I'd also check if the querylayer behavior is the same.

In any case if you contact the support, please specify the version you are using for each products,the os, versions,the spatial reference, and the geometry data type.

0 Kudos
MatthiasSchenker
Esri Contributor

Hi Frédéric

I have not tried it myself but I am wondering if the issue could be coming from ArcGIS Pro calculating in WebMercator due to the basemap. Have you tried specifying "CH19013+" as the Output Coordinate System for the "Select Layer by Location" call in ArcGIS Pro (or whatever is the coordinate system of your polygon)?

Best,

Matthias

0 Kudos