four-eyes
four-eyes

Reputation: 12439

Extract EPSG code from GeoDataFrame.crs result

Let's say I have a GeoDataFrame with a CRS set.

gdf.crs

gives me

<Projected CRS: EPSG:25833>
Name: ETRS89 / UTM zone 33N
Axis Info [cartesian]:
- [east]: Easting (metre)
- [north]: Northing (metre)
Area of Use:
- undefined
Coordinate Operation:
- name: UTM zone 33N
- method: Transverse Mercator
Datum: European Terrestrial Reference System 1989
- Ellipsoid: GRS 1980
- Prime Meridian: Greenwich

This is of type <class 'pyproj.crs.crs.CRS'>. Is there a way to extract the EPSG Code from this, thus 25833?

Upvotes: 6

Views: 3516

Answers (1)

DNy
DNy

Reputation: 799

.crs returns a pyroj.CRS object. This should get you the EPSG code from the object:

gdf.crs.to_epsg()

pyproj docs

Upvotes: 13

Related Questions