如何从omsnx图形中选择子图形?

2024-04-25 18:04:58 发布

您现在位置:Python中文网/ 问答频道 /正文

我用osmnx从海地提取了公路网

impor omsmnx as ox
place = ox.gdf_from_place('Haiti', which_result=2)
coords = place.geometry.total_bounds
G = ox.graph_from_bbox(coords[3], coords[1], coords[2], coords[0])

这就是结果

enter image description here

现在我只想得到一个城市的道路网,比方说Port-au-Prince

city = 'Port-au-Prince'
place = ox.gdf_from_place(city, which_result=2)
coords_city = place.geometry.total_bounds

是否可以在coords_city内选择G的子图?你知道吗


Tags: fromcitywhichportplaceresultcoordstotal