I've been reading up on Overpass syntax and I think I get the basics. For example, let's say I want to get the IDs and coordinates of every town in Andorra that OSM has a record of:


This is great for keeping the data stream light -- say, if you're targeting smartphones and are trying to be conscious of data plan costs.

Now, what if I just want to get the "name" tag of each of these towns in addition to the ID and center? I know how to get all of the tags -- just add " tags" right before the final semicolon -- but that gives me a whole bunch of tags I don't want and a bloaty data stream.

Does anyone know whether/how one can selectively include tags in the Overpass output stream?

That is, not filtering nodes by tag but rather filtering tags by tag name.

  • Since v0.7.54 wiki.openstreetmap.org/wiki/Overpass_API/… Restrict tag lists of objects As it converts elements, each type appears to have to be listed separately: [bbox:{{bbox}}]; node[amenity=restaurant]; convert node name=t["name"],cuisine=t["cuisine"]; out; way[amenity=restaurant]; convert way name=t["name"],cuisine=t["cuisine"]; out; rel[amenity=restaurant]; convert rel name=t["name"],cuisine=t["cuisine"]; out; is there a way to simplify this?
    – DaveF
    Commented Apr 2, 2019 at 10:42
  • If you have a new question, please ask it by clicking the Ask Question button. Include a link to this question if it helps provide context. - From Review
    – aldo_tapia
    Commented Apr 2, 2019 at 11:43
  • @aldo_tapia I was answering a question. In addendum to that I was querying whether there was a better solution. Do you have the required knowledge to provide a better solution for others to use?
    – DaveF
    Commented Apr 2, 2019 at 11:55
  • Please do not ask questions in Answers. You can state that you're looking for a way to further simplify, but if you start asking questions it looks like an "I have this problem too" situation and your answer may be deleted.
    – Vince
    Commented Apr 2, 2019 at 13:22
  • This does not provide an answer to the question. Once you have sufficient reputation you will be able to comment on any post; instead, provide answers that don't require clarification from the asker. - From Review Commented Apr 2, 2019 at 13:35

2 Answers 2


You can easily achieve this via CSV output. Read more about it in the Overpass QL documentation.

[out:csv(::id, ::lat, ::lon, name)];
out center;

Try it out: http://overpass-turbo.eu/s/qag

  • Thanks, @mmd! This works. I would certainly prefer working with JSON over CSV, but I didn't mention that in the prompt. Do you know if there's currently any way to do this and have Overpass output JSON? Commented Jul 4, 2017 at 22:36
  • I thought about Json as well, but the approach via convert doesn't support geometry yet and without center point your query result is probably not that useful. This will be available in a future release only.
    – mmd
    Commented Jul 5, 2017 at 4:34

You can use the convert method to produce your output. From the Ovepass QL documentation:

After that, an arbitrary number of tags can be set. In addition, it can be specified to copy all keys from the originating object. In this case, it is also possible to selectively suppress some tags.

Example from their home page:


node[start_date]; // find all nodes in current bounding box with start_date tag

convert elem     // convert nodes from inputset to <elem> 
    ::id = id(), // keeping the node id value
      original_date = t[start_date], // value as found in start_date tag
    normalized_date = date(t[start_date]), // start_date converted to numeric value
    is_date = is_date(t[start_date]);     // is start_date a recognized date?


Your Answer

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

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