简体   繁体   English

具有 .dbf、.prj、.shp 和 .shx 文件时如何在 geopandas 中读取 shapefile?

[英]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".更正式地说,我拥有的文件是:“.dbf”、“.prj”、“.shp”和“.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. “.dbf”、“.prj”、“.shp”和“.shx”都是同一个 ShapeFile 的一部分。 For some reason, the structure of SHP is splitted into multiple files.出于某种原因,SHP 的结构被拆分为多个文件。 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.如果您像上面那样将 .shp 读入 geopandas,它也会自动读取其余部分,为您提供由几何、属性和投影组成的正确 GeoDataFrame。 You can see the details on what is the purpose of which filetype on Wiki .您可以在Wiki上查看有关哪种文件类型的用途的详细信息

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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