2

I have a shapefile that I created in QGIS using the projection NAD_1983_2011_StatePlane_Virginia_North_FIPS_4501_Ft_US.

When I load the shapefile into Python as a GeoDataFrame, it appears that the gdf doesn't have a crs.

The code sample:

import geopandas as gpd

path = [shapefile path]

data = gpd.read_file(path) data.crs

returns

{}

Does anyone have any insight? My guess is that I'm just going about getting the CRS the wrong way, but I can't tell what I should change.

Taras
  • 32,823
  • 4
  • 66
  • 137
userfriendly
  • 235
  • 2
  • 10

1 Answers1

3

The shapefile is a bundle of files. One of them is the .prj.

When reading a shapefile with GeoPandas and either:

  • .prj is an empty file
  • no .prj file at all

the output will be None.

So, in this case, check the origin of your shapefile or verify the process of exporting the shapefile with a projection.

Otherwise, it makes sense to apply the .set_crs().

In your case case, it might be the ESRI:102746:

import geopandas as gpd
from pyproj import CRS

path = 'path/to/shapefile'

data = gpd.read_file(path)

crs = CRS.from_string('ESRI:102746') data.set_crs(crs=crs)


References:

Taras
  • 32,823
  • 4
  • 66
  • 137