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

Wizard query with trailing newline results in a broken Overpass query #609

Closed
i-ky opened this issue Dec 30, 2022 · 1 comment
Closed

Wizard query with trailing newline results in a broken Overpass query #609

i-ky opened this issue Dec 30, 2022 · 1 comment
Labels

Comments

@i-ky
Copy link

i-ky commented Dec 30, 2022

Long story short, when passing Wizard query with trailing newline as URL parameter, newline is treated as part of area name.
For example, https://overpass-turbo.eu/?w=addr%3Astreet%3D%22T%C4%81lival%C5%BEa%20iela%22%20in%20Riga%0A results in the following Overpass query:

/*
This has been generated by the overpass-turbo wizard.
The original search was:
“addr:street="Tālivalža iela" in Riga\n”
*/
[out:json][timeout:25];
// fetch area “Riga
” to search in
{{geocodeArea:Riga
}}->.searchArea;
// gather results
(
  // query part for: “"addr:street"="Tālivalža iela"”
  node["addr:street"="Tālivalža iela"](area.searchArea);
  way["addr:street"="Tālivalža iela"](area.searchArea);
  relation["addr:street"="Tālivalža iela"](area.searchArea);
);
// print results
out body;
>;
out skel qt;

First of all, single line comment is broken:

// fetch area “Riga
” to search in

Secondly, area lookup is broken too:

{{geocodeArea:Riga
}}->.searchArea;

The problem does not occur if Wizard query is entered via UI. I suppose, input form trims newline in this case.

Now some background. My goal is to use overpass-turbo as a Code Playground for Zulip chat.

The links for opening code playgrounds are always constructed by concatenating the provided URL prefix with the URL-encoded contents of the code block.

In this case prefix is https://overpass-turbo.eu/?w= and the rest is an URL-encoded content of code block Zulip user typed in their message:

```wizard
addr:street="Tālivalža iela" in Riga
```

Zulip's Code Playgrounds only work with code blocks and Markdown code blocks always end with a newline. I have no control over what is URL-encoded, therefore I cannot trim the newline on my side. There are workarounds, e.g. quoting area name or adding a trailing space at the end of Wizard query, but this is not user-friendly and also consistency between Wizard UI and Code Playground in Zulip is lost. It would be very nice if overpass-turbo could trim newline from w= parameter value.

@simon04 simon04 closed this as completed in 59d2aa8 Jan 8, 2023
@simon04
Copy link
Collaborator

simon04 commented Jan 8, 2023

Live on https://tyrasd.github.io/overpass-turbo/ – latest version

@simon04 simon04 added the bug label Jan 28, 2023
erictheise pushed a commit to OpenHistoricalMap/overpass-turbo that referenced this issue Jan 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants