Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Projected to Geographical conversion breaks with Lambert_Conformal_Conic_2SP

Chiusa
#26 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
35/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
python
Ambito
backend

Direzione di ricerca

Inizia con la riproduzione Python fornita e con l’entry point mikecore.Projections.MapProjection, confrontando Proj2Geo con Geo2Proj per la proiezione Lambert_Conformal_L擎Conic_2SP. Traccia il motivo per cui la conversione inversa restituisce (444.87039857071056, nan), quindi verifica che la stessa coppia di coordinate venga convertita nei valori geografici attesi senza compromettere il caso Transverse_Mercator funzionante.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Hi,

I had issues in mikeio when trying to create a Dfs2 file with a Lambert_Conformal_Conic_2SP projection. I can do this succesfully when trying manually (i.e. in MIKE Zero GUI), and in mikecore. So I traced the issue to the mikecore.projections.MapProjection class used to setup the Dfs2 projection info for the Dfs2 builder: when it tries to convert projected coordinates it runs into numerical issues. See example below:

Fail case: Lambert_Conformal_Conic_2SP projection

from mikecore.Projections import MapProjection

# The projected and geographic coordinates here are the same
# This can be converted back and forth using the Datum Converter tool in MIKE Zero
origin_projected = [  -65900.32888812723, -678217.039068304]
origin_geographic = [  24.01529,-34.987278]

# Custom projection string
proj_str = 'PROJCS["Custom",GEOGCS["Unused",DATUM["User defined",SPHEROID["WGS 1984",6378137,298.257223563]],'+\
    'PRIMEM["Greenwich",0],UNIT["Degree",0.0174532925199433]],PROJECTION["Lambert_Conformal_Conic_2SP"],'+\
    'PARAMETER["False_Easting",0],PARAMETER["False_Northing",0],PARAMETER["Central_Meridian",24.751587],'+\
    'PARAMETER["Standard_Parallel_1",-40],PARAMETER["Standard_Parallel_2",-10],'+\
    'PARAMETER["Latitude_Of_Origin",-28.702538],UNIT["Meter",1]]'

# Try conversion using MIKE MapProjection
proj_core = MapProjection.Create(proj_str)

# Projected to Geographic Fails
print(proj_core.Proj2Geo(*origin_projected))

# Geographic to Projected works
print(proj_core.Geo2Proj(*origin_geographic))


>>> (444.87039857071056, nan)
>>> (-65900.2668223073, -678217.0403999202)

As you can see the Lambert_Conformal_Conic_2SP coordinate pairs fail when trying to converted from projected to geographical coordinates, while the reverse works just fine. I haven't tested this in the .NET/C# code, but I'm confident this isn't correct behaviour.

Working case: Transverse_Mercator projection

from mikecore.Projections import MapProjection

# Coordinate info
# The projected and geographic coordinates here are the same
# This can be converted back and forth using the Datum Converter tool in MIKE Zero
origin_projected = [  -89907.8133323,-3873624.5460040]
origin_geographic = [  24.01529,-34.987278]

# Custom projection string
proj_str = 'PROJCS["WG25",GEOGCS["Unused",DATUM["User defined",SPHEROID["WGS 1984",6378137,298.257223563]],'+\
    'PRIMEM["Greenwich",0],UNIT["Degree",0.0174532925199433]],PROJECTION["Transverse_Mercator"],'+\
    'PARAMETER["False_Easting",0],PARAMETER["False_Northing",0],PARAMETER["Central_Meridian",25],PARAMETER["Scale_Factor",1],'+\
    'PARAMETER["Latitude_Of_Origin",0],UNIT["Meter",1]]'

# Try conversion using MIKE MapProjection
proj_core = MapProjection.Create(proj_str)

# Projected to Geographic Fails
print(proj_core.Proj2Geo(*origin_projected))

# Geographic to Projected works
print(proj_core.Geo2Proj(*origin_geographic))

>>> (24.015290000000082, -34.9872779999965)
>>> (-89907.81333230426, -3873624.5460043526)

Success - works as expected!

Lingua principale
Python
Stelle
5
Fork
1
Merge medio
9h 31m
PR unite (30g)
8

Preparare l'ambiente

  • Include un Dockerfile o un file Docker Compose
  • Nessun modello di pull request
  • Nessuna guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di DHI/mikecore-python

Tutte le issue di DHI/mikecore-python

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.