This is a static archive of our old OpenStreetMap Help Site. Please post any new questions and answers at community.osm.org.

How to get the lat long polygon for a given airport

0

What I need to do is to get the bounding box polygon for all airports worldwide. The only way I'm aware of do this, is by using esy.osm.pbf. I've written the following code:

osm = esy.osm.pbf.File(file_path)
lat_lons = OrderedDict()
index = 0
print("There are " + str(len(airport.refs)) + " nodes to go through.")
for ref in airport.refs:
    print(str(index))
    index = index + 1
    nodes = [entry for entry in osm if entry.id == ref]
    lonlat = nodes[0].lonlat
    print(lonlat)
    print(type(lonlat[1]))
    print(type(lonlat[0]))
    lat_lons[ref] = ([lonlat[1], lonlat[0]])
return lat_lons

But it takes much too long to do this, that's just for a single airport, and I need to do it for all airports worldwide. Is there a better way of fetching the latitudes and longitudes for the polygons for all airports worldwide?

asked 20 May '21, 17:52

michaelnares's gravatar image

michaelnares
11112
accept rate: 0%


One Answer:

0

Nominatim can fetch bboxes. Old thread. You can test some limited areas and then build a batch or requests.

answered 25 May '21, 09:11

Cascafico's gravatar image

Cascafico
283202329
accept rate: 0%

Source code available on GitHub .