简体   繁体   中英

How to read shapefile in geopandas when having .dbf, .prj, .shp and .shx files?

I have a folder which contains the shape files; more formally, the files I have are: ".dbf", ".prj", ".shp" and ".shx". Right now, I read shape files through:

shapefile_path = r".\canada.shp"
canada = geopandas.read_file(shapefile_path)

But how about the other files?

Any help is much appreciated!!

".dbf", ".prj", ".shp" and ".shx" are all parts of the same ShapeFile. For some reason, the structure of SHP is splitted into multiple files. If you read .shp into geopandas like you did above, it automatically reads the rest of them as well to give you proper GeoDataFrame composed of geometry, attributes and projection. You can see the details on what is the purpose of which filetype on Wiki .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM