2017-12-13 33 views
3

OSMnxを使用して複数のインフラストラクチャネットワーク(例:通り、レール、建物)を同じ図にプロットしようとしていますが、OSMnxを使用して同じ図に2つ以上のインフラストラクチャをプロットしようとしています

これは私の試みの一つである。このコードの

import osmnx as ox 
dist = 2000 
point = (41.877092, -87.628) 
north, south, east, west = ox.bbox_from_point(point, distance=dist) 
bbox_proj = ox.bbox_from_point(point, dist, project_utm=True) 
streets = ox.core.osm_net_download(
    north=north, 
    south=south, 
    east=east, 
    west=west, 
    infrastructure='way["highway"]' 
    ) 
railways = ox.core.osm_net_download(
    north=north, 
    south=south, 
    east=east, 
    west=west, 
    infrastructure='way["railway"]' 
    ) 
buildings = ox.core.osm_net_download(
    north=north, 
    south=south, 
    east=east, 
    west=west, 
    infrastructure='way["building"]' 
    ) 
streets[0]['elements'] = streets[0]['elements'] + railways[0]['elements'] + buildings[0]['elements'] 
net = streets 
G = ox.core.create_graph(net) 
G = ox.truncate_graph_bbox(G, north, south, east, west, truncate_by_edge=True) 
G = ox.project_graph(G) 
_, _ = ox.plot.plot_graph(G, bbox=bbox_proj, fig_height=10, node_size=0, edge_color='black', edge_linewidth=0.5, save=True) 

結果であるのみ最初の2つのインフラ、道路やレールではなく、建物ploting:ox.plot_figure_groundの

enter image description here の検索結果を(道路のインフラストラクチャのみをプロットしています)

enter image description here プロットされていないにもかかわらず、建物のデータがダウンロードされています(私はplot_buildingsについて知っていますが、私は着色された建物を望んでいません、ただの行)。

これまでは、infrastructureパラメータで複数のフィルタを一度に追加する方法を見つけようとしていました。次のようなものがあります。

nets = ox.core.osm_net_download(
    north=north, 
    south=south, 
    east=east, 
    west=west, 
    infrastructure='way["highway"],way["railway"],way["buildings"]' 
    ) 

これが可能かどうかはわかりません。

OSMnxでは2つ以上のプロットを1つの図にプロットする方法はありますか?

答えて

0

buildingsbuildingに置き換えてください。正しいOSMキーはbuildingで、最後に「s」はありません。実際、ほとんどのOSMキーは単数形です。

+0

はい、私はそれを試みました。質問のためにコードをより整理しようとしたときのちょうどタイプミス。しかし、ありがとう! – Danowsky

関連する問題