Display city limits in addition to search results?

Hello,

Title says it all: Is there a way to display a city’s administrative limits in addition to search results?

The following doesn’t cut it:

[out:json][timeout:120];

rel(123);
map_to_area -> .searchArea;

(
rel(123);

nw[amenity=cafe](area.searchArea);
);

out center;

Cheers,

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)

I hope this helps!

Because the last part was missing :slight_smile:

Is it possible to display 1) cafés and 2) an administrative boundary?

You can. Try something like amenity=cafe + boundary=administrative (of course, converted to “the Overpass language”).

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.

[out:json][timeout:25];

rel(9764349);
map_to_area -> .searchArea;

(
  rel(9764349);
  nwr["amenity"="cafe"](area.searchArea);
);

out geom;

Another option is to use a different set of tiles as the background in Overpass Turbo. For example if I set this:

with this query I get this:

This depends of course on you finding a tileset that shows the data (including boundaries) that you want to see (or you could create it yourself!)

Another option is to use a different set of tiles as the background in Overpass Turbo. For example if I set this:

Why would I do that?

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!