opendata-stuttgart / feinstaub-map

http://opendata-stuttgart.github.io/feinstaub-map/
153 stars 48 forks source link

Toggle for Betterplace donation overlay #73

Closed steampixel closed 5 years ago

steampixel commented 5 years ago

Hey,

the betterplace donation overlay is a great idea. But I think it would be cool to have an option to hide this overlay if someone embeds the map. At our store window we have a tiny luftdaten.info screen that rotates over several map positions in germany and our city. (https://github.com/steampixel/luftdaten-infoscreen) This is very usefull and informative for pedestrians. Unfortunality the betterplace button is very big on our little screen and just a little useless :-)

It would be great if we could have some configuration option via URL. Something like http://deutschland.maps.luftdaten.info/?nooverlay#7/51.944/10.327 or http://deutschland.maps.luftdaten.info/#7/51.944/10.327/nooverlay

I think this could be done in pure JavaScript. What do you think about this?

ricki-z commented 5 years ago

Hi @steampixel , I have published a new version that should work with the second url of your two examples. So you have to define zoom and location and then append "/nooverlay". Then the add shouldn't be shown.

steampixel commented 5 years ago

Awesome! Seems to work perfectly. I will try it out later on our little screen.

steampixel commented 5 years ago

Hm. There seems to be some kind of an issue with that. Try the following:

Just copy the following urls into your web browser one after another and hit enter (testet on Firefox and Chrome)

https://deutschland.maps.luftdaten.info/#13/49.7956/9.9636/nooverlay
https://deutschland.maps.luftdaten.info/#11/49.8014/10.0337/nooverlay
https://deutschland.maps.luftdaten.info/#9/49.5760/10.9591/nooverlay
https://deutschland.maps.luftdaten.info/#8/48.865/11.841/nooverlay
https://deutschland.maps.luftdaten.info/#5/50.732/10.745/nooverlay

The expected behavior should be, that the map should change its area and zoom. But with the /nooverlay option this works not consistently. Our infoscreen works by replacing the src attribute of an iframe to achive this.

ricki-z commented 5 years ago

I have changed the map again. It seems that we can't use the url hash for this. So the 'new' format for the 5 urls is: https://deutschland.maps.luftdaten.info/?nooverlay#13/49.7956/9.9636 https://deutschland.maps.luftdaten.info/?nooverlay#11/49.8014/10.0337 https://deutschland.maps.luftdaten.info/?nooverlay#9/49.5760/10.9591 https://deutschland.maps.luftdaten.info/?nooverlay#8/48.865/11.841 https://deutschland.maps.luftdaten.info/?nooverlay#5/50.732/10.745 (important: '?nooverlay' has to come before the zoom and position hash)

steampixel commented 5 years ago

Ok. Seems to work now :-) Thank you!

ricki-z commented 5 years ago

I have added a short description to the readme. If everything is working as expected please close the issue.