1

I did a query to look for certain things. However it only outputs the lat and long coordinates, there is no city data available. I'd like to have the city it belongs to / closest city though.

I know there are websites where I can convert a single coordinate to a city. But since my initial output consist of hundreds of elements, is there a way to alter the query to convert it to the closest city in the first place?

1
  • 1
    Overpass API is not a geocoder, use e.g. Nominatim for this purpose.
    – mmd
    Nov 25, 2017 at 8:31

1 Answer 1

2

You can use the CSV output format specify the tags you want to retrieve in the output, for example:

[out:csv("ISO3166-1","name")];
 ...
out; 

Combine this with a radius search:

[out:csv("name")];
(
  node(around:100000.0,50.75,6.05)["place"="city"];
  node(around:100000.0,55.75,7.05)["place"="city"];
);
(._;>;);
out; 

The number 100000 here depicts the radius in meters around a coordinate, the output is this:

name
Köln
Esbjerg
Moers
Bonn
Maastricht
Eindhoven
Aachen
Krefeld
... and a few more ...

As far as I can tell there is no "nearest" operator in the Overpass API though, so this may not be exactly what you want.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.