Modify

Opened 10 years ago

Closed 9 years ago

Last modified 13 months ago

#10893 closed defect (fixed)

How to make Overpass query

Reported by: bastiK Owned by: team
Priority: normal Milestone: 15.09
Component: Core Version:
Keywords: template_report, mirrored_download Cc:

Description

I'm having problems to query data with the Download from Overpass API ... feature.

The request:

/*
This has been generated by the overpass-turbo wizard.
The original search was:
“amenity=restaurant”
*/
[timeout:25];
// gather results
(
  // query part for: “amenity=restaurant”
  node["amenity"="restaurant"]({{bbox}});
  way["amenity"="restaurant"]({{bbox}});
  relation["amenity"="restaurant"]({{bbox}});
);
// print results
out meta;

The result is "The OSM server 'overpass-api.de' reported a bad request.". For other queries I get no error, but also no data.

It is possible to export the raw data in overpass turbo and open the resulting file in JOSM.

Repository Root: http://josm.openstreetmap.de/svn
Build-Date: 2014-12-27 04:29:30
Last Changed Author: Don-vip
Revision: 7896
Repository UUID: 0c6e7542-c601-0410-84e7-c038aed88b3b
Relative URL: ^/trunk
URL: http://josm.openstreetmap.de/svn/trunk
Last Changed Date: 2014-12-27 05:25:53 +0100 (Sat, 27 Dec 2014)
Last Changed Rev: 7896

Identification: JOSM/1.5 (7896 en) Linux Ubuntu 14.04.1 LTS
Memory Usage: 464 MB / 871 MB (148 MB allocated, but free)
Java version: 1.7.0_65, Oracle Corporation, OpenJDK 64-Bit Server VM
Java package: openjdk-7-jre:amd64-7u71-2.5.3-0ubuntu0.14.04.1
VM arguments: [-Djosm.restart=true, -Djosm.home=/home/paul/.josm-latest, -Djava.net.useSystemProxies=true]
Dataset consistency test: No problems found

Plugins:
- mirrored_download (30762)

Attachments (0)

Change History (9)

comment:1 by bastiK, 10 years ago

Summary: How to makeHow to make Overpass query

comment:2 by anonymous, 10 years ago

Here's the error message you get: basically {{bbox}} is syntactic sugar for overpass turbo, not for Overpass API. Overpass API has no idea what to do with {{bbox}}

The data included in this document is from www.openstreetmap.org. The data is made available under ODbL.

Error: line 6: parse error: Unknown type "["

Error: line 6: static error: For the attribute "type" of the element "query" the only allowed values are "node", "way", "relation" or "area".

Error: line 6: parse error: ';' expected - 'timeout' found.

Error: line 10: parse error: Unknown query clause

Error: line 10: parse error: ')' expected - '{' found.

Error: line 11: parse error: Unknown query clause

Error: line 11: parse error: ')' expected - '{' found.

Error: line 12: parse error: Unknown query clause

Error: line 12: parse error: ')' expected - '{' found.

comment:3 by anonymous, 10 years ago

BTW: you can try this alternative:

[timeout:25];
(
  node["amenity"="restaurant"](bbox);
  way["amenity"="restaurant"](bbox);>;
  relation["amenity"="restaurant"](bbox);>;
);
out meta;

comment:4 by bastiK, 10 years ago

Thanks! When I keep the comment at the top, I still get an error message:

line 6: parse error: Unknown type "["
line 6: static error: For the attribute "type" of the element "query" the only allowed values are "node", "way", "relation" or "area".
line 6: parse error: ; expected - timeout found.

Is this intended?

As I might not be the only one copying an Overpass Turbo query, can we have support for the {{bbox}} templates in JOSM?

comment:5 by mmd, 10 years ago

I believe the plugin doesn't realize that there's already a timeout setting around and simply adds an additional [timeout:15]; at the top of the query. With the semicolon at the end of this additional line, it's not allowed anymore to specify additional settings. [timeout:25]; is then treated as normal query instead of a setting. This doesn't make much sense, as there's no query of that type (as it's really part of the settings), hence the error message.

So what is really missing here is some logic to ignore any comments in the first place.

[timeout:15];
/*
This has been generated by the overpass-turbo wizard.
The original search was:
“amenity=restaurant”
*/
[timeout:25];
(
  node["amenity"="restaurant"](bbox);
  way["amenity"="restaurant"](bbox);>;
  relation["amenity"="restaurant"](bbox);>;
);
out meta;

comment:6 by mmd, 10 years ago

BTW: I think the normal use case these days is to model the query in turbo and then press Export -> JOSM. Manually copying the query doesn't seem to be the 90% case imho.

comment:7 by simon04, 9 years ago

Component: Plugin mirrored_downloadCore
Keywords: mirrored_download added
Owner: changed from roland.olbricht to team

mirrored_download is now part of core (see #11428)

comment:8 by simon04, 9 years ago

Milestone: 15.09
Resolution: fixed
Status: newclosed

As implemented in #11428, the Overpass download features now the Overpass turbo query wizard, which produces a correct query for amenity=restaurant.

comment:9 by anonymous, 13 months ago

“amenity=restaurant”
*/
[timeout:25];
(

node["amenity"="restaurant"](bbox);
way["amenity"="restaurant"](bbox);>;
relation["amenity"="restaurant"](bbox);>;

);
out meta;

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain team.
as The resolution will be set.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.