Skip to content

Fix ESRIGeoJSON: handle Empty reply from server and paginate past maxRecordCount#52

Open
rywall wants to merge 2 commits intomasterfrom
fix-esri-geojson-empty-reply
Open

Fix ESRIGeoJSON: handle Empty reply from server and paginate past maxRecordCount#52
rywall wants to merge 2 commits intomasterfrom
fix-esri-geojson-empty-reply

Conversation

@rywall
Copy link
Copy Markdown
Member

@rywall rywall commented May 8, 2026

Summary

  • Empty reply from server: ESRIGeoJSON passed remote URLs straight to ogr2ogr, which uses GDAL's curl client. Some ArcGIS-on-IIS endpoints return an empty reply to that client (likely an HTTPS 1.1 negotiation issue — GDAL's driver list hints at this with MapInfo File' needs https 1.1), producing ERROR 1: Empty reply from server. Fix: fetch the URL with Ruby's `open-uri` into a tempfile, then run `ogr2ogr` on the local path.
  • Truncation at maxRecordCount: ArcGIS query endpoints cap each response at the service's `maxRecordCount` (commonly 1000 or 2000 features) and signal `exceededTransferLimit` when more results exist. Fix: walk the pages with `resultOffset` and merge them into a single FeatureCollection before handing to `ogr2ogr`.
  • Local-path behavior is unchanged.

Test plan

  • Import features from an ArcGIS-on-IIS REST `query?...&f=geojson` URL that previously failed with `Empty reply from server`.
  • Import features from an ArcGIS query URL whose result set exceeds `maxRecordCount` and confirm all features are returned (not just the first page).
  • Import features from an ArcGIS query URL whose result set fits in one page and confirm a single request is still made.
  • Import features from a local `.geojson` / `.json` file (regression check for the relative-path branch).

🤖 Generated with Claude Code

rywall and others added 2 commits May 7, 2026 20:36
GDAL's curl-based fetcher fails with "Empty reply from server" against
some ArcGIS endpoints (e.g. Cloudflare-fronted servers that only offer
HTTPS 1.1). Fetch remote URLs with Ruby's open-uri and hand ogr2ogr a
local tempfile instead.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
ArcGIS query endpoints truncate each response at the service's
maxRecordCount (commonly 1000 or 2000 features) and set
exceededTransferLimit when more results exist. Walk the pages with
resultOffset and merge them into a single FeatureCollection before
handing to ogr2ogr.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@rywall rywall changed the title Fix ESRIGeoJSON import failing with "Empty reply from server" Fix ESRIGeoJSON: handle Empty reply from server and paginate past maxRecordCount May 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant