layer.query() with Geometry filters returns incomplete results.
See original GitHub issueRunning a layer.query() with a Geometry filter returns only some of the expected records.
To Reproduce Query a layer using a Geometry filter:
import arcgis
# Polylines
GEOM = {"paths":[[[265091.207,6637610.73],[265066.57,6637626.64],[265058.70,6637658.92],[265051.398,6637692.902],[265048.31,6637728.14],[265045.603,6637765.623]],
[[265126.08,6637725.828],[265133.88,6637735.42],[265127.43,6637771.09]]],"spatialReference":{"wkid":25833,"latestWkid":25833}}
_gis = arcgis.GIS('pro')
_parcels = arcgis.gis.Item(_gis, '577566e7970e4f9fa53f1afb58c43178')
_myfilter = arcgis.geometry.filters.intersects(GEOM)
_res = _parcels.layers[0].query(
geometry_filter=_myfilter,
out_fields="kommunenr,gardsnr,bruksnr",
geometry_precision=2,
distance=5,
units="esriSRUnit_Meter")
print(len(_res))
The problem seems to be that the API does a recordcount and uses it to set max_records in the query. After changing from record_count to max_records at line 1795 in features/layer.py
all intersecting parcels are returned from the service.
Expected behavior All intersecting parcels should be returned in the result.
Platform (please complete the following information):
- Python API Version: 1.9.1
- AGE Enterprise 10.8.1
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Feature Layer query can't return all the matching records
The geometry filter is a ploygon that returns all the land parcels that intersect with it. Here is an update on what I've...
Read more >ArcGIS API for Python geometric filter of feature layer ...
Ran a non-geometric query (where='OBJECTID<10') on portalLayer (worked as expected); Look at the result of AOI_geom_filter - it's a dictionary ...
Read more >Query (Feature Service/Layer)—ArcGIS REST APIs
The query operation returns either a feature set, an array of feature IDs, ... This is due to internal spatial index filtering of...
Read more >Read simple features or layers from file or database - r-spatial
S3 method for character st_read( dsn, layer, ..., query = NA, ... of class sf_layers is returned with the layer names, each with...
Read more >Reading and Writing Files - GeoPandas
Any arguments passed to geopandas.read_file() after the file name will be passed ... The geometry filter only loads data that intersects with the...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
The bug also applies to API 2.0.0
@achapkowski Still, as long as this server side bug exists I will argue that the Python API should not add a feature count parameter when there are a spatial filter, or at least you should not override the result_record_count set by the user if any.