Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow Overpass Turbo features in Overpass query #256

Closed
rmikke opened this issue Mar 29, 2018 · 12 comments
Closed

Allow Overpass Turbo features in Overpass query #256

rmikke opened this issue Mar 29, 2018 · 12 comments
Labels
enhancement New feature or request fixed in develop Issue is fixed in the develop branch
Milestone

Comments

@rmikke
Copy link

rmikke commented Mar 29, 2018

Overpass query:

[out:json][timeout:900];
(
{{geocodeArea:"Polska"}};
)->.myArea;
(
  node["amenity"="pharmacy"][!"opening_hours"](area.myArea);
  way["amenity"="pharmacy"][!"opening_hours"](area.myArea);
  relation["amenity"="pharmacy"][!"opening_hours"](area.myArea);
);
out center;

returns:
Error message

@mvexel
Copy link
Member

mvexel commented Mar 29, 2018

{{geocodeArea}} is an Overpass Turbo feature, I believe. Can you try with this query?

@rmikke
Copy link
Author

rmikke commented Mar 29, 2018

Yup, that seems to work. At least it's building tasks now. :)

But woudn't it be good to be able to just copy any query from Overpass Turbo? E.g. JOSM has no problem with {{geocodeArea}}, so it should be possible.

Any such problem will stop 80% of new users from creating a challenge.

Will you treat as a feature request?

@rmikke rmikke changed the title Overpass interpreter seems to not understand geocodeArea Allow Overpass Turbo features in Overpass query Mar 29, 2018
@mvexel
Copy link
Member

mvexel commented Mar 29, 2018

I didn't know that Turbo features could be used outside of Turbo! @mmd-osm @tyrasd can you shed light on how that works?

We'll look into it. Thanks for changing the title for me :)

@mvexel mvexel added the enhancement New feature or request label Mar 29, 2018
@mmd-osm
Copy link

mmd-osm commented Mar 29, 2018

You could use Export —> query —> copy standalone query, which automatically replaces those moustache tags for you.

Josm has reimplemented the same logic in Java, afaik. Otherwise {{}} Syntax is not something Overpass API understands on its own.

@mvexel
Copy link
Member

mvexel commented Mar 29, 2018

"Moustache tags" :D

Thanks @mmd-osm

@mmd-osm
Copy link

mmd-osm commented Mar 29, 2018

Ah that was the french spelling... should be like in here http://mustache.github.io/

@mvexel
Copy link
Member

mvexel commented Mar 29, 2018

So we could improve the instructions on the relevant Challenge wizard page to say that if you're using Overpass Turbo:

  1. Prepare and test query in Overpass Turbo
  2. Use Export --> Query --> Standalone --> Copy as standalone query (this does not seem to work in Safari)
  3. Copy the query into the text box below.

On top of that we could add some simple regex detection \{{2}[^\}]+\}{2} and trigger a notice when folks try to submit a query with moustache tags. What do you think, would that work as a solution, @rmikke ?

@mvexel
Copy link
Member

mvexel commented Mar 29, 2018

@mmd-osm no no I wasn't making fun of the spelling, I just thought it was a really funny name for these types of placeholder tags!

@rmikke
Copy link
Author

rmikke commented Mar 30, 2018

It would be better to accept Overpass Turbo syntax, especially if exporting standalone query not always works (the Safari case) but if it's not possible or too hard, then yes, instruction and detection is acceptable solution, as long as it tells the user what to do instead of leaving him with a cryptic error message.

@mmd-osm
Copy link

mmd-osm commented Mar 30, 2018

Overpass Turbo syntax, especially if exporting standalone query not always works (the Safari case)

Copy as standalone query requires access to the clipboard. If that doesn't work for whatever reason, there's still Download as standalone query.

Here's a link to the respective JOSM implementation. {{geocodeArea}} also depends on additional Nominatim queries. So tons of work to get this up and running. As copy & pasting a query is like a one time activity when setting up a new challenge, it's probably best to simply check for {{ }} in the query. If needed, provide some instructions on how to generate a proper query.

@rmikke
Copy link
Author

rmikke commented Mar 30, 2018

As long as the user gets clear instructions, it's OK with me.

nrotstan added a commit that referenced this issue Apr 5, 2018
Basic validation of Overpass queries. Closes #256
@nrotstan nrotstan added the fixed in develop Issue is fixed in the develop branch label Apr 5, 2018
@nrotstan nrotstan added this to the beta.5 milestone Apr 5, 2018
@nrotstan
Copy link
Contributor

nrotstan commented Apr 5, 2018

With PR #289, an informative error message will be displayed if Overpass Turbo query shortcuts are used. It'll be in the beta.5 release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request fixed in develop Issue is fixed in the develop branch
Projects
None yet
Development

No branches or pull requests

4 participants