Esri / ArcREST

python package for REST API (AGS, AGOL, webmap JSON, etc..)
Apache License 2.0
192 stars 155 forks source link

Add Pagination to Query? #241

Closed achapkowski closed 8 years ago

achapkowski commented 8 years ago

ArcRest or ArcRestHelper

ArcREST

Version or date of download

Current

Bug or Enhancement

Enhancement

Repo Steps or Enhancement details

Would it be possible to add the 10.3 functionality “Pagination” to the .query() method of arcrest.agol.services.FeatureLayer and arcrest.ags.layer.FeatureLayer ???

achapkowski commented 8 years ago

Issue resolved, please pull the latest code to get the code.

RolandVanZoest commented 8 years ago

Hello Andrew,

FeatureLayer.query with returnCountOnly-flag results in an error ...

QryRes = FL.query ( returnCountOnly=True )

Traceback (most recent call last): File "", line 1, in File "C:\Python27\ArcGIS10.3\lib\site-packages\arcrest\agol\services.py", line 1793, in query return FeatureSet.fromJSON(jsonValue=json.dumps(result)) File "C:\Python27\ArcGIS10.3\lib\site-packages\arcrest\common\general.py", line 617, in fromJSON for feat in jd['features']: KeyError: 'features'

Applying the new(?) resultOffset parameter has no effect: QryRes = FL.query ( returnFeatureClass = True, out_fc = FC_Full, resultOffset = 100 ) delivers the same features as with resultOffset=0

Applied to a FeatureService with 108 records: len(FL.query(resultOffset=0).features) gives 108 len(FL.query(resultOffset=50).features) gives 108 (should be 58)

In these examples ... FL = arcrest.ags.layer.FeatureLayer ( URL ) URL = 'http://tmservices1.esri.com/arcgis/rest/services/LiveFeeds/Earthquakes/MapServer/0' ( AGOL features ) or URL = 'http://scomp1250:6080/arcgis/rest/services/Roland/SpotFootPrints/FeatureServer/0' ( a local feature service with 108 polygons )

Bye, Roland

MikeMillerGIS commented 8 years ago

I will take a look, I am working with query right now

RolandVanZoest commented 8 years ago

Hello Andrew, Mike,

FL.query ( returnCountOnly=True ) is functioning normal again, and FL.query ( resultOffset=500 ) works as well ! I just had to be more critical which service(s) to query. Only if it mentions "Supports Pagination: true" then it's OK

Thanks ! Roland