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

EXPECTED_ARGS=1
E_BADARGS=65

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

H=0.1
BBOX=$(curl 'nominatim.openstreetmap.org/search?q='${1}'&format=xml' | xmlstarlet sel -t -m "/searchresults/place" -v "@lon - ${H}" -o "," -v "@lat - ${H}" -o "," -v "@lon+${H}" -o "," -v "@lat+${H}" -n | head -n 1)
curl 'http://jxapi.openstreetmap.org/xapi/api/0.6/*\[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