Suche nach Strassen und Hausnummern
This commit is contained in:
1 parent
a16f28b040
commit
518248ca00
12 files changed
+6346
-14
No files matched your search
@@ -11,7 +11,7 @@ from cmbnet.models.streets import StreetModel
|
|||||||
from cmbnet.services.groups_service import GroupsService
|
from cmbnet.services.groups_service import GroupsService
|
||||||
from cmbnet.services.history_service import HistoryService
|
from cmbnet.services.history_service import HistoryService
|
||||||
from cmbnet.utils.helpers import log_transaction
|
from cmbnet.utils.helpers import log_transaction
|
||||||
from cmbnet.utils.csv_utils import parse_streets_csv
|
from cmbnet.utils.csv_utils import parse_streets_csv, parse_house_numbers_csv
|
||||||
from cmbnet.ws import broker
|
from cmbnet.ws import broker
|
||||||
from cmbnet.ws.protocol import WSMessage
|
from cmbnet.ws.protocol import WSMessage
|
||||||
import json
|
import json
|
||||||
@@ -368,3 +368,51 @@ def import_streets(**kwargs):
|
|||||||
|
|
||||||
db.commit()
|
db.commit()
|
||||||
return jsonify({'success': True, 'count': count})
|
return jsonify({'success': True, 'count': count})
|
||||||
|
|
||||||
|
|
||||||
|
@admin_api_bp.route('/hausnummern/import', methods=['POST'])
|
||||||
|
@role_required('Administrator')
|
||||||
|
def import_house_numbers(**kwargs):
|
||||||
|
if 'file' not in request.files:
|
||||||
|
return jsonify({'error': 'Keine Datei'}), 400
|
||||||
|
file = request.files['file']
|
||||||
|
if file.filename == '':
|
||||||
|
return jsonify({'error': 'Keine Datei ausgewählt'}), 400
|
||||||
|
|
||||||
|
content = file.read()
|
||||||
|
if len(content) > 5_000_000:
|
||||||
|
return jsonify({'error': 'Datei zu groß'}), 400
|
||||||
|
|
||||||
|
house_numbers = parse_house_numbers_csv(content)
|
||||||
|
if not house_numbers:
|
||||||
|
return jsonify({
|
||||||
|
'error': 'Keine gültigen Hausnummern in der CSV gefunden. '
|
||||||
|
'Erwartete Spalten: Straßenname;Hausnummer;Longitude;Latitude'
|
||||||
|
}), 400
|
||||||
|
|
||||||
|
db = get_db()
|
||||||
|
for entry in house_numbers:
|
||||||
|
db.execute(
|
||||||
|
'''INSERT INTO street_house_numbers
|
||||||
|
(tenant_id, street_name, house_number, longitude, latitude)
|
||||||
|
VALUES (?, ?, ?, ?, ?)
|
||||||
|
ON CONFLICT(tenant_id, street_name, house_number)
|
||||||
|
DO UPDATE SET longitude = excluded.longitude,
|
||||||
|
latitude = excluded.latitude''',
|
||||||
|
(
|
||||||
|
g.tenant_id,
|
||||||
|
entry['street_name'],
|
||||||
|
entry['house_number'],
|
||||||
|
entry['longitude'],
|
||||||
|
entry['latitude']
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
db.commit()
|
||||||
|
log_transaction(
|
||||||
|
'house_number.import',
|
||||||
|
'street_house_number',
|
||||||
|
None,
|
||||||
|
{'count': len(house_numbers)}
|
||||||
|
)
|
||||||
|
return jsonify({'success': True, 'count': len(house_numbers)})
|
||||||
@@ -21,4 +21,13 @@ def strassen(**kwargs):
|
|||||||
'SELECT * FROM groups WHERE tenant_id = ? ORDER BY id',
|
'SELECT * FROM groups WHERE tenant_id = ? ORDER BY id',
|
||||||
(g.tenant_id,)
|
(g.tenant_id,)
|
||||||
).fetchall()
|
).fetchall()
|
||||||
return render_template('admin/strassen.html', strassen=strassen, gruppen=gruppen)
|
house_number_count = db.execute(
|
||||||
|
'SELECT COUNT(*) FROM street_house_numbers WHERE tenant_id = ?',
|
||||||
|
(g.tenant_id,)
|
||||||
|
).fetchone()[0]
|
||||||
|
return render_template(
|
||||||
|
'admin/strassen.html',
|
||||||
|
strassen=strassen,
|
||||||
|
gruppen=gruppen,
|
||||||
|
house_number_count=house_number_count
|
||||||
|
)
|
||||||
@@ -1,8 +1,9 @@
|
|||||||
"""
|
"""
|
||||||
API Endpunkte für Initialdaten
|
API Endpunkte für Initialdaten
|
||||||
"""
|
"""
|
||||||
from flask import Blueprint, jsonify, g
|
from flask import Blueprint, jsonify, g, request
|
||||||
from cmbnet.auth import login_required
|
from cmbnet.auth import login_required
|
||||||
|
from cmbnet.db import get_db
|
||||||
from cmbnet.services.streets_service import StreetsService
|
from cmbnet.services.streets_service import StreetsService
|
||||||
from cmbnet.services.groups_service import GroupsService
|
from cmbnet.services.groups_service import GroupsService
|
||||||
|
|
||||||
@@ -24,3 +25,37 @@ def init_groups(**kwargs):
|
|||||||
groups_dict = GroupsService.get_all(g.tenant_id)
|
groups_dict = GroupsService.get_all(g.tenant_id)
|
||||||
groups_list = list(groups_dict.values())
|
groups_list = list(groups_dict.values())
|
||||||
return jsonify(groups_list)
|
return jsonify(groups_list)
|
||||||
|
|
||||||
|
|
||||||
|
@api_init_bp.route('/init/hausnummern')
|
||||||
|
@login_required
|
||||||
|
def init_house_number(**kwargs):
|
||||||
|
"""Liefert die Koordinate einer Hausnummer aus der importierten Tabelle."""
|
||||||
|
street_name = (request.args.get('street') or '').strip()
|
||||||
|
house_number = (
|
||||||
|
request.args.get('house_number')
|
||||||
|
or request.args.get('number')
|
||||||
|
or ''
|
||||||
|
).strip()
|
||||||
|
|
||||||
|
if not street_name or not house_number:
|
||||||
|
return jsonify({'found': False})
|
||||||
|
|
||||||
|
row = get_db().execute(
|
||||||
|
'''SELECT street_name, house_number, longitude, latitude
|
||||||
|
FROM street_house_numbers
|
||||||
|
WHERE tenant_id = ? AND street_name = ? AND house_number = ?
|
||||||
|
LIMIT 1''',
|
||||||
|
(g.tenant_id, street_name, house_number)
|
||||||
|
).fetchone()
|
||||||
|
|
||||||
|
if not row:
|
||||||
|
return jsonify({'found': False})
|
||||||
|
|
||||||
|
return jsonify({
|
||||||
|
'found': True,
|
||||||
|
'street_name': row['street_name'],
|
||||||
|
'house_number': row['house_number'],
|
||||||
|
'longitude': row['longitude'],
|
||||||
|
'latitude': row['latitude']
|
||||||
|
})
|
||||||
@@ -13,6 +13,85 @@ def _normalize_header(name):
|
|||||||
return name.strip().lstrip('\ufeff').lstrip('#').strip()
|
return name.strip().lstrip('\ufeff').lstrip('#').strip()
|
||||||
|
|
||||||
|
|
||||||
|
def _decode_csv(file_content):
|
||||||
|
"""Dekodiert CSV-Inhalte tolerant gegenüber gängigen Kodierungen."""
|
||||||
|
try:
|
||||||
|
return file_content.decode('utf-8-sig')
|
||||||
|
except UnicodeDecodeError:
|
||||||
|
try:
|
||||||
|
return file_content.decode('latin-1')
|
||||||
|
except UnicodeDecodeError:
|
||||||
|
return file_content.decode('cp1252')
|
||||||
|
|
||||||
|
|
||||||
|
def _parse_coordinate(value, minimum, maximum):
|
||||||
|
"""Wandelt eine Koordinate in eine Zahl um und prüft den Wertebereich."""
|
||||||
|
if value is None:
|
||||||
|
return None
|
||||||
|
|
||||||
|
text = str(value).strip()
|
||||||
|
if not text:
|
||||||
|
return None
|
||||||
|
|
||||||
|
# Deutsche CSV-Dateien verwenden häufig das Komma als Dezimaltrennzeichen.
|
||||||
|
if ',' in text and '.' not in text:
|
||||||
|
text = text.replace(',', '.')
|
||||||
|
|
||||||
|
try:
|
||||||
|
number = float(text)
|
||||||
|
except (TypeError, ValueError):
|
||||||
|
return None
|
||||||
|
|
||||||
|
if not (minimum <= number <= maximum):
|
||||||
|
return None
|
||||||
|
return number
|
||||||
|
|
||||||
|
|
||||||
|
def parse_house_numbers_csv(file_content):
|
||||||
|
"""
|
||||||
|
Parst den Hausnummern-Import mit Delimiter ';'.
|
||||||
|
Erwartete Spalten: Straßenname, Hausnummer, Longitude, Latitude
|
||||||
|
"""
|
||||||
|
text = _decode_csv(file_content)
|
||||||
|
reader = csv.DictReader(io.StringIO(text), delimiter=';')
|
||||||
|
if reader.fieldnames:
|
||||||
|
reader.fieldnames = [_normalize_header(name) for name in reader.fieldnames]
|
||||||
|
|
||||||
|
street_aliases = {'straßenname', 'strassenname', 'straße', 'strasse', 'street', 'street_name', 'name'}
|
||||||
|
number_aliases = {'hausnummer', 'hn', 'house_number', 'number', 'nr'}
|
||||||
|
longitude_aliases = {'longitude', 'lon', 'lng', 'long', 'längengrad', 'laengengrad'}
|
||||||
|
latitude_aliases = {'latitude', 'lat', 'breitengrad'}
|
||||||
|
|
||||||
|
def row_value(row, aliases):
|
||||||
|
for key, value in row.items():
|
||||||
|
if key and _normalize_header(key).casefold() in aliases:
|
||||||
|
return value
|
||||||
|
return None
|
||||||
|
|
||||||
|
house_numbers = []
|
||||||
|
for row in reader:
|
||||||
|
street_name = row_value(row, street_aliases)
|
||||||
|
house_number = row_value(row, number_aliases)
|
||||||
|
longitude = _parse_coordinate(row_value(row, longitude_aliases), -180, 180)
|
||||||
|
latitude = _parse_coordinate(row_value(row, latitude_aliases), -90, 90)
|
||||||
|
|
||||||
|
if not street_name or not str(street_name).strip():
|
||||||
|
continue
|
||||||
|
if not house_number or not str(house_number).strip():
|
||||||
|
continue
|
||||||
|
if longitude is None or latitude is None:
|
||||||
|
continue
|
||||||
|
|
||||||
|
house_numbers.append({
|
||||||
|
'street_name': str(street_name).strip(),
|
||||||
|
'house_number': str(house_number).strip(),
|
||||||
|
'longitude': longitude,
|
||||||
|
'latitude': latitude
|
||||||
|
})
|
||||||
|
|
||||||
|
return house_numbers
|
||||||
|
|
||||||
|
|
||||||
def parse_streets_csv(file_content):
|
def parse_streets_csv(file_content):
|
||||||
"""
|
"""
|
||||||
Parst CSV mit Delimiter ';'
|
Parst CSV mit Delimiter ';'
|
||||||
|
|||||||
@@ -54,6 +54,19 @@ CREATE TABLE IF NOT EXISTS streets (
|
|||||||
FOREIGN KEY (group_id) REFERENCES groups(id)
|
FOREIGN KEY (group_id) REFERENCES groups(id)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
-- Hausnummern-Koordinaten (Import aus Straßenverwaltung)
|
||||||
|
CREATE TABLE IF NOT EXISTS street_house_numbers (
|
||||||
|
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||||
|
tenant_id INTEGER NOT NULL,
|
||||||
|
street_name TEXT NOT NULL COLLATE NOCASE,
|
||||||
|
house_number TEXT NOT NULL COLLATE NOCASE,
|
||||||
|
longitude REAL NOT NULL,
|
||||||
|
latitude REAL NOT NULL,
|
||||||
|
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||||
|
FOREIGN KEY (tenant_id) REFERENCES tenants(id),
|
||||||
|
UNIQUE(tenant_id, street_name, house_number)
|
||||||
|
);
|
||||||
|
|
||||||
-- Historie Straßen
|
-- Historie Straßen
|
||||||
CREATE TABLE IF NOT EXISTS street_state_history (
|
CREATE TABLE IF NOT EXISTS street_state_history (
|
||||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||||
@@ -133,5 +146,7 @@ CREATE TABLE IF NOT EXISTS transaction_log (
|
|||||||
CREATE INDEX IF NOT EXISTS idx_accounts_tenant ON accounts(tenant_id);
|
CREATE INDEX IF NOT EXISTS idx_accounts_tenant ON accounts(tenant_id);
|
||||||
CREATE INDEX IF NOT EXISTS idx_groups_tenant ON groups(tenant_id);
|
CREATE INDEX IF NOT EXISTS idx_groups_tenant ON groups(tenant_id);
|
||||||
CREATE INDEX IF NOT EXISTS idx_streets_tenant ON streets(tenant_id);
|
CREATE INDEX IF NOT EXISTS idx_streets_tenant ON streets(tenant_id);
|
||||||
|
CREATE INDEX IF NOT EXISTS idx_street_house_numbers_lookup
|
||||||
|
ON street_house_numbers(tenant_id, street_name, house_number);
|
||||||
CREATE INDEX IF NOT EXISTS idx_ws_tokens_token ON ws_tokens(token);
|
CREATE INDEX IF NOT EXISTS idx_ws_tokens_token ON ws_tokens(token);
|
||||||
CREATE INDEX IF NOT EXISTS idx_ws_messages_ts ON ws_messages_store(ts);
|
CREATE INDEX IF NOT EXISTS idx_ws_messages_ts ON ws_messages_store(ts);
|
||||||
@@ -91,7 +91,7 @@ body.dispatcher-page main.container {
|
|||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
gap: 0.75rem;
|
gap: 0.5rem;
|
||||||
margin-bottom: 0.55rem;
|
margin-bottom: 0.55rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -100,6 +100,12 @@ body.dispatcher-page main.container {
|
|||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
gap: 0.05rem;
|
gap: 0.05rem;
|
||||||
min-width: 0;
|
min-width: 0;
|
||||||
|
flex: 1 1 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.clock-row > #speakerButton {
|
||||||
|
flex: 0 0 auto;
|
||||||
|
margin: 0 0.25rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.clock-date {
|
.clock-date {
|
||||||
@@ -134,16 +140,75 @@ body.dispatcher-page main.container {
|
|||||||
flex: 0 0 auto;
|
flex: 0 0 auto;
|
||||||
width: auto;
|
width: auto;
|
||||||
height: 3rem;
|
height: 3rem;
|
||||||
|
margin-left: 0.25rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.header-controls {
|
/* ---------- Straßensuche ---------- */
|
||||||
display: flex;
|
|
||||||
align-items: flex-end;
|
.street-search {
|
||||||
gap: 0.5rem;
|
position: relative;
|
||||||
}
|
}
|
||||||
|
|
||||||
.header-controls > .icon-button {
|
.street-search input[type="search"] {
|
||||||
margin-left: auto;
|
width: 100%;
|
||||||
|
height: 2.35rem;
|
||||||
|
margin: 0;
|
||||||
|
padding: 0.25rem 2rem 0.25rem 2.4rem;
|
||||||
|
font-size: 0.8rem;
|
||||||
|
text-indent: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.street-search-results {
|
||||||
|
position: absolute;
|
||||||
|
z-index: 60;
|
||||||
|
top: calc(100% + 0.25rem);
|
||||||
|
right: 0;
|
||||||
|
left: 0;
|
||||||
|
max-height: 14rem;
|
||||||
|
margin: 0;
|
||||||
|
padding: 0.25rem;
|
||||||
|
overflow-y: auto;
|
||||||
|
overscroll-behavior: contain;
|
||||||
|
list-style: none;
|
||||||
|
border: 1px solid var(--dispatcher-border-strong);
|
||||||
|
border-radius: 0.5rem;
|
||||||
|
background: var(--card-background-color, #fff);
|
||||||
|
box-shadow: 0 12px 32px rgba(0, 0, 0, 0.24);
|
||||||
|
}
|
||||||
|
|
||||||
|
.street-search-results[hidden] {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.street-search-option {
|
||||||
|
margin: 0;
|
||||||
|
padding: 0.42rem 0.55rem;
|
||||||
|
border-radius: 0.35rem;
|
||||||
|
font-size: 0.8rem;
|
||||||
|
line-height: 1.25;
|
||||||
|
white-space: nowrap;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.street-search-option:hover,
|
||||||
|
.street-search-option.is-active {
|
||||||
|
background: var(--dispatcher-subtle-bg-hover);
|
||||||
|
}
|
||||||
|
|
||||||
|
.street-search-status {
|
||||||
|
margin-top: 0.3rem;
|
||||||
|
font-size: 0.7rem;
|
||||||
|
color: var(--muted-color, #5b6771);
|
||||||
|
}
|
||||||
|
|
||||||
|
.street-search-status:empty {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.street-search-status.error {
|
||||||
|
color: #b42318;
|
||||||
}
|
}
|
||||||
|
|
||||||
.map-layer-label {
|
.map-layer-label {
|
||||||
@@ -657,6 +722,42 @@ dialog.group-streets-dialog.is-dragging article header {
|
|||||||
box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.38), 0 1px 3px rgba(0, 0, 0, 0.4);
|
box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.38), 0 1px 3px rgba(0, 0, 0, 0.4);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Markierungsfahne für gesuchte Hausnummern */
|
||||||
|
.house-number-marker-icon {
|
||||||
|
padding: 0;
|
||||||
|
border: 0;
|
||||||
|
background: transparent;
|
||||||
|
line-height: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.house-number-flag {
|
||||||
|
position: relative;
|
||||||
|
display: inline-block;
|
||||||
|
max-width: 12rem;
|
||||||
|
padding: 0.22rem 0.5rem 0.22rem 0.55rem;
|
||||||
|
overflow: hidden;
|
||||||
|
border-radius: 0.15rem 0.35rem 0.35rem 0.15rem;
|
||||||
|
background: #c62828;
|
||||||
|
color: #fff;
|
||||||
|
font-size: 0.68rem;
|
||||||
|
font-weight: 700;
|
||||||
|
line-height: 1.25;
|
||||||
|
white-space: nowrap;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
box-shadow: 0 2px 6px rgba(0, 0, 0, 0.42);
|
||||||
|
}
|
||||||
|
|
||||||
|
.house-number-flag::before {
|
||||||
|
content: "";
|
||||||
|
position: absolute;
|
||||||
|
top: 100%;
|
||||||
|
left: 0;
|
||||||
|
width: 2px;
|
||||||
|
height: 0.7rem;
|
||||||
|
background: #343a40;
|
||||||
|
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
|
||||||
|
}
|
||||||
|
|
||||||
@media (max-width: 900px) {
|
@media (max-width: 900px) {
|
||||||
.dispatcher-layout {
|
.dispatcher-layout {
|
||||||
grid-template-columns: 1fr;
|
grid-template-columns: 1fr;
|
||||||
@@ -690,6 +791,11 @@ dialog.group-streets-dialog.is-dragging article header {
|
|||||||
height: 2.25rem;
|
height: 2.25rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.clock-row > #speakerButton {
|
||||||
|
width: 2.25rem;
|
||||||
|
height: 2.25rem;
|
||||||
|
}
|
||||||
|
|
||||||
.clock-time {
|
.clock-time {
|
||||||
font-size: 1.55rem;
|
font-size: 1.55rem;
|
||||||
}
|
}
|
||||||
@@ -728,6 +834,10 @@ html[data-theme="dark"] .connection-status.disconnected {
|
|||||||
color: #ff8b8b;
|
color: #ff8b8b;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
html[data-theme="dark"] .street-search-status.error {
|
||||||
|
color: #ff8b8b;
|
||||||
|
}
|
||||||
|
|
||||||
html[data-theme="dark"] .leaflet-container {
|
html[data-theme="dark"] .leaflet-container {
|
||||||
background: var(--dispatcher-map-bg);
|
background: var(--dispatcher-map-bg);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -114,6 +114,26 @@ function importCSV(input) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function importHouseNumbers(input) {
|
||||||
|
const file = input.files[0];
|
||||||
|
if (!file) return;
|
||||||
|
const formData = new FormData();
|
||||||
|
formData.append('file', file);
|
||||||
|
fetch(`${apiBase}/hausnummern/import`, {
|
||||||
|
method: 'POST',
|
||||||
|
body: formData
|
||||||
|
}).then(r => r.json()).then(data => {
|
||||||
|
if (data.success) {
|
||||||
|
alert(`${data.count} Hausnummern importiert`);
|
||||||
|
location.reload();
|
||||||
|
} else {
|
||||||
|
alert(data.error);
|
||||||
|
}
|
||||||
|
}).finally(() => {
|
||||||
|
input.value = '';
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
function showStreetHistory(streetId) {
|
function showStreetHistory(streetId) {
|
||||||
currentStreetId = streetId;
|
currentStreetId = streetId;
|
||||||
fetch(`${apiBase}/strassen/${streetId}/history`)
|
fetch(`${apiBase}/strassen/${streetId}/history`)
|
||||||
|
|||||||
@@ -50,6 +50,10 @@ const dispatcherState = {
|
|||||||
chatGroupId: null,
|
chatGroupId: null,
|
||||||
chatByGroup: new Map(),
|
chatByGroup: new Map(),
|
||||||
chatKeysByGroup: new Map(),
|
chatKeysByGroup: new Map(),
|
||||||
|
streetSearchResults: [],
|
||||||
|
streetSearchActiveIndex: -1,
|
||||||
|
streetSearchRequestId: 0,
|
||||||
|
houseNumberMarker: null,
|
||||||
unloading: false
|
unloading: false
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -1021,7 +1025,10 @@ function handleMapClick(event) {
|
|||||||
actor: currentAccountId
|
actor: currentAccountId
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
if (!sent) return;
|
if (!sent) {
|
||||||
|
cancelCrosshair();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
group.last_lat = lat;
|
group.last_lat = lat;
|
||||||
group.last_lon = lon;
|
group.last_lon = lon;
|
||||||
@@ -1030,6 +1037,7 @@ function handleMapClick(event) {
|
|||||||
|
|
||||||
updateMarkerPosition(group);
|
updateMarkerPosition(group);
|
||||||
refreshGroupControls();
|
refreshGroupControls();
|
||||||
|
cancelCrosshair();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ------------------------------------------------------------------ */
|
/* ------------------------------------------------------------------ */
|
||||||
@@ -1232,6 +1240,361 @@ function zoomToStreet(streetId) {
|
|||||||
map.fitBounds(bounds, {padding: [30, 30], maxZoom: 18});
|
map.fitBounds(bounds, {padding: [30, 30], maxZoom: 18});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* ------------------------------------------------------------------ */
|
||||||
|
/* Straßensuche und Hausnummern */
|
||||||
|
/* ------------------------------------------------------------------ */
|
||||||
|
|
||||||
|
const STREET_SEARCH_MIN_CHARS = 2;
|
||||||
|
const STREET_SEARCH_MAX_RESULTS = 8;
|
||||||
|
|
||||||
|
function normalizeStreetSearchText(value) {
|
||||||
|
return String(value || '')
|
||||||
|
.trim()
|
||||||
|
.toLocaleLowerCase('de-DE')
|
||||||
|
.replace(/ß/g, 'ss')
|
||||||
|
.normalize('NFD')
|
||||||
|
.replace(/[\u0300-\u036f]/g, '')
|
||||||
|
.replace(/\s+/g, ' ');
|
||||||
|
}
|
||||||
|
|
||||||
|
function findStreetBySearchName(value) {
|
||||||
|
const normalized = normalizeStreetSearchText(value);
|
||||||
|
if (!normalized) return null;
|
||||||
|
|
||||||
|
return dispatcherState.streets.find(street => (
|
||||||
|
normalizeStreetSearchText(street.name) === normalized
|
||||||
|
)) || null;
|
||||||
|
}
|
||||||
|
|
||||||
|
function splitStreetAndHouseNumber(value) {
|
||||||
|
const text = String(value || '').trim();
|
||||||
|
const match = text.match(/^(.*\S)\s+([0-9][0-9A-Za-zÄÖÜäöüß.\/-]*)$/u);
|
||||||
|
if (!match) return {streetText: text, houseNumber: null};
|
||||||
|
|
||||||
|
return {
|
||||||
|
streetText: match[1].trim(),
|
||||||
|
houseNumber: match[2]
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
function parseStreetSearch(value) {
|
||||||
|
const text = String(value || '').trim();
|
||||||
|
if (!text) {
|
||||||
|
return {text: '', streetText: '', houseNumber: null, street: null};
|
||||||
|
}
|
||||||
|
|
||||||
|
// Ein vollständiger Straßenname hat Vorrang, auch wenn er auf eine Zahl endet.
|
||||||
|
const exactStreet = findStreetBySearchName(text);
|
||||||
|
if (exactStreet) {
|
||||||
|
return {
|
||||||
|
text,
|
||||||
|
streetText: exactStreet.name,
|
||||||
|
houseNumber: null,
|
||||||
|
street: exactStreet
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
const split = splitStreetAndHouseNumber(text);
|
||||||
|
if (split.houseNumber) {
|
||||||
|
const street = findStreetBySearchName(split.streetText);
|
||||||
|
return {
|
||||||
|
text,
|
||||||
|
streetText: street ? street.name : split.streetText,
|
||||||
|
houseNumber: split.houseNumber,
|
||||||
|
street
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
return {text, streetText: text, houseNumber: null, street: null};
|
||||||
|
}
|
||||||
|
|
||||||
|
function getStreetSearchResults(streetText) {
|
||||||
|
const normalized = normalizeStreetSearchText(streetText);
|
||||||
|
if (normalized.length < STREET_SEARCH_MIN_CHARS) return [];
|
||||||
|
|
||||||
|
return dispatcherState.streets
|
||||||
|
.filter(street => normalizeStreetSearchText(street.name).startsWith(normalized))
|
||||||
|
.sort((a, b) => String(a.name).localeCompare(String(b.name), 'de'))
|
||||||
|
.slice(0, STREET_SEARCH_MAX_RESULTS);
|
||||||
|
}
|
||||||
|
|
||||||
|
function setStreetSearchStatus(text, isError = false) {
|
||||||
|
const element = document.getElementById('streetSearchStatus');
|
||||||
|
if (!element) return;
|
||||||
|
|
||||||
|
element.textContent = text || '';
|
||||||
|
element.classList.toggle('error', Boolean(text) && isError);
|
||||||
|
}
|
||||||
|
|
||||||
|
function closeStreetSearchResults() {
|
||||||
|
const list = document.getElementById('streetSearchResults');
|
||||||
|
const input = document.getElementById('streetSearchInput');
|
||||||
|
|
||||||
|
if (list) {
|
||||||
|
list.hidden = true;
|
||||||
|
list.innerHTML = '';
|
||||||
|
}
|
||||||
|
if (input) {
|
||||||
|
input.setAttribute('aria-expanded', 'false');
|
||||||
|
input.removeAttribute('aria-activedescendant');
|
||||||
|
}
|
||||||
|
|
||||||
|
dispatcherState.streetSearchResults = [];
|
||||||
|
dispatcherState.streetSearchActiveIndex = -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
function setActiveStreetSearchIndex(index) {
|
||||||
|
const list = document.getElementById('streetSearchResults');
|
||||||
|
const input = document.getElementById('streetSearchInput');
|
||||||
|
const results = dispatcherState.streetSearchResults;
|
||||||
|
if (!list || !input || !results.length) return;
|
||||||
|
|
||||||
|
const normalizedIndex = ((index % results.length) + results.length) % results.length;
|
||||||
|
dispatcherState.streetSearchActiveIndex = normalizedIndex;
|
||||||
|
|
||||||
|
list.querySelectorAll('.street-search-option').forEach((option, optionIndex) => {
|
||||||
|
const active = optionIndex === normalizedIndex;
|
||||||
|
option.classList.toggle('is-active', active);
|
||||||
|
option.setAttribute('aria-selected', active ? 'true' : 'false');
|
||||||
|
});
|
||||||
|
|
||||||
|
const activeOption = list.querySelector(
|
||||||
|
`.street-search-option[data-index="${normalizedIndex}"]`
|
||||||
|
);
|
||||||
|
if (activeOption) {
|
||||||
|
input.setAttribute('aria-activedescendant', activeOption.id);
|
||||||
|
activeOption.scrollIntoView?.({block: 'nearest'});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function renderStreetSearchResults(results) {
|
||||||
|
const list = document.getElementById('streetSearchResults');
|
||||||
|
const input = document.getElementById('streetSearchInput');
|
||||||
|
if (!list || !input) return;
|
||||||
|
|
||||||
|
if (!results.length) {
|
||||||
|
closeStreetSearchResults();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
dispatcherState.streetSearchResults = results;
|
||||||
|
dispatcherState.streetSearchActiveIndex = -1;
|
||||||
|
list.innerHTML = '';
|
||||||
|
|
||||||
|
results.forEach((street, index) => {
|
||||||
|
const option = document.createElement('li');
|
||||||
|
option.id = `streetSearchOption${index}`;
|
||||||
|
option.className = 'street-search-option';
|
||||||
|
option.dataset.index = String(index);
|
||||||
|
option.setAttribute('role', 'option');
|
||||||
|
option.setAttribute('aria-selected', 'false');
|
||||||
|
option.textContent = street.name;
|
||||||
|
|
||||||
|
// Fokus im Eingabefeld halten, damit der Klick nicht vom blur-
|
||||||
|
// Handler verschluckt wird.
|
||||||
|
option.addEventListener('mousedown', event => event.preventDefault());
|
||||||
|
option.addEventListener('mouseenter', () => setActiveStreetSearchIndex(index));
|
||||||
|
option.addEventListener('click', () => selectStreetSearchResult(street));
|
||||||
|
|
||||||
|
list.appendChild(option);
|
||||||
|
});
|
||||||
|
|
||||||
|
list.hidden = false;
|
||||||
|
input.setAttribute('aria-expanded', 'true');
|
||||||
|
setActiveStreetSearchIndex(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
function updateStreetSearchSuggestions() {
|
||||||
|
const input = document.getElementById('streetSearchInput');
|
||||||
|
if (!input) return;
|
||||||
|
|
||||||
|
const parsed = parseStreetSearch(input.value);
|
||||||
|
if (parsed.streetText.length < STREET_SEARCH_MIN_CHARS) {
|
||||||
|
closeStreetSearchResults();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const results = parsed.street
|
||||||
|
? [parsed.street]
|
||||||
|
: getStreetSearchResults(parsed.streetText);
|
||||||
|
renderStreetSearchResults(results);
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleStreetSearchInput() {
|
||||||
|
setStreetSearchStatus('');
|
||||||
|
updateStreetSearchSuggestions();
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleStreetSearchKeydown(event) {
|
||||||
|
if (event.key === 'ArrowDown' || event.key === 'ArrowUp') {
|
||||||
|
if (!dispatcherState.streetSearchResults.length) {
|
||||||
|
updateStreetSearchSuggestions();
|
||||||
|
}
|
||||||
|
if (!dispatcherState.streetSearchResults.length) return;
|
||||||
|
|
||||||
|
event.preventDefault();
|
||||||
|
const direction = event.key === 'ArrowDown' ? 1 : -1;
|
||||||
|
setActiveStreetSearchIndex(
|
||||||
|
dispatcherState.streetSearchActiveIndex + direction
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (event.key === 'Escape') {
|
||||||
|
closeStreetSearchResults();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (event.key !== 'Enter') return;
|
||||||
|
event.preventDefault();
|
||||||
|
|
||||||
|
const input = document.getElementById('streetSearchInput');
|
||||||
|
const parsed = parseStreetSearch(input.value);
|
||||||
|
|
||||||
|
if (dispatcherState.streetSearchResults.length
|
||||||
|
&& dispatcherState.streetSearchActiveIndex >= 0) {
|
||||||
|
selectStreetSearchResult(
|
||||||
|
dispatcherState.streetSearchResults[
|
||||||
|
dispatcherState.streetSearchActiveIndex
|
||||||
|
]
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (parsed.street) {
|
||||||
|
performStreetSearch(input.value, parsed.street);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const results = getStreetSearchResults(parsed.streetText);
|
||||||
|
if (results.length) {
|
||||||
|
selectStreetSearchResult(results[0]);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
closeStreetSearchResults();
|
||||||
|
setStreetSearchStatus('Keine Straße gefunden.', true);
|
||||||
|
}
|
||||||
|
|
||||||
|
function selectStreetSearchResult(street) {
|
||||||
|
const input = document.getElementById('streetSearchInput');
|
||||||
|
const parsed = parseStreetSearch(input.value);
|
||||||
|
const houseNumber = parsed.houseNumber;
|
||||||
|
|
||||||
|
input.value = houseNumber ? `${street.name} ${houseNumber}` : street.name;
|
||||||
|
closeStreetSearchResults();
|
||||||
|
performStreetSearch(input.value, street);
|
||||||
|
}
|
||||||
|
|
||||||
|
async function performStreetSearch(value, selectedStreet = null) {
|
||||||
|
const input = document.getElementById('streetSearchInput');
|
||||||
|
const text = String(value ?? input.value ?? '').trim();
|
||||||
|
const parsed = parseStreetSearch(text);
|
||||||
|
|
||||||
|
let street = selectedStreet || parsed.street;
|
||||||
|
if (!street) {
|
||||||
|
const results = getStreetSearchResults(parsed.streetText);
|
||||||
|
street = results[0] || null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!street) {
|
||||||
|
closeStreetSearchResults();
|
||||||
|
setStreetSearchStatus('Keine Straße gefunden.', true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const houseNumber = parsed.houseNumber;
|
||||||
|
const requestId = ++dispatcherState.streetSearchRequestId;
|
||||||
|
|
||||||
|
clearHouseNumberMarker();
|
||||||
|
closeStreetSearchResults();
|
||||||
|
setStreetSearchStatus('');
|
||||||
|
input.value = houseNumber ? `${street.name} ${houseNumber}` : street.name;
|
||||||
|
zoomToStreet(street.id);
|
||||||
|
|
||||||
|
if (!houseNumber) return;
|
||||||
|
|
||||||
|
setStreetSearchStatus(`Hausnummer ${houseNumber} wird gesucht …`);
|
||||||
|
|
||||||
|
try {
|
||||||
|
const params = new URLSearchParams({
|
||||||
|
street: street.name,
|
||||||
|
house_number: houseNumber
|
||||||
|
});
|
||||||
|
const data = await fetchJson(`${apiBase}/init/hausnummern?${params.toString()}`);
|
||||||
|
if (requestId !== dispatcherState.streetSearchRequestId) return;
|
||||||
|
|
||||||
|
const latitude = Number(data.latitude);
|
||||||
|
const longitude = Number(data.longitude);
|
||||||
|
if (!data.found || !Number.isFinite(latitude) || !Number.isFinite(longitude)) {
|
||||||
|
setStreetSearchStatus(
|
||||||
|
`Für Hausnummer ${houseNumber} ist keine Koordinate hinterlegt.`
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
setHouseNumberMarker(
|
||||||
|
[latitude, longitude],
|
||||||
|
`${street.name} ${houseNumber}`
|
||||||
|
);
|
||||||
|
setStreetSearchStatus(`Hausnummer ${houseNumber} markiert.`);
|
||||||
|
} catch (error) {
|
||||||
|
if (requestId !== dispatcherState.streetSearchRequestId) return;
|
||||||
|
console.error('Hausnummer konnte nicht geladen werden:', error);
|
||||||
|
setStreetSearchStatus('Hausnummer konnte nicht geladen werden.', true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function clearHouseNumberMarker() {
|
||||||
|
if (!dispatcherState.houseNumberMarker) return;
|
||||||
|
|
||||||
|
map.removeLayer(dispatcherState.houseNumberMarker);
|
||||||
|
dispatcherState.houseNumberMarker = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
function setHouseNumberMarker(latlng, label) {
|
||||||
|
clearHouseNumberMarker();
|
||||||
|
|
||||||
|
const marker = L.marker(latlng, {
|
||||||
|
title: label,
|
||||||
|
keyboard: true,
|
||||||
|
icon: L.divIcon({
|
||||||
|
className: 'house-number-marker-icon',
|
||||||
|
html: '<span class="house-number-flag"><span class="house-number-flag-label"></span></span>',
|
||||||
|
iconSize: null,
|
||||||
|
iconAnchor: [0, 34]
|
||||||
|
})
|
||||||
|
});
|
||||||
|
|
||||||
|
marker.addTo(map);
|
||||||
|
|
||||||
|
const labelElement = marker.getElement()?.querySelector('.house-number-flag-label');
|
||||||
|
if (labelElement) labelElement.textContent = label;
|
||||||
|
|
||||||
|
marker.bindTooltip(tooltipElement(label), {direction: 'top', offset: [0, -8]});
|
||||||
|
marker.on('click', event => {
|
||||||
|
if (event.originalEvent) L.DomEvent.stopPropagation(event.originalEvent);
|
||||||
|
clearHouseNumberMarker();
|
||||||
|
setStreetSearchStatus('Markierung entfernt.');
|
||||||
|
});
|
||||||
|
|
||||||
|
dispatcherState.houseNumberMarker = marker;
|
||||||
|
}
|
||||||
|
|
||||||
|
function initStreetSearch() {
|
||||||
|
const input = document.getElementById('streetSearchInput');
|
||||||
|
if (!input) return;
|
||||||
|
|
||||||
|
input.addEventListener('input', handleStreetSearchInput);
|
||||||
|
input.addEventListener('keydown', handleStreetSearchKeydown);
|
||||||
|
input.addEventListener('focus', () => {
|
||||||
|
if (input.value.trim()) updateStreetSearchSuggestions();
|
||||||
|
});
|
||||||
|
input.addEventListener('blur', () => {
|
||||||
|
window.setTimeout(closeStreetSearchResults, 120);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
/* ------------------------------------------------------------------ */
|
/* ------------------------------------------------------------------ */
|
||||||
/* Straßen-Dialog */
|
/* Straßen-Dialog */
|
||||||
/* ------------------------------------------------------------------ */
|
/* ------------------------------------------------------------------ */
|
||||||
@@ -1748,6 +2111,7 @@ function normalizeTimestamp(value) {
|
|||||||
|
|
||||||
function bindStaticUi() {
|
function bindStaticUi() {
|
||||||
initTheme();
|
initTheme();
|
||||||
|
initStreetSearch();
|
||||||
|
|
||||||
document.getElementById('baseLayerSelect').addEventListener('change', event => {
|
document.getElementById('baseLayerSelect').addEventListener('change', event => {
|
||||||
setBaseLayer(event.target.value);
|
setBaseLayer(event.target.value);
|
||||||
|
|||||||
@@ -55,6 +55,11 @@
|
|||||||
<button onclick="openCreateStrasseModal()">Neue Straße</button>
|
<button onclick="openCreateStrasseModal()">Neue Straße</button>
|
||||||
<button onclick="document.getElementById('csvFile').click()">Import CSV</button>
|
<button onclick="document.getElementById('csvFile').click()">Import CSV</button>
|
||||||
<input type="file" id="csvFile" accept=".csv" style="display:none" onchange="importCSV(this)">
|
<input type="file" id="csvFile" accept=".csv" style="display:none" onchange="importCSV(this)">
|
||||||
|
<button onclick="document.getElementById('houseNumberCsvFile').click()">
|
||||||
|
Hausnummern importieren ({{ house_number_count }})
|
||||||
|
</button>
|
||||||
|
<input type="file" id="houseNumberCsvFile" accept=".csv" style="display:none"
|
||||||
|
onchange="importHouseNumbers(this)">
|
||||||
|
|
||||||
<!-- Create/Edit Strasse Modal -->
|
<!-- Create/Edit Strasse Modal -->
|
||||||
<dialog id="strasseModal">
|
<dialog id="strasseModal">
|
||||||
|
|||||||
@@ -26,15 +26,27 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="clock-time" id="clockTime">--:--:--</div>
|
<div class="clock-time" id="clockTime">--:--:--</div>
|
||||||
</div>
|
</div>
|
||||||
|
<button type="button" id="speakerButton" class="icon-button"
|
||||||
|
title="Nachricht an alle senden" aria-label="Nachricht an alle senden">📢</button>
|
||||||
<img class="dispatcher-logo"
|
<img class="dispatcher-logo"
|
||||||
src="{{ url_for('static', filename='img/logo.png') }}"
|
src="{{ url_for('static', filename='img/logo.png') }}"
|
||||||
alt="CMBNet">
|
alt="CMBNet">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="header-controls">
|
<div class="street-search" role="search">
|
||||||
<button type="button" id="speakerButton" class="icon-button"
|
<input type="search" id="streetSearchInput"
|
||||||
title="Nachricht an alle senden" aria-label="Nachricht an alle senden">📢</button>
|
placeholder="Straße oder Straße + Hausnummer"
|
||||||
|
aria-label="Straße suchen"
|
||||||
|
aria-autocomplete="list"
|
||||||
|
aria-controls="streetSearchResults"
|
||||||
|
aria-expanded="false"
|
||||||
|
autocomplete="off" spellcheck="false"
|
||||||
|
enterkeyhint="search">
|
||||||
|
<ul id="streetSearchResults" class="street-search-results"
|
||||||
|
role="listbox" aria-label="Straßenvorschläge" hidden></ul>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="street-search-status" id="streetSearchStatus"
|
||||||
|
role="status" aria-live="polite"></div>
|
||||||
<div class="connection-status" id="connectionStatus">Verbinde …</div>
|
<div class="connection-status" id="connectionStatus">Verbinde …</div>
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
|
|||||||
+5594
File diff suppressed because it is too large.
Load diff
Executable
+41
@@ -0,0 +1,41 @@
|
|||||||
|
#!/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', ]
|
||||||
|
rheinviertel = ['Godesberg-Villenviertel', 'Rüngsdorf',
|
||||||
|
'Plittersdorf', 'Godesberg-Nord', 'Hochkreuz',]
|
||||||
|
|
||||||
|
with open('bonn-opendata/BonnHausnummern.csv', newline='') as csvfile:
|
||||||
|
a_reader = csv.DictReader(csvfile, delimiter=';', quotechar='#')
|
||||||
|
print("#Straßenname;Hausnummer;Longitude;Latitude")
|
||||||
|
for row in a_reader:
|
||||||
|
if row['ortsteil_name'] in rheinviertel:
|
||||||
|
x = row['rechtswert_25832']
|
||||||
|
y = row['hochwert_25832']
|
||||||
|
lat, lon = to_latlon.transform(x, y)
|
||||||
|
s = row['stassen_langname']
|
||||||
|
hnr = int(row['hnr_ohne_zusatz'].split('-')[-1:][0])
|
||||||
|
print("%s;%d;%f;%f" % (s, hnr, lon, lat))
|
||||||
|
|
||||||
Reference in new issue
Block a user