您好, 欢迎来到 !    登录 | 注册 | | 设为首页 | 收藏本站

在Python中将geojson对象的一部分合并到另一个对象中

在Python中将geojson对象的一部分合并到另一个对象中

像这样的例子:

import json
data = json.loads(json_data)
features = data["features"]
point_handle_text = {
    i["properties"]["EntityHandle"]: i["properties"]["Text"]
    for i in features
    if i["geometry"]["type"] == "Point"
}
combine_features = []
for i in features:
    if i["geometry"]["type"] == "LineString":
        i["properties"]["Text"] = point_handle_text.get(i["properties"]["EntityHandle"])
        combine_features.append(i)
data["features"] = combine_features
json_data = json.dumps(data)
python 2022/1/1 18:48:12 有305人围观

撰写回答


你尚未登录,登录后可以

和开发者交流问题的细节

关注并接收问题和回答的更新提醒

参与内容的编辑和改进,让解决方法与时俱进

请先登录

推荐问题


联系我
置顶