OSMnx使用“来自边界框的街道网络”的限制:TypeError:graph_from_bbox()最多接受15个参数(给定77个)

时间:2019-06-20 02:07:11

标签: osmnx

我正在尝试使用-https://geoffboeing.com/2016/11/osmnx-python-street-networks/-中的示例2a示例代码在某个纬度长的边界框中获得可驾驶的街道网络,但是却出现此错误; TypeError:graph_from_bbox()最多接受15个参数(给定77个参数)。

以下是我已经尝试过的内容:

G = ox.graph_from_bbox(29.94510876,29.93205121,29.93678994,29.94840128,29.94297549,29.96456162,29.96164721,29.96828055,29.91873862,         29.94221035、29.95584061、30.04064237、29.93609316、30.032814、29.96624232、30.00497466、30.00427683、29.94665333,         29.957519、29.943813、29.93076、29.927549、29.967799、29.969906、29.951438、29.975021、29.95932、30.00816、29.95056,         30.007622、29.951881、30.016095、30.031229、30.05131、30.044959、29.9382、29.919781、30.030601,-90.04488594,         -90.07180566,-90.0849317,-90.12952617,-90.02696213,-90.03235984,-90.06925941,-90.09060393,-90.08716583,         -90.11185615,-90.12122927,-89.91899769,-90.0844343,-89.97297866,-90.01417363,-90.10830816,-90.03988187,         -90.07825592,-90.076855,-90.083341,-90.03282,-90.101536,-90.066648,-90.030283,-90.121145,-90.08682,         -90.15624,-90.0648,-90.20634,-90.106042,-90.102726,-90.019069,-89.978768,-89.955024,-89.903415,-90.0685,         -89.99601,-90.066334,network_type =“驱动器”) G_projected = ox.project_graph(G) ox.plot_graph(G_projected)

G = ox.graph_from_bbox(29.94510876, 29.93205121, 29.93678994, 29.94840128, 29.94297549, 29.96456162, 29.96164721, 29.96828055, 29.91873862, 
        29.94221035, 29.95584061, 30.04064237, 29.93609316, 30.032814, 29.96624232, 30.00497466, 30.00427683, 29.94665333, 
        29.957519, 29.943813, 29.93076, 29.927549, 29.967799, 29.969906, 29.951438, 29.975021, 29.95932, 30.00816, 29.95056, 
        30.007622, 29.951881, 30.016095, 30.031229, 30.05131, 30.044959, 29.9382, 29.919781, 30.030601, -90.04488594, 
        -90.07180566, -90.0849317, -90.12952617, -90.02696213, -90.03235984, -90.06925941, -90.09060393, -90.08716583, 
        -90.11185615, -90.12122927, -89.91899769, -90.0844343, -89.97297866, -90.01417363, -90.10830816, -90.03988187, 
        -90.07825592, -90.076855, -90.083341, -90.03282, -90.101536, -90.066648, -90.030283, -90.121145, -90.08682, 
        -90.15624, -90.0648, -90.20634, -90.106042, -90.102726, -90.019069, -89.978768, -89.955024, -89.903415, -90.0685, 
        -89.99601, -90.066334, network_type='drive')
G_projected = ox.project_graph(G)
ox.plot_graph(G_projected)

我希望在列出的经纬度边界框内获得可驾驶的街道网络。

1 个答案:

答案 0 :(得分:1)

因此,该函数仅限于使用定义坐标(边界框)的4个参数,并且应按照文档(OSMNX)中所述的以下顺序进行。

osmnx.core.graph_from_bbox(north, south, east, west)

这意味着只能指定一个矩形,而不是广义多边形,我想您是在尝试在此处指定的。因此,抛出了以上错误。

import osmnx as ox
G = ox.graph_from_bbox( -37.7860, -37.8359, 144.9903, 144.9269, network_type='drive', simplify=True, retain_all=False)