I’m not sure why you have amenity=cafe there unless it’s a placeholder.
For your purposes, I sadly don’t think that place=* nodes and type=boundary relations don’t share any tags in common. You can try this query (converted into “Overpass language,” of course):
place=city OR place=town + (border_type=city OR border_type=town) OR (boundary=administrative AND admin_level=8)
If you know the ID of the relation (which your example seems to imply) you could try something like this.
Note that using “out center” outputs the centroid of all outputs including the city, so doesn’t work if you want to display the boundary. I changed it to “out geom”. I also changed 123 to an administrative area I know exists.
There may well be better ways to do this (I don’t like the repetition of the rel() line), but it may be enough to get you started.
Note that using “out center” outputs the centroid of all outputs including the city, so doesn’t work if you want to display the boundary. I changed it to “out geom”. I also changed 123 to an administrative area I know exists.
I’m used to this because, when exporting results to a GPX, ways (building) aren’t legible in the smartphone app I use, so I need all POI’s to live as nodes.
But in this particular case, it wasn’t needed… and your code worked perfectly. Thank you!