pagination issue -- resultRecordCount and resultOffset

731
4
Jump to solution
03-09-2020 10:24 PM
simoxu
by MVP Regular Contributor
MVP Regular Contributor

I applied a geometry filter in the query to a ArcGIS Server Map Service (query enabled), when the ResultOffset is set to 0 and resultRecordCount is set to 500, it only returns 36 records

 

 

If I remove these parameters in the query, it returns all the features intersects with the geometry:

 

 

This only happens to the ArcGIS Server Service, if the service is hosted in the ArcGIS Enterprise Portal, it works OK.

 

Any idea what's happening?

 

Thanks you in advance.

please note that I posted the same question in the ArcGIS REST API Community a couple of days ago, but I am thinking it might also be a ArcGIS Server topic,  as this happens on a ArcGIS Server Map/ Feature Service, but it works fine for a hosted service (I know the service is hosted on a federated server...), I am wondering it might have something to do with my ArcGIS Server settings. if it is true.

0 Kudos
1 Solution

Accepted Solutions
TanuHoque
Esri Regular Contributor

Hi Simo,

That is expected behavior.

In short, it is due to how spatial filters are handled in ArcGIS Enterprise Map and Feature Services. The long story is complicated, and I don't think I'd be able to explain this very clearly here without making you more confused.

You should check for 'exceedTransferLimit' flag. This is what we have in REST API help.

The exceededTransferLimit property is now included in the JSON response when paging through a query result with the resultOffset and resultRecordCount parameters. When exceededTransferLimit is true, it indicates there are more query results and you can continue to page through the results. When exceededTransferLimit is false, it indicates that you have reached the end of the query results.

Hope this helps.
Tanu

View solution in original post

4 Replies
TanuHoque
Esri Regular Contributor

Hi Simo,

That is expected behavior.

In short, it is due to how spatial filters are handled in ArcGIS Enterprise Map and Feature Services. The long story is complicated, and I don't think I'd be able to explain this very clearly here without making you more confused.

You should check for 'exceedTransferLimit' flag. This is what we have in REST API help.

The exceededTransferLimit property is now included in the JSON response when paging through a query result with the resultOffset and resultRecordCount parameters. When exceededTransferLimit is true, it indicates there are more query results and you can continue to page through the results. When exceededTransferLimit is false, it indicates that you have reached the end of the query results.

Hope this helps.
Tanu

View solution in original post

simoxu
by MVP Regular Contributor
MVP Regular Contributor

Hi Tanu,

Thanks for your answer to the question.

 

If this is an expected behavior, I am just curious why the hosted service in AGOL and ArcGIS portal do not have this issue, as we all know behind the scenes, the same ArcGIS server is doing the heavy lifting.

More importantly, this expected ArcGIS server behaviour is causing issue in the APIs (at least I have personally experienced the issue in ArcGIS Python API). I dived into the API source code and found, the code checks for the number of records returned, if it is less than the resultRecordCount or the MaxRecordCount (whichever is less) it will assume all the records has been retrieved and stop querying the service.

Many thanks

Simo

0 Kudos
TanuHoque
Esri Regular Contributor
If this is an expected behavior, I am just curious why the hosted service in AGOL and ArcGIS portal do not have this issue, as we all know behind the scenes, the same ArcGIS server is doing the heavy lifting.

That is because technically 'hosted services' and 'enterprise map and feature services' are two different implementation. There are some age old specifications that need to be honored in enterprise implementation of map and feature service that leads us to this known issue.

More importantly, this expected ArcGIS server behaviour is causing issue in the APIs (at least I have personally experienced the issue in ArcGIS Python API). I dived into the API source code and found, the code checks for the number of records returned, if it is less than the resultRecordCount or the MaxRecordCount (whichever is less) it will assume all the records has been retrieved and stop querying the service.

Thanks for noticing this. That seems something that might need to fix in ArcGIS Python API. Would you mind contact Esri Support and have an issue logged in.

Thanks.

Tanu

simoxu
by MVP Regular Contributor
MVP Regular Contributor

Thanks.

I've contacted ESRI local support for this issue to be escalated.