OpenStreetMap logo OpenStreetMap

Airports worldwide ?

Posted by Aubanel on 22 March 2011 in English.

Just wanted to share a couple of scripts I have written today, that I do use to retreive osm airport data from a IATA code.



#!/bin/bash

https://wiki.openstreetmap.org/wiki/Tag:EXPECTED_ARGS=1
https://wiki.openstreetmap.org/wiki/Tag:E_BADARGS=65

if [ $# -ne $EXPECTED_ARGS ]
then
echo "Usage: `basename $0` "
exit $E_BADARGS
fi

https://wiki.openstreetmap.org/wiki/Tag:H=0.1
https://wiki.openstreetmap.org/wiki/Tag:BBOX=$(curl 'nominatim.openstreetmap.org/search?q='${https://wiki.openstreetmap.org/wiki/Tag:1}'&format=xml' | xmlstarlet sel -t -m "/searchresults/place" -v "https://www.openstreetmap.org/user/lon - ${H}" -o "," -v "https://www.openstreetmap.org/user/lat - ${H}" -o "," -v "https://www.openstreetmap.org/user/lon+${H}" -o "," -v "https://www.openstreetmap.org/user/lat+${H}" -n | head -n 1)
curl 'http://jxapi.openstreetmap.org/xapi/api/0.6/*\https://wiki.openstreetmap.org/wiki/Key:[https://wiki.openstreetmap.org/wiki/Tag:aeroway\]\[bbox='${BBOX}'\]' -o ${1}.osm


Simple and efficient, I do love open APIs !
Thank you OSM !
(note : you will need curl and xmlstarlet)

Email icon Bluesky Icon Facebook Icon LinkedIn Icon Mastodon Icon Telegram Icon X Icon

Discussion

Log in to leave a comment