pyproj4 / pyproj

Python interface to PROJ (cartographic projections and coordinate transformations library)
https://pyproj4.github.io/pyproj
MIT License
1.04k stars 210 forks source link

Support for deprecated and non-deprecated objects #1367

Closed mwtoews closed 6 months ago

mwtoews commented 7 months ago

Initially from https://github.com/OSGeo/spatialreference.org/issues/3#issuecomment-1881859037 by @rouault it would be helpful to have support to see deprecated objects, and provide lists to non-deprecated objects.

For instance, here is a prototype of possible behavior to add a .is_deprecated property and a get_non_deprecated function:

import pyproj
from pyproj import CRS

crs1 = CRS.from_epsg(28473)
assert crs1.is_deprecated
crs1_nondep = pyproj.get_non_deprecated(crs1)
assert len(crs1_nondep) == 1
assert crs1_nondep[0] == CRS.from_epsg(2503)

crs2 = CRS.from_epsg(4326)
assert not crs2.is_deprecated
assert len(pyproj.get_non_deprecated(crs2)) == 0

Relevant PROJ C API:

snowman2 commented 7 months ago

Sounds reasonable. I think that adding a get_non_deprecated method to each object that supports would be a good strategy.

jjimenezshaw commented 6 months ago

I was thinking on developing it. But I have some questions.

snowman2 commented 6 months ago

I recommend adding a class method. Thank you!