[GIS] How todentify Coordinate System (CRS) from projection file using Python

coordinate systempythonshapefile

I am working on many shapefiles (their corresponding projection files are also presented).

Every shapefile has a different Coordinate System, so it becomes difficult to plot these in a generic manner.

How can I identify with Python what is the CRS used in the shapefile?

For example, the ".prj" file for some shapefiles is given below, but I am not able to identify what is the CRS to be used.

GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137,298.257223563]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]]

GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137,298.257223563]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]]

GEOGCS["WGS84(DD)", DATUM["WGS84", SPHEROID["WGS84", 6378137.0, 298.257223563]], PRIMEM["Greenwich", 0.0], UNIT["degree", 0.017453292519943295], AXIS["Geodetic longitude", EAST], AXIS["Geodetic latitude", NORTH]]

GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137,298.257223563]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]]

GEOGCS["WGS84(DD)", DATUM["WGS84", SPHEROID["WGS84", 6378137.0, 298.257223563]], PRIMEM["Greenwich", 0.0], UNIT["degree", 0.017453292519943295], AXIS["Geodetic longitude", EAST], AXIS["Geodetic latitude", NORTH]]

Best Answer

For example with fiona:

c = fiona.open('docs/data/test_uk.shp')
crs = c.crs

find it in the docs page 28

If you need the EPSG code there is good inspiration to take here using pyproj