lawrencedeerclub/scripts/get_plats.py

41 lines
1.3 KiB
Python
Raw Normal View History

2024-11-26 20:41:37 -06:00
#!/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",
# {"xmin":-10397214.368951382,"ymin":6023763.834217183,"xmax":-10397185.705065776,"ymax":6023792.498102792,"spatialReference":{"wkid":102100}}
# {"xmin":-10395523.199700572,"ymin":6021824.244624444,"xmax":-10395465.871929357,"ymax":6021881.572395659,"spatialReference":{"wkid":102100}}
"geometry": json.dumps({
# "xmin": -10397313.413735004,
# "ymin": 6024888.239059315,
# "xmax": -10395148.64317237,
# "ymax": 6021777.960551391,
"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)