I am using OGR to ETL data from an ArcGIS Map Service into PostGIS. When I run ogrinfo on the service, I see ~47000 records:

ogrinfo -so -al "https://maps.bouldercolorado.gov/arcgis/rest/services/general/BuildingFootprints/MapServer/0/query?where=1%3D1&returnGeometry=true&outFields=*&f=json"
Layer name: ESRIJSON
Geometry: Polygon
Feature Count: 46629
Extent: (-105.634173, 39.918929) - (-105.128672, 40.177275)

I would like to extract all 47,000 records, and I've tried doing this by leveraging the open option for the ESRIJSON driver called FEATURE_SERVER_PAGING to no avail:

ogr2ogr \
-f PostgreSQL \
Pg:"dbname=mydb" \
ESRIJSON:"https://maps.bouldercolorado.gov/arcgis/rest/services/general/BuildingFootprints/MapServer/0/query?where=1%3D1&returnGeometry=true&outFields=*&orderByFields=OBJECTID+ASC&f=json" \
-nln "sandbox.buildings" \
-t_srs "EPSG:2876" \

The documentation for this driver seems to suggest that pagination will happen automatically even without the feature server paging parameter set, but I only ever get 2000 results when I query the new table in PostgreSQL.

How do I extract all 47000 records with OGR using the command line interface?

The ArcGIS Server is 10.8, GDAL/OGR is 3.3.1, PostgreSQL is 13.3, PostGIS is 3.1.3



Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.