Can one tell that from the number of digits or a similar rule?
2 Answers
You can use PyCRS library.
import pycrs
crs3857 = pycrs.parse.from_epsg_code(3857)
print("EPSG:3857 is " + crs3857.cs_type)
crs4326 = pycrs.parse.from_epsg_code(4326)
print("EPSG:4326 is " + crs4326.cs_type)
Output:
EPSG:3857 is Projected
EPSG:4326 is Geographic
You can also use isinstance
method of Python with PyCRS:
isinstance(crs3857, pycrs.ProjCS)
# True
isinstance(crs4326, pycrs.GeogCS)
# True
-
Worked fine for me thanks!. But the 'pycrs.parse.from_epsg_code' part takes soo long for me (at least 2 minutes). Is there a faster solution?– DavidCommented Feb 4, 2021 at 14:07
-
The best way, I guess, is to use pyproj
itself.
from pyproj import CRS
crs3857 = CRS(3857) # Web Mercator
crs4326 = CRS(4326) # WGS84
crs3857.is_projected # True
crs3857.is_geographic # False
crs4326.is_projected # False
crs4326.is_geographic # True