data transform first approach
This commit is contained in:
1 parent
638102d095
commit
0ce24cabe1
8 files changed
+64131
-28
No files matched your search
Executable
+71
@@ -0,0 +1,71 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import pyproj
|
||||
import csv
|
||||
|
||||
source_crs = 'epsg:25832' # übriges Europa/Deutschland EPSG:25832 (ETRS89 / UTM zone 32N)
|
||||
# war früher mal 'epsg:31467' GK3
|
||||
target_crs = 'epsg:4326' # Global lat-lon coordinate system
|
||||
to_latlon = pyproj.Transformer.from_crs(source_crs, target_crs)
|
||||
## lat, lon = to_latlon.transform(369987.527702127, 5618360.96429005)
|
||||
|
||||
ortsteile = []
|
||||
all_ortsteile = ['Schwarzrheindorf / Vilich-Rheindorf', 'Lengsdorf', 'Mehlem',
|
||||
'Südstadt', 'Beuel-Mitte', 'Pennenfeld', 'Holzlar', 'Friesdorf',
|
||||
'Lannesdorf', 'Küdinghoven', 'Godesberg-Villenviertel', 'Gronau',
|
||||
'Schweinheim', 'Alt-Godesberg', 'Bonn-Zentrum', 'Bonn-Castell',
|
||||
'Endenich', 'Ippendorf', 'Dransdorf', 'Dottendorf', 'Nordstadt',
|
||||
'Röttgen', 'Duisdorf', 'Graurheindorf', 'Ramersdorf', 'Rüngsdorf',
|
||||
'Holtorf', 'Poppelsdorf', 'Geislar', 'Venusberg', 'Auerberg', 'Kessenich',
|
||||
'Buschdorf', 'Ückesdorf', 'Heiderhof', 'Tannenbusch', 'Oberkassel',
|
||||
'Vilich- Müldorf', 'Hoholz', 'Vilich', 'Muffendorf', 'Weststadt',
|
||||
'Plittersdorf', 'Lessenich/Meßdorf', 'Godesberg-Nord', 'Hochkreuz',
|
||||
'Pützchen/Bechlinghoven', 'Limperich', '', 'Beuel-Ost', 'Brüser Berg', 'Hardthöhe']
|
||||
godesberg = ['Mehlem', 'Pennenfeld', 'Friesdorf', 'Lannesdorf', 'Godesberg-Villenviertel',
|
||||
'Schweinheim', 'Alt-Godesberg', 'Rüngsdorf', 'Heiderhof', 'Muffendorf',
|
||||
'Plittersdorf', 'Godesberg-Nord', 'Hochkreuz', ]
|
||||
streets = []
|
||||
max_hnr = {}
|
||||
latN = {}
|
||||
latS = {}
|
||||
lonW = {}
|
||||
lonE = {}
|
||||
|
||||
with open('bonn-opendata/BonnHausnummern.csv', newline='') as csvfile:
|
||||
a_reader = csv.DictReader(csvfile, delimiter=';', quotechar='#')
|
||||
for row in a_reader:
|
||||
x = row['rechtswert_25832']
|
||||
y = row['hochwert_25832']
|
||||
lat, lon = to_latlon.transform(x, y)
|
||||
s = row['stassen_langname']
|
||||
if not s in streets:
|
||||
streets.append(s)
|
||||
hnr = int(row['hnr_ohne_zusatz'].split('-')[-1:][0])
|
||||
max_hnr[s] = hnr
|
||||
latN[s] = lat
|
||||
latS[s] = lat
|
||||
lonW[s] = lon
|
||||
lonE[s] = lon
|
||||
else:
|
||||
hnr = int(row['hnr_ohne_zusatz'].split('-')[-1:][0])
|
||||
if max_hnr[s] < hnr:
|
||||
max_hnr[s] = hnr
|
||||
if latN[s] < lat:
|
||||
latN[s] = lat
|
||||
if latS[s] > lat:
|
||||
latS[s] = lat
|
||||
if lonW[s] > lon:
|
||||
lonW[s] = lon
|
||||
if lonE[s] < lon:
|
||||
lonE[s] = lon
|
||||
if row['ortsteil_name'] in godesberg:
|
||||
print("%s: %s %d - %d %s (%f, %f)" %
|
||||
(row['ortsteil_name'], s, hnr,
|
||||
int(row['hnr_ohne_zusatz'].split('-')[-1:][0]),
|
||||
row['hnr_zusatz'],
|
||||
lat, lon)
|
||||
)
|
||||
for s in streets:
|
||||
print("%s: max=%d, (%f,%f) - (%f,%f)" %
|
||||
(s, max_hnr[s], latN[s], lonW[s], latS[s], lonE[s]))
|
||||
|
||||
Reference in new issue
Block a user