I am using OSMnx in Python. I use features_from_place
to load amenities. My code is as follows:
amenity = ox.features.features_from_place('centrum, Rotterdam,Netherlands', tags={'amenity':'restaurant'})
road = ox.graph.graph_from_address('Centrum, Rotterdam')
fig, ax = plt.subplots(figsize=(10,10),dpi=120)
ox.plot.plot_footprints(amenity,ax=ax,color='red',edge_color='green',edge_linewidth=1,show=False, close=False)
ox.plot.plot_graph(road, ax=ax, node_color='#696969', node_size = 5, edge_color='#A9A9A9', show=False, close=False)
plt.show()
When using tags={'amenity':True}
, I get the following output:
...which shows fewer amenities than I expected, considering the density of restaurants, cafes etc. in the city.
When specifying and using tags={'amenity':restaurant'}
I get the following output:
No results with the exception of a restaurant in the lower right, despite the abundance of restaurants in this part of the city (this can be verified by looking up the city in OSM).
Trying other cities, I get similar results. For some reason, amenities from OSM don't seem to appear on my plots. Have I made an error in my approach?
ox.plot.plot_footprints plots polygons and multipolygons whereas osm restaurant amenities are points. When one plots the latter with a straight geopandas.plot() all seems to work fine -- see working example below
fig, ax = plt.subplots(figsize=(10,10),dpi=120)
place = 'centrum, Rotterdam,Netherlands'
amenity = ox.features.features_from_place(place, tags={'amenity':'restaurant'})
roads = ox.graph.graph_from_address(place)
buildings = ox.features_from_place(place, tags = {"building": True})
ox.plot.plot_footprints(buildings, ax=ax,color='red',edge_color='green',edge_linewidth=1,show=False, close=False)
ox.plot.plot_graph(roads, ax=ax, node_color='#696969', node_size = 5, edge_color='#A9A9A9', show=False, close=False)
amenity.plot(ax=ax,color='blue')
plt.show()
``