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

Updating a way to find the Unit Property of the Coordinate Reference System (CRS). #167

Merged
merged 2 commits into from
Jul 31, 2024

Conversation

dabhicusp
Copy link
Collaborator

@dabhicusp dabhicusp commented Jul 30, 2024

The present code retrieves the unit of the CRS using the crs[0].axis_info method. However, a previous version (2.4.2) of pyproj does not provide the unit of the CRS when calling crs[0].axis_info. In the context of working Xee in an older version of the pyproj, we must modify this retrieval method.

Reference Code:

import ee
ee.Initialize()

import pyproj
from pyproj.crs import CRS

proj = pyproj.Proj(proj='eqc')
crs = pyproj.CRS.from_string(proj.definition_string())
wkt = crs.to_wkt('WKT1_GDAL')

projection = ee.Projection(wkt, [1, 0, 0, 0, -1, 0]).atScale(10000).getInfo()
wkt_str = projection.get('wkt')

crs = CRS(wkt_str)
print(crs.axis_info)

Running the aforementioned code with the older version of PyProj results in an empty list.

Copy link
Collaborator

@mahrsee1997 mahrsee1997 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@copybara-service copybara-service bot merged commit 18ef42b into main Jul 31, 2024
11 checks passed
@dabhicusp dabhicusp deleted the crs_unit branch July 31, 2024 15:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants