[OSM-dev] JOSM WMS Plugin degrades input image quality

Dirk-Lüder Kreie osm-list at deelkar.net
Mon Mar 19 05:21:59 GMT 2007


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Frederik Ramm schrieb:
> Hi,
> 
>> Just to make this more clear: Is there a way to persuade the WMS plugin
>> to hand JOSM the bitmap unaltered so JOSM takes care of the scaling?
> 
> The problem is this:
> 
> Yahoo doesn't support continuous zoom levels. But WMS servers do, or at
> least they accept queries where you specify a geo bounding box, a
> projection, and a desired image width and height (yes there is
> overspecification here), and they will return exactly that.

OK, so far so good.

> With Yahoo, you have to request the finest zoom that will still give you
> the desired bounding box inside the specified width and height window,
> but only in the rarest of cases will you actually receive exactly the
> bounding box you asked for - it will normally be more. So the image has
> to be cropped, and the remaining data has to be rescaled to fit the
> originally requested width and height.

The applet in firefox already does the cropping AFAICT.

> That's because there's no feedback channel by which the WMS server could
> tell the client "look, you asked for this bounding box inside that pixel
> area but I've actually given you a bit more, namely this bounding box,
> so just deal with it".

So basically this ^ isn't the problem. The problem is, that the Image
returned by friefox to the plugin has exactly (Again as far as I can
tell) the right bbox, but not the correct resolution to match display
resolution, which leads to image manipulation which degrades the image.

> Possible solutions include
> 
> (a) deliberately request a (circa) 50% larger window from Yahoo than we
> actually need, which will still ensue in rescaling, but normally we'll
> only scale down, not up, then.

Basically any scaling of bitmaps that doesn't involve integer factors is
bad for accuracy.

> (b) apply complex arithmetic and, very likely, a multistep approximation
> process to find out which bounding box and pixel area we have to request
> from Yahoo to get something from which we can crop out the image we want
> without any scaling afterwards.

That should be "easy" relatively speaking because yahoo seems to have
predefined resolution steps. I can get 1m resolution and ~20m resolution
for Bremen.

> (c) modify the WMS plugin or fork it into a non-WMS plugin that is happy
> with larger-than-requested images being returned, and displays them
> properly.

The problem as I see it is, that the WMS plugin uses the current screen
resolution (desired image width and height) to scale the image. This is
completely unneccessary, as JOSM is well able to handle images different
from screen resolution, as you can see when zooming out or in after
image download.
Also this is AFAICT the source for the degraded images, and maybe also
for the apparent different alignment of the images Thomas Walraet saw
(See the other thread "YWMS alignment" here on dev list)


Dirk-Lüder "Deelkar" Kreie


-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFF/h33FUbODdpRVDwRAvKRAJ4x5Z3K9p4ybcYaEIBCBYdC9PAE7wCcDRIo
KQ8fegwrNl5r1huwofA9Cho=
=YO7M
-----END PGP SIGNATURE-----




More information about the dev mailing list