0

我正在尝试使用来自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='drive') 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)

我期待在那些列出的经纬度边界框内获得可驾驶的街道网络。

4

1 回答 1

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)
于 2019-08-26T06:04:29.293 回答