Search code examples
esriarcgis-js-apiesri-arc-engine

How can I access all county data for the Esri COVID-19_Public_Health_Status_by_County API?


I just want to make a simple GET request to this URL:

https://services.arcgis.com/pGfbNJoYypmNq86F/arcgis/rest/services/COVID19_Public_Health_Status_by_County/FeatureServer/0/query?where=1%3D1&outFields=*&outSR=4326&f=json 

And get the associated JSON data. The problem is this resource returns only 1000 records. I believe there are about 3000+ counties in the US. You can see more info about this API here:

https://coronavirus-resources.esri.com/datasets/97792521be744711a291d10ecef33a61/geoservice?geometry=6.433%2C-16.701%2C-38.567%2C72.161&showData=true

I am getting lost in a sea of documentation for what should be a pretty straightforward operation. Do I need to create an application and authenticate, then send that token along with the GET request? How should the headers be formatted if that's the case? I checked both authentication and Rest API feature level tutorials, there was no mention of how to authenticate a request in either of them.

In summary, I just need to make sure I get all the data from the API request. Right now it's only 1000 counties. I need all 3000+.


Solution

  • For what I see it's is actually public, so I don't think you need to login or anything.

    It is a FeatureService, and it actually has the default number of feature per request restriction of ArcGIS Server map server, 1000 feature.

    In order to get all the information with requests you will have to do several request. There are 3152 features (count request), so you will have to make at least 4 request.

    You can use OBJECTID field in order to get the chunks, you can be sure that is a unique field.

    Or you can iterate on a know discrete set like state_name (number of features per state request), or by region (number of features per region request). Of course you have to be sure that each possible value is less than the maximun, for example you could not do it by time_zone (number of features per time_zone request) because central=1563 and eastern=1102.