pyproj4 / pyproj

Python interface to PROJ (cartographic projections and coordinate transformations library)

Home Page:https://pyproj4.github.io/pyproj

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Support for deprecated and non-deprecated objects

mwtoews opened this issue · comments

Initially from OSGeo/spatialreference.org#3 (comment) 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:

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

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

  • get_non_deprecated is a method of the class CRS, or it is a free function that takes a CRS? For the former, it would be similar to sub_crs_list. For the later, where should be this function?
  • proj_get_non_deprecated so far is only done for CRS (looking at the documentation).

I recommend adding a class method. Thank you!