在shapefile.Reader()对象上应用__geo_interface__属性时,如何摆脱“删除标志”字段?

时间:2019-06-01 13:24:48

标签: python geojson pyshp

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

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

import shapefile

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

问题是当我打印newGeojson对象时,我注意到新的geojson对象中的字段与blockgroups.shp文件中的原始值不匹配。那是因为在geojson对象中添加了DeletionFlag字段。 “删除标志”字段作为一个隐藏字段存在于blockgroups.shp文件中,因此我们无法在shapefile的属性表中看到它。而是在新的geojson对象中将其显示为可见字段,并采用AREA字段的值。从这里开始,没有值与其正确值匹配。 有人遇到过同样的问题吗?有什么办法可以解决这个问题?

0 个答案:

没有答案