34 lines
946 B
Python
Executable file
34 lines
946 B
Python
Executable file
#!/usr/bin/env nix-shell
|
|
#! nix-shell --quiet -p python3 -p python3Packages.requests -i python
|
|
|
|
import json
|
|
import sys
|
|
|
|
import requests
|
|
|
|
if len(sys.argv) != 2:
|
|
raise "Wrong number of args. Use: `get_plats.py out_file.json`"
|
|
|
|
URL = "https://maps-test.co.itasca.mn.us/ArcGIS/rest/services/WAB_Maps/PublicOperationLayers/MapServer/30/query"
|
|
|
|
params={
|
|
"f": "geojson",
|
|
"returnGeometry": "true",
|
|
"spatialRel": "esriSpatialRelIntersects",
|
|
"geometry": json.dumps({ # TODO: why do I need json.dumps here?
|
|
"xmin": -10397214.368951382,
|
|
"xmax": -10395465.871929357,
|
|
"ymin": 6021824.244624444,
|
|
"ymax": 6023792.498102792,
|
|
"spatialReference": {
|
|
"wkid": '102100'
|
|
},
|
|
}),
|
|
"geometryType": "esriGeometryEnvelope",
|
|
"inSR": "102100",
|
|
"outFields": "TAO_NAME",
|
|
"outSR": "EPSG:4326"
|
|
}
|
|
|
|
with open(sys.argv[1], 'w') as f:
|
|
f.write(requests.get(URL, params=params).text)
|