Created
April 2, 2016 08:07
-
-
Save jachym/69a7775f4adb37acf987df47e81de32c to your computer and use it in GitHub Desktop.
This file contains 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 python3 | |
import csv | |
import geocoder | |
import json | |
out = { | |
"type": "FeatureCollection", | |
"features": [] | |
} | |
with open('zaklady.csv') as zakladky: | |
reader = csv.reader(zakladky, delimiter=';') | |
for row in reader: | |
adresa = row[2] | |
psc = row[:7] | |
adresa = adresa.replace(psc, '') | |
adresa = row[2] + ", Brno" | |
g = geocoder.google(adresa) | |
out['features'].append({ | |
'type': 'Feature', | |
'geometry': g.geojson, | |
'properties': { | |
'cislo': row[0], | |
'nazev': row[1], | |
'adresa': row[2], | |
'psc': row[3], | |
'telefon': row[4], | |
'email': row[5], | |
'kontakt': row[6] | |
} | |
}) | |
with open('zakladky.geojson', 'w') as outfile: | |
outfile.write(json.dump(outfile, out)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment