Projected to Geographical conversion breaks with Lambert_Conformal_Conic_2SP
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
Research direction
Start with the supplied Python reproduction and the mikecore.Projections.MapProjection entry point, comparing Proj2Geo with Geo2Proj for the Lambert_Conformal_L擎Conic_2SP projection. Trace why the inverse conversion returns (444.87039857071056, nan), then verify that the same coordinate pair converts to the expected geographic values without breaking the working Transverse_Mercator case.
Written by the indexing model from the issue text.
Description
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!
- Dominant language
- Python
- Stars
- 5
- Forks
- 1
- Avg merge
- 1h 18m
- Merged PRs (30d)
- 5
Getting set up
- Ships a Dockerfile or Docker Compose file
- No pull request template
- No contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from DHI/mikecore-python
-
Four test assertions carried over from the C# suite are still commented outPossibly taken @ryan-kipawa claimed this 6 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
DHI/mikecore-python#49 ·
Maintainers usually reply within 1 day
-
Difficulty 4/5 3-5 days Newbie friendliness 45/100
DHI/mikecore-python#59 ·
Maintainers usually reply within 1 day
-
New submesh feature (2027) makes all dfsu fail!Possibly taken @ryan-kipawa claimed this 6 days ago. Open
Difficulty 4/5 3-5 days Newbie friendliness 42/100
DHI/mikecore-python#54 · 2 comments ·
Maintainers usually reply within 1 day
-
Difficulty 5/5 Over a week Newbie friendliness 45/100
DHI/mikecore-python#52 ·
Maintainers usually reply within 1 day
-
Remaining TODOs in production code: platform notes, licensing questions, and one likely-stale markerOpen
Difficulty 5/5 Over a week Newbie friendliness 30/100
DHI/mikecore-python#51 ·
Maintainers usually reply within 1 day
All issues in DHI/mikecore-python
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
LearningCircuit/local-deep-research#7206 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
chingu-voyages/V62-tier3-team-33#285 ·
Maintainers usually reply within 1 day
-
Proxy drops log notifications from backends that don't send FastMCP's msg/extra dictPossibly taken @asasemahmed claimed this today. Openbug server
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Maintainers usually reply within 1 day
-
[Bug]: Bedrock request metadata forwarding does not work for /embeddingsPossibly taken A pull request linked to this issue is open or already merged. Openbug llm translation
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day