Using OSMNX to retrieve nearby points of interest

Viewed 1821

hoping someone can help me?

In summary, I am trying to retrieve nearby points of interest based on a set of given coordinates.

After doing some research, I found a neat function

osmnx.pois.pois_from_point(point, distance=None, amenities=None, custom_settings=None)

That works for pubs, restaurants etc.

However, hotels are not classified amenities, and nor are any other tourism related places.

I found that those are identified with tourism:hotel key/value pair.

Does anyone have an idea of how to retrieve those? I didn't seem to find a function which accepts tourism as a parameter to pass in, nor I could find any way to pass in customer attribute values for filtering.

Thanks in advance!

1 Answers

This is now possible with the latest release (v0.13.0) of OSMnx. The pois module's functions now take a flexible tags argument to query for any points of interest. See the documentation. This code snippet retrieves restaurants, pubs, and hotels around downtown LA:

import osmnx as ox
ox.config(log_console=True, use_cache=True)

tags = {'amenity': ['restaurant', 'pub', 'hotel'],
        'building': 'hotel',
        'tourism': 'hotel'}
gdf = ox.pois_from_point(point=(34.0483, -118.2531), dist=500, tags=tags)
gdf.shape #(109, 59)
Related