pois = {}
// POI ways
poi_ways = {}
// A list of POI relations
relations = []
for result in responses["elements"]:
if result["type"] == "node" and "tags" in result:
poi = parse_osm_node(response=result)
pois[result["id"]] = poi
elif result["type"] == "way":
// Parse POI area Polygon
poi_area = parse_osm_way(vertices=vertices, response=result)
if poi_area:
poi_ways[result["id"]] = poi_area
elif result["type"] == "relation":
// Add relation to a relation list (needs to be parsed after all nodes and ways have been parsed)
relations.append(result)
// Create GeoDataFrames
gdf_nodes = gpd.GeoDataFrame(pois).T
gdf_nodes.crs = {"init": "epsg:4326"}
gdf_ways = gpd.GeoDataFrame(poi_ways).T
gdf_ways.crs = {"init": "epsg:4326"}
// Parse relations (MultiPolygons) from "ways"
gdf_ways = parse_osm_relations(relations=relations, osm_way_df=gdf_ways)
return (gdf_nodes, gdf_ways)
def pois_from_point(point, distance=None, amenities=None, retain_invalid=False):