openstreetmap / openstreetmap-website

The Rails application that powers OpenStreetMap
https://www.openstreetmap.org/
GNU General Public License v2.0
2.17k stars 914 forks source link

Map Data overlay should not zoom by itself #3360

Open hungerburg opened 2 years ago

hungerburg commented 2 years ago

When map data overlay is on, clicking an item, that extends beyond the viewport, will make the map zoom out to show its full extent. If the item is big, this will make the browser window freeze and then report an error.

Please do not zoom - users can do that themselves, they may prefer to pan a bit, it should be their choice. There might be good intentions behind that auto-zoom, yet the result is often not wished for.

tomhughes commented 2 years ago

Just panning could be very confusing though - if the object is larger than the current viewport then we might pan so that no part of it is actually visible because it surrounds the viewport without actually crossing it in any way.

The window shouldn't be freezing though because if the zoom gets too low then we disable to data layer to avoid trying to display huge amounts of data - it sounds like the threshold for that might need adjusting but as you haven't provided an example it's hard to evaluate the best solution.

hungerburg commented 2 years ago

I'd say, the script should not mess with zoom, neither should it pan. In a densely mapped area, even changing from z19 to z18 will result in lots of stuff being downloaded, during the download, the page is frozen. Hitting by accident a 500m segment of a street will make it zoom to z17 with even longer stall, or even z16, where after several seconds the page shows the "slow down" warning. Not to mention, the overlay in these zoom levels covers parts of the map in a way to make it practically hidden, not much use of the feature then, in urban area, at least.

Not zooming/panning also will always result in the selected item being inside of the viewport :)

mmd-osm commented 2 years ago

A side note regarding the freezing: we're still requesting XML version of the /map call, which adds quite some overhead due to DOM parsing and subsequent Garbage collection in the browser. Now that JSON format is also available, it might be an idea to switch to JSON format. Maybe a topic for another issue...

si-the-pie commented 3 months ago

The automatic zoom-on-select is a barrier to freely exploring the overlayed map data.

For instance when analyzing which ways have what tags the map needs to be at a high zoom level to resolve which way to click on. E.g. this can happen when a bridleway or other path is very close (within a couple of metres) to a district boundary. If the way for the district boundary is mistakenly clicked on (during seeking of the bridleway / path component ways) there's a moment of resignation and a frustrating pause while the map zooms out to the district boundary and a short wait to be advised to zoom back in because there's now too much data!

One way to mitigate this problem might be to have the option of suppressing the zooming behaviour by holding down a shift or control key during the mouse click that selects an overlay.

Another method might be to turn off the default zoom behaviour and instead add a zoom-object-into-view button on the side panel for the selected node/ way / relation.