Skip to content

Instantly share code, notes, and snippets.

@evmcheb
Created July 4, 2019 13:13
Show Gist options
  • Save evmcheb/72e002d5a2f270c57edd71498f48917f to your computer and use it in GitHub Desktop.
Save evmcheb/72e002d5a2f270c57edd71498f48917f to your computer and use it in GitHub Desktop.
estimates suburbs to a square
import json
with open('wa.json') as f:
data = json.load(f)
out = {}
for feature in data['features']:
out[feature["properties"]["wa_local_2"].lower()] = {}
out[feature["properties"]["wa_local_2"].lower()]["lat"] = [min([i[1] for i in feature["geometry"]["coordinates"][0][0]]), max([i[1] for i in feature["geometry"]["coordinates"][0][0]])]
out[feature["properties"]["wa_local_2"].lower()]["lon"] = [min([i[0] for i in feature["geometry"]["coordinates"][0][0]]), max([i[0] for i in feature["geometry"]["coordinates"][0][0]])]
a = open("suburbs.json", "w")
json.dump(out, a)
downloaded from here -> https://data.gov.au/dataset/ds-dga-6a0ec945-c880-4882-8a81-4dbcb85e74e5/details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment