How to extract context for places in Overpass

Hi,

As part of our effort to add Bahasa Melayu languages to the 3 Southern border provinces I’m preparing an overpass query to extract out places to put in a CSV file using the following query (link):

[out:csv(::id, ::type, place, name, official_name, "name:th", "name:mfa", "name:mfa-Arab", "name:mfa-Latn", "name:mfa-Thai")];
// fetch area “Pattani” to search in
(
  {{geocodeArea:Pattani}};
  {{geocodeArea:Yala}};
  {{geocodeArea:Narathiwat}};

)->.searchArea;
// gather results
(
  // query part for: “place=*”
  node["place"](area.searchArea);
  way["place"](area.searchArea);
);


// print results
out meta;/*fixed by auto repair*/
>;
out meta qt;/*fixed by auto repair*/

The issue with this is that some village names are not unique and the volunteer translators don’t know what we’re talking about, so I would like to provide some context. One idea is to use the guide in https://wiki.openstreetmap.org/wiki/Overpass_API/Overpass_API_by_Example#Adding_geocoding_details_to_POIs to add some context, another is to make the node id clickable links to OSM so people can see for themselves. Ideally we may use both methods, however with the geocoding one I’ve faced a problem where the query runs for a very long time and abruptly stops working. Does anyone know how to make it work or recommend alternatives?

(cross posted from Users:Thailand)

Best Regards
Mishari

The wiki page you’ve quoted uses the “is_in” statement to find out which areas your node is in. Due to a bug, this statement results in an endless loop for some of your nodes (in particular https://www.openstreetmap.org/node/1192389996)).

I’ve created the following bug report: https://github.com/drolbr/Overpass-API/issues/670

I tried this now on an instance, where the bug no longer occurs using the following query https://overpass-turbo.eu/s/1jqr

To make validating the results a bit easier for you, I have uploaded an XML version here: https://gist.github.com/mmd-osm/ad3bedfbfaebbab24dfff77eabc52d1d

Does that look ok to you?

This is a great starting point for me, thank you :slight_smile: