5

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!

Rossy
  • 51
  • 1
  • 2
  • This part of the osmnx API is just broken :( Not all POIs are categorized as amenities in OSM. I have no experience with osmnx but maybe you can use `osmnx.core.osm_net_download()` instead with `infrastructure='node["tourism"="hotel"]'`? – scai May 07 '20 at 13:38
  • The OSMnx points of interest (pois) module was originally designed to query OSM amenities and produce a geopandas GeoDataFrame. It is being generalized to query for all points of interest, amenity or otherwise, in https://github.com/gboeing/osmnx/pull/342 Comments/contributions are welcome there while it's in development. – gboeing May 07 '20 at 16:46

1 Answers1

3

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)
gboeing
  • 5,691
  • 2
  • 15
  • 41
  • 2
    `osmnx.pois.pois_from_point()` has become obsolete. POI can be retrieved using `osmnx.geometries.geometries_from_point()`, see https://osmnx.readthedocs.io/en/stable/osmnx.html#module-osmnx.pois – marianoju Aug 25 '21 at 17:10