tyrasd / overpass-turbo

A web based data mining tool for OpenStreetMap using the Overpass API.
https://overpass-turbo.eu
Other
938 stars 134 forks source link

Work around troube caused by [ in export URL of interactive map #149

Open krichter722 opened 9 years ago

krichter722 commented 9 years ago

The exported URL of an interactive map contains [ which causes the mail clients thunderbird 31.5.0 and K9mail 5.004 (both some important mail clients in the FLOSS world) to skip recognition of the URL at the first encounter of [, e.g. the exported link

http://overpass-turbo.eu/map.html?Q=%2F*%0AThis%20query%20looks%20for%20nodes%2C%20ways%20and%20relations%20%0Awith%20the%20given%20key%2Fvalue%20combination.%0AChoose%20your%20region%20and%20hit%20the%20Run%20button%20above!%0A*%2F%0A[out%3Ajson][timeout%3A25]%3B%0A%2F%2F%20gather%20results%0A%28%0A%20%20%2F%2F%20query%20part%20for%3A%20%E2%80%9Cshop%3Dbicycle%E2%80%9D%0A%20%20node[%22shop%22%3D%22bicycle%22]%2852.5199813445422%2C13.425893783569336%2C52.54274626853559%2C13.456578254699707%29%3B%0A%20%20way[%22shop%22%3D%22bicycle%22]%2852.5199813445422%2C13.425893783569336%2C52.54274626853559%2C13.456578254699707%29%3B%0A%20%20relation[%22shop%22%3D%22bicycle%22]%2852.5199813445422%2C13.425893783569336%2C52.54274626853559%2C13.456578254699707%29%3B%0A%29%3B%0A%2F%2F%20print%20results%0Aout%20body%3B%0A%3E%3B%0Aout%20skel%20qt%3B

is recognized as

http://overpass-turbo.eu/map.html?Q=%2F*%0AThis%20query%20looks%20for%20nodes%2C%20ways%20and%20relations%20%0Awith%20the%20given%20key%2Fvalue%20combination.%0AChoose%20your%20region%20and%20hit%20the%20Run%20button%20above!%0A*%2F%0A

in both clients. I don't know about the specification of URL escaping which is used by either of thunderbird, K9mail or overpass-turbo, so I don't want to say someone is doing something wrong. I just think it'd be nice to work around it by adjusting the URL generation in overpass-turbo.

tyrasd commented 9 years ago

Hm. Can't reproduce this. In Firefox as well as Chrome exported links (e.g. the interactive map) don't include raw [ or ] characters. Which browser are you using?

krichter722 commented 9 years ago

The link above has been exported with firefox 36.0.1 on Ubuntu 14.10 amd64. In chromium-browser the exported link for the very same rectangle and query is

http://overpass-turbo.eu/map.html?Q=%2F*%0AThis%20query%20looks%20for%20nodes%2C%20ways%20and%20relations%20%0Awith%20the%20given%20key%2Fvalue%20combination.%0AChoose%20your%20region%20and%20hit%20the%20Run%20button%20above!%0A*%2F%0A%5Bout%3Ajson%5D%5Btimeout%3A25%5D%3B%0A%2F%2F%20gather%20results%0A(%0A%20%20%2F%2F%20query%20part%20for%3A%20%E2%80%9Cshop%3Dbicycle%E2%80%9D%0A%20%20node%5B%22shop%22%3D%22bicycle%22%5D(52.52016413747981%2C13.418855667114256%2C52.5439729418915%2C13.456921577453612)%3B%0A%20%20way%5B%22shop%22%3D%22bicycle%22%5D(52.52016413747981%2C13.418855667114256%2C52.5439729418915%2C13.456921577453612)%3B%0A%20%20relation%5B%22shop%22%3D%22bicycle%22%5D(52.52016413747981%2C13.418855667114256%2C52.5439729418915%2C13.456921577453612)%3B%0A)%3B%0A%2F%2F%20print%20results%0Aout%20body%3B%0A%3E%3B%0Aout%20skel%20qt%3B%0A

which is fine. So, it might be a firefox issue. Why is there a difference? The query was

/*
This query looks for nodes, ways and relations 
with the given key/value combination.
Choose your region and hit the Run button above!
*/
[out:json][timeout:25];
// gather results
(
  // query part for: “shop=bicycle”
  node["shop"="bicycle"]({{bbox}});
  way["shop"="bicycle"]({{bbox}});
  relation["shop"="bicycle"]({{bbox}});
);
// print results
out body;
>;
out skel qt;
tyrasd commented 9 years ago

If you use the "copy link location" in the right click menu of the export option, the link doesn't have the brackets? I don't know why firefox does this kind of stupid URL-decoding-reencoding when copying from the address bar. There's nothing one can do about it as a web developer, unfortunately. :(

krichter722 commented 9 years ago

Using the "copy link location" button works. It's definitely a firefox issue. Due to the fact that it is quiet popular, would you agree to add a warning (about the discovered issue in 36.0.1 and possibly other versions).

I will look into filing a firefox bug and try to remember linking it here.