Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove EPSG 4326 to allow for planetary bounds (untested) #175

Open
thareUSGS opened this issue Aug 30, 2023 · 2 comments
Open

remove EPSG 4326 to allow for planetary bounds (untested) #175

thareUSGS opened this issue Aug 30, 2023 · 2 comments

Comments

@thareUSGS
Copy link

thareUSGS commented Aug 30, 2023

To fix the calculation for planetary codes in the latest version, this code can likely be updated
from:

    srs = get_ref(layer)
    srs.SetAxisMappingStrategy(osr.OAMS_TRADITIONAL_GIS_ORDER)
    target = osr.SpatialReference()
    target.ImportFromEPSG(4326)
    target.SetAxisMappingStrategy(osr.OAMS_TRADITIONAL_GIS_ORDER)

https://github.com/DOI-USGS/fort-pymdwizard/blob/225193692f9399b20d44905d7cf8e58441e428bd/pymdwizard/core/spatial_utils.py#L142C1-L143C32

to:

    srs = get_ref(layer)
    srs.SetAxisMappingStrategy(osr.OAMS_TRADITIONAL_GIS_ORDER)
    # Get the body (planet or moon, Earth is a planet too ;-) from the projection definition
    # removes the lock-in to EPSG:4326 (WGS84)
    target = srs.CloneGeogCS()
    target.SetAxisMappingStrategy(osr.OAMS_TRADITIONAL_GIS_ORDER)
@tnorkin
Copy link
Collaborator

tnorkin commented Aug 30, 2023

@thareUSGS, thanks very much for the suggested fix!

@thareUSGS
Copy link
Author

thareUSGS commented Aug 30, 2023

Tested for a few Mars GeoTIFFs and Shapefiles. Seems to fix it.

BTW, this could actually be more accurate for Earth datasets. Forcing all Earth calculations to WGS84 (as new definitions for Earth are released) could end up being bad.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants