Modify

Opened 5 years ago

Closed 4 years ago

Last modified 4 years ago

#10861 closed enhancement (fixed)

Zoom to layer when opening new file

Reported by: bastiK Owned by: team
Priority: normal Milestone: 14.12
Component: Core Version:
Keywords: Cc:

Description

When a new file is opened, JOSM should zoom to the viewport of the new layer, rather than keeping the old view.

The current behavior is strange if the layer is completely off screen and usually you want to see what is opened.

Attachments (0)

Change History (16)

comment:1 Changed 5 years ago by bastiK

Resolution: fixed
Status: newclosed

In 7817/josm:

fixed #10861 - Zoom to layer when opening new file (see #10860)

comment:2 Changed 4 years ago by katpatuka

That's actually a very bad idea if you try to open an additional layer containing for example GNS place names of a country! With other words it takes minutes before the place name file for Indonesia opens! Try to open http://katpatuka.org/pub/osm/osm-id.7z, a 49 Mb file containing ~250.000 nodes (which easily opened in ver. 7777 when the first layer was at zoomlevel 15).

Now josm now has a real hard time to display 250.000 nodes!

comment:3 Changed 4 years ago by Don-vip

Maybe change zoom only if the new layer bounds do not contain the current ones?

comment:4 Changed 4 years ago by katpatuka

If new layer is one and only layer

do as is

else

if open layer count = 2

use zoomlevel of older layer

else

don't know

endif

endif

comment:5 Changed 4 years ago by katpatuka

Resolution: fixed
Status: closedreopened

so I reopen the ticket.

comment:6 Changed 4 years ago by bastiK

There are various workarounds:

(1) Open once, zoom in, save as session. Next time you open the session file, the initial zoom will be preserved.

(2) If it is impossible to open even a single time, then open a dummy file, save the session (.jos). Then remove the dummy file and replace if with the real one (same file name).

(3) Unrelated to sessions, but works only for .osm data files: Set a filter to hide everything. Then zoom in and disable the filter.

I realize, these strategies are sneaky and far from obvious, but so was your method to display a huge file by opening a small one first.

The current behavior is good for the average user and I would like to keep it this way in principle.

comment:7 in reply to:  3 Changed 4 years ago by bastiK

Resolution: fixed
Status: reopenedclosed

Replying to Don-vip:

Maybe change zoom only if the new layer bounds do not contain the current ones?

This means that JOSM will sometimes zoom to the layer and sometimes not. The user may be puzzled as this condition is not completely obvious. Intuitively, it would make more sense to keep the bounding box when the new layer bounds are completely within the current view.

Otherwise I think this would be an okay solution. Let's see if we get more feedback.

Last edited 4 years ago by bastiK (previous) (diff)

comment:8 in reply to:  4 Changed 4 years ago by bastiK

Replying to katpatuka:

If new layer is one and only layer

do as is

else

if open layer count = 2

use zoomlevel of older layer

else

don't know

endif

endif

This is basically a revert of [7817].

comment:9 in reply to:  6 ; Changed 4 years ago by katpatuka

Replying to bastiK:

There are various workarounds:

(1) Open once, zoom in, save as session. Next time you open the session file, the initial zoom will be preserved.

(2) If it is impossible to open even a single time, then open a dummy file, save the session (.jos). Then remove the dummy file and replace if with the real one (same file name).

(3) Unrelated to sessions, but works only for .osm data files: Set a filter to hide everything. Then zoom in and disable the filter.

I realize, these strategies are sneaky and far from obvious, but so was your method to display a huge file by opening a small one first.

The current behavior is good for the average user and I would like to keep it this way in principle.

What I actually do not understand is why someone wants to see the viewport of a new layer when opening it! For years now there exists keypress 2 to accomplish this if you need that feature!

Version 0, edited 4 years ago by katpatuka (next)

comment:10 in reply to:  9 Changed 4 years ago by bastiK

Replying to katpatuka:

What I actually do not understand is why someone wants to see the viewport of a new layer when opening it!

When you open a new layer, it is normal that you want to interact with it immediately. Especially the case where the new layer is completely out of view was strange as the mapview didn't change at all.

By the way workaround (1) does not work for me. Take some file (http://katpatuka.org/pub/osm/osm-my-hydro.7z contains ~30.000 GNS river names of Malaysia), open it (full viewport displays), select one node, keypress 3 zooms to node, save as session, close session, reopen session - what happens? Again full viewport displays.

Works for me. Please open a separate bug report (attach your session file).

Last edited 4 years ago by bastiK (previous) (diff)

comment:11 Changed 4 years ago by skyper

How about a new option to open a file in background ?

comment:12 Changed 4 years ago by katpatuka

For the records: someone suggested a workaround on irc channel to the problem which works fine: first activate Wireframe View before loading a 30.000-node .osm file (which I'd never used before...). Only dots are displayed without names then (having to display 30.000 node names in viewport makes josm slow). After that you can switch back to other layer, zoom down again and deactivate Wireframe View.

comment:13 Changed 4 years ago by richlv

i almost reported the new behaviour as a bug :)
(ended up reporting only a subset - zoom changed when converting - as ticket #11304).

i'd like to ask for reconsideration regarding this change. my reasoning is similar as katpatuka's - one can easily hit '2' to zoom to a layer, but getting back to the previous zoomlevel seems to be somewhere between complicated and impossible.

my usecase - having a gpx file open, zoomed in to some small section of it and wondering whether some other gpx file would cover that section, too. so i open that file. with 7777 and earlier i could see the same section and easily decide whether that was good. with recent versions... it's a complicated zoom/pan/zoom/whereisit.

note that when the zoom level is changed josm also starts downloading any imagery for the new zoom, which is a bit of a problem on slow/metered connections.

comment:14 in reply to:  13 Changed 4 years ago by bastiK

Replying to richlv:

i'd like to ask for reconsideration regarding this change. my reasoning is similar as katpatuka's - one can easily hit '2' to zoom to a layer, but getting back to the previous zoomlevel seems to be somewhere between complicated and impossible.

Simply hit '8' to get to the previous zoomlevel.

comment:15 Changed 4 years ago by richlv

ah, thanks - i still find the new behaviour inconvenient, but that shortcut helps a bit :)

comment:16 Changed 4 years ago by bastiK

This change is targeted at the average user and most common workflow. If you find one very rare corner case where the old behavior was more convenient, this is not a reason for me to revert. Especially when there is an obvious workaround.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain team.
as The resolution will be set.
The resolution will be deleted.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.