how to select a subgraph from an omsnx graph?

Viewed 521

I have extracted the road network from Haiti using 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])

that's the result

enter image description here

Now I would like to get the road network only for a city, let's say Port-au-Prince

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

Is it possible to select a subgraph of G inside coords_city?

0 Answers
Related