Search code examples
pythonopenstreetmaposmnx

Osmnx: How to retreive info on bus-stop info node, which is part of a highway?


I am trying to also show info of OpenStreetMap bus-stop node 439460636 (https://www.openstreetmap.org/node/439460636) which is part of a highway.

I am using Python3 Osmnx

Other POIs all show perfectly. Just not the ones which are not maped as a 'amenity'. (There are more examples)

I am using jupyter notebook for my analysis:

import osmnx as ox

# Retrieve POI shelters
place_name = 'Santa Clara, Santa Clara County, California, USA'
shelter = ox.pois_from_place(place_name, amenities=['shelter'])
cols = ['amenity', 'name', 'element_type', 'shelter_type',
       'building', 'network'
        ]
shelter[cols]
cols = ['amenity', 'name','element_type', 'shelter_type',
       'building', 'network'
        ]
shelter[cols].loc[(shelter['shelter_type'] == 'public_transport') ]
# Look bus-stop in highway
graph = ox.graph_from_place(place_name)
nodes, edges = ox.graph_to_gdfs(graph)
nodes.loc[(nodes['highway'] == 'bus_stop') ]

Overpass:

[out:json][timeout:25];
// gather results
(
  area[name="Santa Clara, Santa Clara County, California, USA"];
  node(area)["highway"="bus_stop"]({{bbox}});
);
// print results
out body;
>;
out skel qt;

The POI Kino (439460636) is not listed. The shelter right next to the POI is listed. The POI is in the middle of my area, so I do not understand how I can retreive the node info. Can you help?


Solution

  • Manually update Osmnx with the file linked in this post from chesterharvey. https://github.com/gboeing/osmnx/issues/116#issuecomment-439577495 Final testing of feature still incomplete!

    import osmnx as ox
    
    # Specify the name that is used to seach for the data
    place_name = "Santa Clara, Santa Clara County, California, USA"
    
    tags = {
        'amenity':True,
        'leisure':True,
        'landuse':['retail','commercial'],
        'highway':'bus_stop',
    }
    
    all_pois = ox.pois_from_place(place=place_name, tags=tags)
    
    all_pois.loc[(all_pois['highway'] == 'bus_stop')]