【问题标题】:How to visualize and convert retrieved OSM buildings data to shapefile?如何可视化检索到的 OSM 建筑物数据并将其转换为 shapefile?
【发布时间】:2021-05-11 15:40:07
【问题描述】:

我已使用此脚本从 OSM 检索数据:

import overpy
api = overpy.Overpass()
print('Obtaining Data...')
result = api.query("""
[out:json]
[timeout:25]
;
(
  relation
    ["building"]
    (51.909331730124,4.3151378631592,51.954898210091,4.405689239502);
  
    way
    ["building"]
    (51.909331730124,4.3151378631592,51.954898210091,4.405689239502);
);
out;
>;
out skel qt;
""")

我想在执行一些空间分析之前可视化数据并将其保存为 shapefile。我不知道如何将其转换/保存为 shapefile,任何人都可以提供任何建议吗?

谢谢!

【问题讨论】:

    标签: openstreetmap shapefile geopandas overpass-api


    【解决方案1】:
    import osmnx as ox 
    import ast
    
    point = 'point coordinates'
    dist = 'distance in m'
    buildings = ox.geometries.geometries_from_point(point, {'building': True}, dist=dist)
    

    并转换为地理数据框:

    buildings_save = buildings.applymap(lambda x: str(x) if isinstance(x, list) else x)
    

    【讨论】:

      猜你喜欢
      • 2021-05-11
      • 1970-01-01
      • 1970-01-01
      • 2021-11-30
      • 1970-01-01
      • 1970-01-01
      • 2021-04-26
      • 2021-04-27
      • 2021-05-29
      相关资源
      最近更新 更多