小编Sri*_*ula的帖子

Shapefile转换为Geojson转换python 3

output_buffer = []
for features in range(0,layer.GetFeatureCount()):
    feat = layer.GetNextFeature()
    geom = feat.GetGeometryRef()
    result = feat.ExportToJson()
    output_buffer.append(result)
Run Code Online (Sandbox Code Playgroud)

当我转换为geojson时,得到输出,但是只有一个功能被格式化为JSON

我得到这样的输出:

{"geometry": {"coordinates": [488081.726322771, 2360837.62927308], "type": "Point"}, "type": "Feature", "id": 0, "properties": {"EntityHand": null, "Layer": "pipe", "Linetype": null, "Text": "BB_D2", "ExtendedEn": null, "SubClasses": null}}{"geometry": {"coordinates": [487523.119248441, 2361228.95273474], "type": "Point"}, "type": "Feature", "id": 1, "properties": {"EntityHand": null, "Layer": "pipe", "Linetype": null, "Text": "Mil_D2", "ExtendedEn": null, "SubClasses": null}}..................
Run Code Online (Sandbox Code Playgroud)

我想要这样的输出:

{"geometry": {"coordinates": [488081.726322771, 2360837.62927308], "type": "Point"}, "type": "Feature", "id": 0, "properties": {"EntityHand": null, "Layer": "pipe", …
Run Code Online (Sandbox Code Playgroud)

python json append shapefile gdal

5
推荐指数
3
解决办法
5624
查看次数

标签 统计

append ×1

gdal ×1

json ×1

python ×1

shapefile ×1