当我将\uuu geo\u interface\uuu属性应用于形状文件读取器()对象?

2024-09-24 22:30:33 发布

您现在位置:Python中文网/ 问答频道 /正文

我想使用pyshp库和geo_接口协议将shapefile转换成geojson对象。我用了块组.shp文件作为输入。您可以在以下网页中找到它:

https://github.com/GeospatialPython/pyshp/tree/master/shapefiles

import shapefile

r = shapefile.Reader('blockgroups.shp')
newGeojson = r.__geo_interface__
print(newGeojson)

问题是,当我打印newGeojson对象时,我注意到新geojson对象中的字段与中的原始值不匹配块组.shp文件。这是因为在geojson对象中添加了DeletionFlag字段。 删除标志字段存在于块组.shp文件作为隐藏字段,因此我们无法在shapefile的属性表中看到它。相反,在新的geojson对象中,它显示为一个可见字段,并接受区域字段的值。从这里没有值匹配它的正确值。 有人有同样的问题吗?有没有办法纠正这个问题?你知道吗


Tags: 文件对象httpsgithubmastercomtree网页