-1

hoping someone can help me

I am trying to retrieve the exterior coordinates of the nearest building given a coordinate/geolocalization.

I can get all external coordinates of a building giving an address (code below) but I would need to retrieve same information, now giving a coordinate/geolocalization.

For example, I would need to get the external coordinates of the building located at this point with lat/long: 53.2588051, -2.124499.

import osmnx as ox

tesco = ox.geocode_to_gdf('Tesco, Exchange Street, SK11 6UZ, Macclesfield, Cheshire, GB')
polygon = tesco.iloc[0]['geometry']
polygon.exterior.coords
list(polygon.exterior.coords)

I tried using method "ox.pois_from_point" but I get error: AttributeError: module 'osmnx' has no attribute 'pois_from_point'

Many thanks in advance!

Ana
  • 103
  • 1
  • 8
  • 1
    Similar to https://stackoverflow.com/a/69576705/7321942. There is no `pois_from_point` function. Use the `geometries` module. See the linked answer and the user [reference](https://osmnx.readthedocs.io/en/stable/osmnx.html). – gboeing Nov 04 '21 at 16:11
  • Thanks, I will publish the code in case useful for someone – Ana Nov 04 '21 at 17:08

1 Answers1

0
import osmnx as ox

tags = {'building': True} # would return all building footprints in the area
center_point = (53.2588051, -2.124499)

a = ox.geometries.geometries_from_point(center_point, tags, dist=20)
polygon = a.iloc[0]['geometry']
polygon.exterior.coords
list(polygon.exterior.coords)
Ana
  • 103
  • 1
  • 8