Created
July 4, 2019 13:13
-
-
Save evmcheb/72e002d5a2f270c57edd71498f48917f to your computer and use it in GitHub Desktop.
estimates suburbs to a square
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
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) |
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
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