【问题标题】:How do I find out the meaning of index in a .shp or .shx shapefile?如何找出 .shp 或 .shx shapefile 中索引的含义?
【发布时间】:2020-10-13 03:11:45
【问题描述】:
import geopandas as gpd    

DATA = gpd.read_file('Africa.shx')
DATA.info()

我从this websiteAfrica.shxAfrica.shp 下载了两个 shapefile。 我如何知道包括哪些国家?例如,指数从 0 到 58,但非洲只有 55 个国家(包括西撒哈拉)。另外,我应该如何将每个国家的数据与 shapefile 匹配?我认为这也是由索引完成的,因此了解它们的含义非常重要。顺便说一句,哪种文件类型更便于处理此类匹配作业.shx.shp

<class 'geopandas.geodataframe.GeoDataFrame'>
RangeIndex: 59 entries, 0 to 58
Data columns (total 1 columns):
 #   Column    Non-Null Count  Dtype   
---  ------    --------------  -----   
 0   geometry  59 non-null     geometry
dtypes: geometry(1)
memory usage: 600.0 bytes

【问题讨论】:

  • 您需要Africa.dbf 文件。那是存储名称等数据的地方。如果您在一个文件夹中有shp, shx` 和dbf,那么gpd.read_file('Africa.shp') 应该可以正确加载它们。
  • @martinfleis 谢谢!它不起作用,因为我将长文件名更改为Africa...不知道.dbf 很重要。现在一切都好。非常感谢!
  • @martinfleis 你可以把它变成一个答案,如果你愿意,我会接受。

标签: python shapefile geopandas


【解决方案1】:

为此,您需要 Africa.dbf 文件。那是存储名称等数据的地方。如果您在一个文件夹中有shpshxdbf,那么gpd.read_file('Africa.shp') 应该可以正确加载它们。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2022-08-17
    • 1970-01-01
    • 2011-01-14
    • 2018-03-18
    • 1970-01-01
    • 1970-01-01
    • 2018-07-13
    相关资源
    最近更新 更多