OSMNX 并未 return 绘制所有欧洲国家首都的图表
OSMNX does not return graph for all European capitals
令我感到困惑的是,一些欧洲国家的首都在使用 osmnx
查询时没有 return 图表。它适用于里斯本、柏林、巴黎等地,但当我尝试 运行 它与布鲁塞尔或雅典时,我收到 NetworkXPointlessConcept: Connectivity is undefined for the null graph.
错误。
我不认为这是预期的,如果有人知道如何解决这个问题,我将不胜感激。
我已经检查了文档并确保所有包都是最新的(osmnx
是 1.1.1)。
import osmnx as ox
# Does *NOT* work
ox.graph_from_place("Brussels, Belgium")
# Does *NOT* work
ox.graph_from_place("Athens, Greece")
# Works
ox.graph_from_place("Berlin, Germany")
# Works
ox.graph_from_place("Zurich, Switzerland")
不知为何无法获取。当我查看它时,我能够获得 geopandas,并从那里我能够获得纬度和经度信息。
import osmnx as ox
%matplotlib inline
ox.config(log_console=True)
ox.__version__
gdf = ox.geocode_to_gdf("Brussels, Belgium")
gdf
geometry bbox_north bbox_south bbox_east bbox_west place_id osm_type osm_id lat lon display_name class type importance
0 POLYGON ((4.35895 50.84385, 4.35896 50.84385, ... 50.844296 50.843082 4.3605 4.358953 258572709 relation 3299877 50.843735 4.359779 Centre for Fine Arts, Brussels, 23, Rue Ravens... amenity arts_centre 0.634996
# lat, lon
G = ox.graph_from_point((50.84375, 4.359779), network_type='all_private')
fig, ax = ox.plot_graph(G)
gdf = ox.geocode_to_gdf("Athens, Greece")
G = ox.graph_from_point((37.992907, 23.720079), network_type='drive')
fig, ax = ox.plot_graph(G)
graph.graph_from_place
Create graph from OSM within the boundaries of some geocodable place(s).
The query must be geocodable and OSM must have polygon boundaries for the geocode result. If OSM does not have a polygon for this place, you can instead get its street network using the graph_from_address function, which geocodes the place name to a point and gets the network within some distance of that point.
If OSM does have polygon boundaries for this place but you’re not finding it, try to vary the query string, pass in a structured query dict, or vary the which_result argument to use a different geocode result. If you know the OSM ID of the place, you can retrieve its boundary polygon using the geocode_to_gdf function, then pass it to the graph_from_polygon function.
令我感到困惑的是,一些欧洲国家的首都在使用 osmnx
查询时没有 return 图表。它适用于里斯本、柏林、巴黎等地,但当我尝试 运行 它与布鲁塞尔或雅典时,我收到 NetworkXPointlessConcept: Connectivity is undefined for the null graph.
错误。
我不认为这是预期的,如果有人知道如何解决这个问题,我将不胜感激。
我已经检查了文档并确保所有包都是最新的(osmnx
是 1.1.1)。
import osmnx as ox
# Does *NOT* work
ox.graph_from_place("Brussels, Belgium")
# Does *NOT* work
ox.graph_from_place("Athens, Greece")
# Works
ox.graph_from_place("Berlin, Germany")
# Works
ox.graph_from_place("Zurich, Switzerland")
不知为何无法获取。当我查看它时,我能够获得 geopandas,并从那里我能够获得纬度和经度信息。
import osmnx as ox
%matplotlib inline
ox.config(log_console=True)
ox.__version__
gdf = ox.geocode_to_gdf("Brussels, Belgium")
gdf
geometry bbox_north bbox_south bbox_east bbox_west place_id osm_type osm_id lat lon display_name class type importance
0 POLYGON ((4.35895 50.84385, 4.35896 50.84385, ... 50.844296 50.843082 4.3605 4.358953 258572709 relation 3299877 50.843735 4.359779 Centre for Fine Arts, Brussels, 23, Rue Ravens... amenity arts_centre 0.634996
# lat, lon
G = ox.graph_from_point((50.84375, 4.359779), network_type='all_private')
fig, ax = ox.plot_graph(G)
gdf = ox.geocode_to_gdf("Athens, Greece")
G = ox.graph_from_point((37.992907, 23.720079), network_type='drive')
fig, ax = ox.plot_graph(G)
graph.graph_from_place
Create graph from OSM within the boundaries of some geocodable place(s).
The query must be geocodable and OSM must have polygon boundaries for the geocode result. If OSM does not have a polygon for this place, you can instead get its street network using the graph_from_address function, which geocodes the place name to a point and gets the network within some distance of that point.
If OSM does have polygon boundaries for this place but you’re not finding it, try to vary the query string, pass in a structured query dict, or vary the which_result argument to use a different geocode result. If you know the OSM ID of the place, you can retrieve its boundary polygon using the geocode_to_gdf function, then pass it to the graph_from_polygon function.