TransWikia.com

Can't open shapefile with GeoPandas

Geographic Information Systems Asked by zampnrs on December 5, 2020

I downloaded a shapefile from the Brazilian Institute of Geography and Statistics (IBGE). I can open it on QGIS and work with it perfectly there, but I need to work with it using Python.

I’m trying to open it with GeoPandas using the code line bellow:

shp_pr = gpd.read_file("data/PR/PR.shp")

But I get the following errors:

proj_create: Cannot find proj.db
proj_create: no database context specified
ERROR 4: Unable to open EPSG support file gcs.csv.  Try setting the GDAL_DATA environment variable to point to the directory containing EPSG csv files.
proj_create: Cannot find proj.db
proj_create: no database context specified
Unable to open EPSG support file gcs.csv.  Try setting the GDAL_DATA environment variable to point to the directory containing EPSG csv files.
proj_create: Cannot find proj.db
proj_create: no database context specified

I’ve also tried with GDAL, using these code lines:

from osgeo import ogr

driver = ogr.GetDriverByName("ESRI Shapefile")
ds = driver.Open("data/PR/PR.shp", 0) #open your shapefile

But I get these errors:

proj_create: Cannot find proj.db
proj_create: no database context specified
ERROR 4: Unable to open EPSG support file gcs.csv.  Try setting the GDAL_DATA environment variable to point to the directory containing EPSG csv files.
proj_create: Cannot find proj.db
proj_create: no database context specified
Unable to open EPSG support file gcs.csv.  Try setting the GDAL_DATA environment variable to point to the directory containing EPSG csv files.

I have all the “.cpg”, “.dbf”, “.prj”, “.qpj”, “.shp” and “.shx” files.

What is going wrong?

One Answer

Just set the environment variable as PROJ_LIB with value as C:Anaconda3Libraryshareproj
this address contain proj.db file

Answered by Shubham Rawat Shubhi on December 5, 2020

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP