I am using the following query to get all the airports in Manitoba that have an IATA or ICAO code associated with them (maybe not the most efficient code, so feel free to suggest something better):

[out:json][timeout:25];
area["name"="Manitoba"]->.a;

(
  node(area.a)["aeroway"="aerodrome"]["iata"];
  way(area.a)["aeroway"="aerodrome"]["iata"];
  relation(area.a)["aeroway"="aerodrome"]["iata"];

  node(area.a)["aeroway"="aerodrome"]["icao"];
  way(area.a)["aeroway"="aerodrome"]["icao"];
  relation(area.a)["aeroway"="aerodrome"]["icao"];
)->.airports;

.airports out center;

What I'd like to do now is, for each of those airports, find the nearest city (or town or whatever) to the airport. How can I do that? The end result would ideally be some JSON structure that gave me something like the following:

[
  {
    "id": 7932149,
    "center": {
      "lat": 49.9104284,
      "lon": -97.2381871
    },
    "iata": "YWG",
    "icao": "CYWG",
    "name": "Winnipeg James Armstrong Richardson International Airport",
    "nearest_city": {
      "id": "123456",
      "name": "Winnipeg",
      "center": {
        "lat": 49.9,
        "lon": -97.0,
      },
      "admin_level": 8,
      "type": "city"
    }
  },
  ... more entries ...
]

asked 06 Jun, 18:10

cviebrock_ppn's gravatar image

cviebrock_ppn
1112
accept rate: 0%

Did you find a solutions for this?

(12 Sep, 13:59) Javisst
Be the first one to answer this question!
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×352
×18
×13
×3

question asked: 06 Jun, 18:10

question was seen: 216 times

last updated: 12 Sep, 14:39

powered by OSQA