I started playing with the osmnx
Python package and have to questions:
Is the following minimal working example the correct way to plot additional geometries on top of my graph
G
or are there better ways?As you can see on the resulting plot below the code, the river (Tajo) is not completely colored. The blue stops abruptly, because the label must have changed. I tried out multiple tags, but could not find the appropriate one to color the rest of the river (you should see blue where the red circles are). Does anybody know what the correct tag is? (EDIT: It seems to be surrounded by a "costline" boundary)
import osmnx as ox
ox.config(log_console=False, use_cache=True)
# Coordinates Lisbon
bbox = [38.7969489, 38.6919296, -9.088, -9.2296891]
# Query graph for Lisbon
G = ox.graph_from_bbox(
*bbox,
simplify=True,
retain_all=True,
clean_periphery=True,
truncate_by_edge=True,
network_type="drive_service",
)
# Find additional geometries
water_1 = ox.geometries_from_bbox(*bbox, tags={"natural": ["water"]})
water_2 = ox.geometries_from_bbox(
*bbox,
tags={
"waterway": ["riverbank", "canal", "dock"],
"water": ["river", "canal", "reservoir"],
"natural": ["bay"],
},
)
water_3 = ox.geometries_from_bbox(*bbox, tags={"place": ["sea", "ocean"]})
motoway = ox.geometries_from_bbox(
*bbox,
tags={
"highway": [
"motorway",
"motorway_link",
"trunk",
"trunk_link",
]
},
)
# PLOT
fig, ax = ox.plot_graph(
G,
bgcolor="white",
node_size=0,
edge_linewidth=1,
show=False,
close=False,
figsize=(60, 80),
dpi=100,
save=True,
filepath="lisbon.jpg",
)
water_1.plot(color="#466A8C", linewidth=1, ax=ax)
water_2.plot(color="#466A8C", linewidth=1, ax=ax)
water_3.plot(color="#466A8C", linewidth=1, ax=ax)
motoway.plot(color="#000000", linewidth=2, ax=ax)