Modify

Opened 12 years ago

Closed 11 years ago

Last modified 11 years ago

#7563 closed enhancement (fixed)

[Patch needs rework] WMS: Automatically change resolution when zooming

Reported by: simon04 Owned by: team
Priority: normal Milestone:
Component: Core imagery Version:
Keywords: wms resolution Cc:

Description

Currently, one has to manually change the resolution of WMS imagery fetched in the popup menu of the WMS layer after drastically changing the zoom level. This should be performed automatically.

The attached patch should be improved in the sense that "discrete" resolutions are used, i.e., to avoid having resolution 501 when 500 has been used earlier. Otherwise this would break WMS caching.

Attachments (3)

7563.patch (6.4 KB ) - added by simon04 12 years ago.
wms_auto_zoom.patch (8.0 KB ) - added by xeen 11 years ago.
wms_auto_zoom_v2.patch (8.9 KB ) - added by xeen 11 years ago.
the rounding was too simple, after all. In practice I regularly managed to create resolutions differing by only one meter. The updated patch now snaps the resolution to the same one as used for tile sources. It appears to work and since there is no fine tuning required, I will merge this in the next few days unless I encounter a show stopper.

Download all attachments as: .zip

Change History (17)

by simon04, 12 years ago

Attachment: 7563.patch added

comment:1 by bastiK, 12 years ago

Personally, I like to have control over the WMS resolution - maybe an option in the context menu of the imagery layer?

Also, there is often a known maximum resolution, so it would be a waste of bandwidth to query more detailed images.

comment:2 by simon04, 12 years ago

I guess, especially for beginners it's counter-intuitive that sometimes (depending on the zoom level when adding the layer) the imagery is very grainy and sometimes not. Therefore, I suggest to have the automatic mode as suggested by default with an option to to disable.

in reply to:  2 comment:3 by bastiK, 12 years ago

Replying to simon04:

I guess, especially for beginners it's counter-intuitive that sometimes (depending on the zoom level when adding the layer) the imagery is very grainy and sometimes not. Therefore, I suggest to have the automatic mode as suggested by default with an option to to disable.

Agreed, maybe we should also set WMS scale to next native slippy scale when (default) autozoom mode is active. This should improve caching, because you only ever have scales s, 2·s, 4·s, ..., where s is a global constant.

(Unrelated: When adding a TMS, we could also jump to the next native slippy map scale, so the images are no longer blurred.)

comment:4 by stoecker, 12 years ago

@simon04, bastiK: What is the status of this?

comment:5 by bastiK, 12 years ago

We still need a way to turn this feature off, e.g. an option "Automatically adapt resolution" in the context menu of the WMSLayer (may be activated by default).

comment:6 by stoecker, 12 years ago

Summary: [Patch] WMS: Automatically change resolution when zooming[Patch needs rework] WMS: Automatically change resolution when zooming

comment:7 by akks, 11 years ago

@simon04: What is the status of this patch?

comment:8 by simon04, 11 years ago

No updates from my side. I see the challange to not break the caching functionality, but I have little time to look into this atm. In addition, bastiK's suggestion to disable this feature is missing.

comment:9 by A_Pirard, 11 years ago

Just 2 €¢ idling in my pocket.
Basically, one does two things.
Map updates, for which high resolution is needed.
Navigation, for which the needed resolution is just enough to see where we are.
JOSM could rescale the lower resolution tiles down to the navigation resolution.
I'm satisfied with the two-resolution tile caching I use in a proxy serving JOSM.
That makes efficient caching.
Isn't the simplest option to understand and use to have two check marks:
1) lock high resolution here
2) lock low resolution here
Should these locks be per layer or global on a context menu of the zoom slider?
BTW, the numbers near zoom sliders could nicely choose black/white to stay visible.

comment:10 by A_Pirard, 11 years ago

FOI (for our information): how, presently, does JOSM choose its zoom levels and resolution and at which lower zoom does it stop fetching more "tiles" ("tile"=cache unit)? (one can change zoom in "Jump to position").

Said otherwise than just my example...
The hard part is choosing the resolutions.
The steps between different resolutions to fetch are a matter of compromise.
If the resolution is lowered, if JOSM cache is trashed and if the step is too small, JOSM may well cause the server to send exactly the same tiles as just trashed, but scaled differently; hence, it could have been more efficient to keep the cache, get more tiles of the same resolution and rescale the whole lot locally.
But sticking to a too high resolution increases the network traffic.
But the network traffic is a lesser concern if a local proxy is used.

It seems that JOSM really trashes the cache:
Lower zoom to 80m, change resolution, increase zoom back to 40m, change resolution: you can then see JOSM first rescale the 80m tiles to 40 m and then re-fetch the same 40m tiles it just trashed a few seconds ago.
If the resolution change were automatic, that would happen out of control because of very short and slight zoom changes.
And that is why I like my two-level resolution configuration: editing vs navigation, be it because a proxy is configured that way too or just to choose the tiles obtained from a standard server: one continues to use the same tiles until drastically moving place.

The general conclusion is that the best operation is obtained from user ad hoc tuning.
But how could a user tune such a hard to understand process?
Only from general instructions or those coming from the server maintainer.

by xeen, 11 years ago

Attachment: wms_auto_zoom.patch added

comment:11 by xeen, 11 years ago

tl;dr: appears to work, some flickering unfortunately, will test in real scenarios to see if it works and likely merge if no issues arise.

The attached patch is not ready for merge, because I haven’t yet tested it in production (i.e. see how it works when I actually use a WMS layer to draw buildings). It also contains a lot of debug code that should be removed.

It’s an updated version from simon04’s patch, but handles zoom change more like the TMSLayer does. It follows the WMS resolution wording and it can be turned off in the context menu of the layer in the layer dialog¹.

auto-resolution is on by default and snaps to the following resolutions for me, regardless of how much I zoom in/out: [0.0, 1.0, 2.0, 4.0, 5.0, 7.0, 14.0, 28.0, 40.0, 56.0, 112.0, 225.0]. From my testing it appears that these values work quite well and should prevent trashing the cache. It currently works by simply rounding off the 100PixelDistance. The more elaborate way would be to pre-define a list of suitable resolutions and snap to the nearest one. If this set of values works in practice, I’ll opt for the simpler solution.

There’s still some flickering when zooming, most likely due to the way the images are updated/replaced. Previously this wasn’t really a problem, but it’s much more apparent/annoying with auto-zoom. I don’t see an easy solution to this, so if anyone has an idea… in any case I believe auto-zooming+flickering is still much better than no-auto-zooming.

¹ in the future WMS/TMS handling and wording should probably be unified. WMS uses a context menu in the layer dialog while TMS uses one on the map. WMS talks about resolution while TMS talks about zoom (level). Wording is obviously rooted in the technology each is based on, but does it really matter to the user? Anyway, this is not in the scope of this bug.

by xeen, 11 years ago

Attachment: wms_auto_zoom_v2.patch added

the rounding was too simple, after all. In practice I regularly managed to create resolutions differing by only one meter. The updated patch now snaps the resolution to the same one as used for tile sources. It appears to work and since there is no fine tuning required, I will merge this in the next few days unless I encounter a show stopper.

comment:12 by xeen, 11 years ago

Resolution: fixed
Status: newclosed

In 5969/josm:

automatically zoom WMS sources (fixes #7563)

comment:13 by anonymous, 11 years ago

Thank you!

comment:14 by simon04, 11 years ago

In 6460/josm:

see #7563 - put WMS auto zoom default setting to preference dialog

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. Next status will be 'reopened'.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.