This commit is contained in:
2026-01-14 14:04:33 +01:00
parent 678e5763c0
commit d2b6f604f0
6 changed files with 50774 additions and 37077 deletions

View File

@@ -6,6 +6,8 @@ from pathlib import Path
import shutil
from pyproj import CRS, Transformer, datadir
import numpy as np
from pyproj.exceptions import ProjError
from pyproj import CRS, Transformer
class Transformationen:
@@ -359,6 +361,8 @@ class Transformationen:
allow_ballpark=False,
)
tr_geo = Transformer.from_crs(CRS.from_epsg(4936), CRS.from_epsg(4979), always_xy=True)
dict_koordinaten_utm = {}
for punktnummer, koordinate in dict_koordinaten.items():
werte = []
@@ -398,7 +402,16 @@ class Transformationen:
X, Y, Z = werte[0], werte[1], werte[2]
E, N, H = tr.transform(X, Y, Z)
try:
E, N, H = tr.transform(X, Y, Z, errcheck=True)
except ProjError as e:
lon, lat, h_ell = tr_geo.transform(X, Y, Z, errcheck=True)
raise ProjError(
f"transform error (outside grid) | pn={punktnummer} | "
f"X,Y,Z={X},{Y},{Z} | lon/lat={lon},{lat} | h_ell={h_ell} | {e}"
)
E, N, H = tr.transform(X, Y, Z, errcheck=True)
# Runden, weil ansonsten aufgrund begrenzter Rechenkapazität falsche Werte Resultieren
dict_koordinaten_utm[punktnummer] = (round(E, 8), round(N, 8), round(H, 8))
return dict_koordinaten_utm