Skip to content

Instantly share code, notes, and snippets.

@psd
Created June 11, 2024 06:21
Show Gist options
  • Save psd/a5ea031579e77a1b6a92e1f6173f9694 to your computer and use it in GitHub Desktop.
Save psd/a5ea031579e77a1b6a92e1f6173f9694 to your computer and use it in GitHub Desktop.
Download GeoJSON from an ArcGIS API
#!/usr/bin/env python
import sys
import json
from esridump.dumper import EsriDumper
url = sys.argv[1]
dumper = EsriDumper(url, fields=None)
response = dumper._request("GET", url)
dumper.get_metadata()
print('{"type":"FeatureCollection","features":[', end="")
sep = "\n"
for feature in dumper:
print(sep, json.dumps(feature), sep="", end="")
sep = ",\n"
print("]}")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment