NOTICE: help.openstreetmap.org is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum

Hi,

I need the following: I'm searching for restaurants around "95448 Bayreuth" (Germany) 1000 meters.

This is what I got so far, it works nearly, but it shows also restaurants outside the 1000 meters radius:

[out:json][timeout:25];
// fetch area "Bonn" to search in
{{geocodeArea:95448 Bayreuth}}->.searchArea;
// gather results
(
  // query part for: "restaurant"
  node(around:1000)["amenity"="restaurant"](area.searchArea);
  way["amenity"="restaurant"](area.searchArea);
  relation["amenity"="restaurant"](area.searchArea);
);
// print results
out body;
>;
out skel qt;

May you help me with that, please?

asked 10 Jul '21, 16:28

alpham8's gravatar image

alpham8
26225
accept rate: 0%

edited 10 Jul '21, 16:37

Please clarify what you mean by 95448 Bayreuth as that is a boundary. {{geocodeArea:95448 Bayreuth}}; rel(pivot); out geom;

(10 Jul '21, 19:59) DaveF

There are a number of issues with your search:

  1. You are searching for all restaurants mapped as a node which are in the entire Gemeinde of Bayreuth + those 1000 m outside that boundary. You need to find the node representing the centre of Bayreuth not the area.
  2. Additionally you are finding any Restaurants mapped as areas within (but not outside) Bayreuth (the around constraint is not applied to ways & areas.

This appears to be closer to what you want:

[out:json][timeout:25];
// gather results
(
  // query part for: “name=Bayreuth”
  node["name"="Bayreuth"][place]->.a;
  nwr(around.a:1000)[amenity=restaurant];
);
// print results
out body;
>;
out skel qt;

The place node for Bayreuth is places in a result set & that set is searched for restaurants within 1000 m. If there is more than one place with the name other approaches may be needed.

permanent link

answered 10 Jul '21, 19:34

SK53's gravatar image

SK53 ♦
28.1k48268433
accept rate: 22%

If you want all restaurants within the boundary of Bayreuth:

{{geocodeArea:95448 Bayreuth}}->.Bayreuth;
rel(pivot.Bayreuth);
out geom;
nwr[amenity=restaurant](area.Bayreuth); 
out center;

If you want all restaurants around the node of the town.

node[place][name=Bayreuth];
nwr(around:1000)[amenity=restaurant];
out center;
permanent link

answered 10 Jul '21, 20:15

DaveF's gravatar image

DaveF
3.3k8498133
accept rate: 16%

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×483
×228
×16

question asked: 10 Jul '21, 16:28

question was seen: 1,451 times

last updated: 10 Jul '21, 20:17

NOTICE: help.openstreetmap.org is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum