Doku begonnen mit OSM Import
This commit is contained in:
1 parent
c65755d707
commit
664591f79f
7 files changed
+8652
-1
No files matched your search
Executable
+28
@@ -0,0 +1,28 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import csv
|
||||
|
||||
STREETS_CSV="Godesberg.csv"
|
||||
|
||||
#
|
||||
# wrap the CSV reader in a function that returns a generator (via the yield statement)
|
||||
#
|
||||
def read_osm_data(path):
|
||||
with open(path, 'r') as data:
|
||||
reader = csv.DictReader(data)
|
||||
for row in reader:
|
||||
yield row
|
||||
|
||||
if __name__ == "__main__":
|
||||
streets = {}
|
||||
for idx, row in enumerate(read_osm_data(STREETS_CSV)):
|
||||
if row['name'] != "":
|
||||
print("ID %(full_id)s : %(name)s = %(WKT)s" % row)
|
||||
# !!! TOO SIMPLE, more than 1 row !!!!
|
||||
#streets[row['full_id']] = {row['name']: row['WKT'][12:-1]}
|
||||
streets.setdefault(row['name'], [])
|
||||
streets[row['name']].append(row['WKT'][12:-1])
|
||||
|
||||
print(streets['Kennedyallee'])
|
||||
print(streets['Austraße'])
|
||||
|
||||
Reference in new issue
Block a user