我有两个 shapefile:意大利邮政编码;和意大利的城市。两者都是多边形格式,并且都包含每个相关形状的名称。我想向邮政编码形状文件添加一个邮政编码所在城市的字段。我相信这是一个空间查询。如何使用 GeoPandas 执行此操作?
最佳答案
这样的空间查询可以通过空间连接函数sjoin
来完成。 GeoPandas 的。它看起来像:
res = geopandas.sjoin(postcodes, municipalities, op='contains')
其中op
将取决于数据的特定空间关系。
参见https://geopandas.readthedocs.io/en/latest/mergingdata.html#spatial-joins了解更多。
关于python - 如何使用 GeoPandas 执行空间查询?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53338363/