0

I have just learned about the overpass turbo service and its ability for querying data. I have tried the following query and it works fine:

[out:json][timeout:25];
(
node["highway"]({{bbox}});
);
out body;

But when I replace the bbox with a name of city which according to the wiki page of overpass it should be like below, the code gives an error. Would be glad to know what is the problem with the second code?

[out:json][timeout:25];
(
node["highway"]({{geocodeId: Vienna}});
);
out body;

error message:

An error occured during the execution of the overpass query! This is what overpass API returned: Error: line 3: parse error: Unknown query clause Error: line 3: parse error: ')' expected - 'node' found. Error: line 4: parse error: Unknown type ")" Error: line 4: parse error: An empty query is not allowed Error: line 4: parse error: Unknown type ";" Error: line 5: parse error: An empty query is not allowed

James Mc
  • 37
  • 1
  • 5

1 Answers1

2

As you want to query nodes in a certain area, you need to use the following syntax for overpass turbo:

[out:json][timeout:25];

{{geocodeArea:Vienna}}->.searchArea;
node["highway"](area.searchArea);
out body;
mmd
  • 3,423
  • 1
  • 16
  • 23
  • Thanks. It works. How about if we want to query based on the lat, lon input? for example we can define a bbox based on lat and long and use that bbox in the query? any help or link to guidlines about this would be highly appreciated. – James Mc May 17 '16 at 13:38
  • Take a look around on stackoverflow or GIS stackexchange: http://gis.stackexchange.com/questions/19760/how-do-i-calculate-the-bounding-box-for-given-a-distance-and-latitude-longitude – mmd May 18 '16 at 16:41
  • @mmd if i like to use cordinates like this [bbox:25.2670,51.5039,25.2906,51.5441] rather than VIENNA for example should i puth the cordinates inside the {geocodeArea:bbox} – noob Dec 18 '20 at 22:02