Created
June 11, 2024 06:21
-
-
Save psd/a5ea031579e77a1b6a92e1f6173f9694 to your computer and use it in GitHub Desktop.
Download GeoJSON from an ArcGIS API
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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