-
Notifications
You must be signed in to change notification settings - Fork 230
Closed
Labels
Description
At some point pyproj used classmethods for constructor-type methods in pyproj.crs.CRS. In this commit this was changed to use staticmethods. The linked issue does not seem to mention this change (unless I missed it). In any case, this change effectively breaks subclassing, as in this example:
import pyproj
class myCRS(pyproj.crs.CRS):
def print_foo(self):
print("foo-bar!")
proj = pyproj.Proj("+proj=etmerc +ellps=GRS80 +lon_0=13 +lat_0=2 +x_0=0 +y_0=0 +k_0=1")
crs = myCRS.from_proj4(proj.definition_string())
print(type(crs))
print(isinstance(crs, myCRS))
crs.print_foo()Expected Output
expect:
<class '__main__.myCRS'>
True
foo-bar!
what you get:
<class 'pyproj.crs.crs.CRS'>
False
...
AttributeError: 'CRS' object has no attribute 'print_foo'
Environment Information
Any ( we had been using pyproj v2.4.1, and just upgraded to 3.0.1)
Installation method
build from source
Reactions are currently unavailable