Increase Clarity of WMS
Ed McNierney
ed at TOPOZONE.COM
Tue Apr 4 11:07:45 PDT 2006
Kyle -
There are more image resampling techniques in the world than are
supported by MapServer. Resampling the image beforehand gives you the
option of choosing the tools and the techniques that work best for your
image. If you minimize the amount of resampling MapServer needs to do,
you will both improve the performance of your application and improve
the quality of the output images.
Yes, you should do it for each zoom level and either create image
overviews (using gdaladdo) or minscale/maxscale within a GROUP. No, you
don't have to be perfect - just get close. Here's an example. This
view is a random USGS 1:24,000 scale topo map displayed at full source
resolution (what we call "1:24,000" scale, even though it isn't):
http://www.topozone.com/map.asp?lat=36.93333&lon=-81.96556&size=l&s=24
There's no resampling going on. If you switch the View Scale to
1:25,000 you'll get this:
http://www.topozone.com/map.asp?lat=36.93333&lon=-81.96556&size=l&s=25
That's the same image at 96% (24,000/25,000) of the original size. That
is, every 25th row and column of the image is omitted. You can see some
image degradation (look carefully at the dashed double purple lines left
of center) but it's quite minor. If you're unlucky, single-pixel-wide
horizontal and vertical lines can disappear entirely.
- Ed
Ed McNierney
President and Chief Mapmaker
TopoZone.com / Maps a la carte, Inc.
73 Princeton Street, Suite 305
North Chelmsford, MA 01863
Phone: +1 (978) 251-4242
Fax: +1 (978) 251-1396
ed at topozone.com
-----Original Message-----
From: UMN MapServer Users List [mailto:MAPSERVER-USERS at LISTS.UMN.EDU] On
Behalf Of Kyle Mulka
Sent: Tuesday, April 04, 2006 1:05 PM
To: MAPSERVER-USERS at LISTS.UMN.EDU
Subject: Re: [UMN_MAPSERVER-USERS] Increase Clarity of WMS
Would I have to get exactly the correct scale before mapserver touches
the file, or would it still improve quality if I got it close. Would I
need to do this for each Google zoom level and use mapservers minscale
and maxscale?
--
Kyle Mulka
http://www.kylemulka.com/
Quoting Ed McNierney <ed at topozone.com>:
> Kyle -
>
> I was looking at images like this one:
>
> http://maps.kylemulka.com/imagemagick/floorplans/tiles/dude-1-1-5.png
>
> The image itself is indeed 256x256, but your MapServer WMS request is
> asking for a source area much larger than 256x256 to be rendered into
a
> 256x256 image. The image quality degradation is coming from asking
> MapServer to resample the source images to a lower output resolution.
> You can get better quality resampling by using a (slower) tool to
> preprocess the images.
>
> - Ed
>
> Ed McNierney
> President and Chief Mapmaker
> TopoZone.com / Maps a la carte, Inc.
> 73 Princeton Street, Suite 305
> North Chelmsford, MA 01863
> Phone: +1 (978) 251-4242
> Fax: +1 (978) 251-1396
> ed at topozone.com
>
> -----Original Message-----
> From: UMN MapServer Users List [mailto:MAPSERVER-USERS at LISTS.UMN.EDU]
On
> Behalf Of Kyle Mulka
> Sent: Tuesday, April 04, 2006 2:09 AM
> To: MAPSERVER-USERS at LISTS.UMN.EDU
> Subject: Re: [UMN_MAPSERVER-USERS] Increase Clarity of WMS
>
> I'm pretty sure that all the tile images are in fact 256x256 and are
> being rended that way by the browser. Do have a specific example of
one
> that's not like? Either generated by the javascript, or a tile in that
> folder? Tools->Page Info->Media in Firefox will tell you what images
are
> currently loaded, including those loaded dynamically with javascript.
>
> I'm thinking that I might have to use Google Maps itself to do
> georeferencing. That way I can limit, or even eliminate the amount of
> scaling and resampling that mapserver has to do. I'll give it a try
next
> week when I have some time. If someone has already done some
> georeferencing with Google Maps and mapsever, let me know.
>
> Thanks,
>
> -Kyle
>
> Ed McNierney wrote:
>
>> Kyle -
>>
>> Well, if you increase the WIDTH and HEIGHT to 512 it will certainly
>> look better - and larger!
>>
>> You are taking a relatively large image and asking MapServer to
shrink
>> it down for you for display. I haven't time to decipher all the
>> JavaScript in there, but I suspect your "simply chopping up tiles
using
>
>> ImageMagick" example is actually generating HTML that tells the
client
>> browser to stuff an oversized PNG into a smaller IMG tag. Your
>> individual image tiles (from the floorplans/tiles/ directory) are
>> actually much larger images than your
>> http://maps.kylemulka.com/imagemagick/livedude.php displays. Each
>> individual tile is 512x512 pixels, but your final output image is
much
>> smaller than that.
>>
>> As a result, the quality of the output image may depend heavily on
the
>> browser being used. I think those 512x512 tiles are being displayed
in
>
>> IMG tags with HEIGHT and WIDTH properties set to a smaller value.
The
>> browser then squishes the images into the IMG space available.
>>
>> The image you're using is almost a worst-case scenario for MapServer.
>> It's essentially a vector drawing that's been scanned as a raster
> image.
>> You've got lots of thin lines that easily appear and disappear at
>> different scale levels, depending on how the image is resampled.
>>
>> If you're going to use scanned line art in MapServer, you'll get the
>> best results by producing high-quality resampled versions
(ImageMagick
>> is fine) at each specific scale/zoom level you'll want to use. Then
>> force the user to only use one of your preselected zoom levels. Make
>> sure that each image - when displayed - ends up exactly the same size
>> as the original image on your server.
>>
>> - Ed
>>
>> Ed McNierney
>> President and Chief Mapmaker
>> TopoZone.com / Maps a la carte, Inc.
>> 73 Princeton Street, Suite 305
>> North Chelmsford, MA 01863
>> ed at topozone.com
>> (978) 251-4242
>>
>> -----Original Message-----
>> From: UMN MapServer Users List [mailto:MAPSERVER-USERS at LISTS.UMN.EDU]
>> On Behalf Of Kyle Mulka
>> Sent: Monday, April 03, 2006 7:30 AM
>> To: MAPSERVER-USERS at LISTS.UMN.EDU
>> Subject: Re: [UMN_MAPSERVER-USERS] Increase Clarity of WMS
>>
>> Here's one of the WMS tiles I'm using. I've tried stretching it using
>> different values for the height and width but nothing I've tried has
>> made it look better or worse.
>>
http://kylemulka.com/cgi-bin/mapserv?map=floorplans.map&REQUEST=GetMap&
>> S
>>
ERVICE=WMS&VERSION=1.1.1&LAYERS=dude-1&STYLES=&BGCOLOR=0xFFFFFF&TRANSPA
>> R
>>
ENT=TRUE&SRS=EPSG:4326&BBOX=-83.7158203125,42.2905166207974,-83.7144470
>> 2
>> 148438,42.291532494305976&WIDTH=256&HEIGHT=256
>>
>> -Kyle
>>
>> Josh Livni wrote:
>>
>>
>>> Kyle,
>>>
>>> I could be wrong -- I haven't used a mapserver wms in Google Maps -
>>> but I think your mapserver image may be being squashed a bit. It's
a
>>> bit less wide relative to the height/width of your Imagemagick
>>> version. Also the gmap div seems to be a different height/width in
the
>>>
>>>
>>
>>
>>
>>> different versions.
>>>
>>> WMS will happily respond with the exact extent, but perhaps not the
>>> relative height/width you expect, thus 'squashing' the image, which
>>> may be causing the image issues you're seeing.
>>>
>>> You may want to play with this by adding a &height &width to the wms
>>> query, or you could try playing with the div height/width ratios,
and
>>> seeing if you get similar results if one is a bit off, as I may be
>>> off-base with this theory.
>>>
>>> -Josh
>>>
>>> Kyle Mulka wrote:
>>>
>>>
>>>
>>>> I have these very detailed floor plans that I'd like to
georeference
>>>> and display through mapserver's WMS sever, however, the clarity of
>>>> the images degrades when it goes through. How can I increase the
>>>> clarity of these floorplans through the WMS?
>>>>
>>>> Here's with mapserver:
>>>> http://maps.kylemulka.com/floorplan-test10.php
>>>>
>>>> Here's without (simply chopping up tiles using Imagemagick)
>>>> http://maps.kylemulka.com/imagemagick/livedude.php
>>>>
>>>> Here's the parts of the map file for just the first floor:
>>>> MAP
>>>> NAME "UofM"
>>>> FONTSET fontset.txt
>>>> PROJECTION
>>>> "init=epsg:4326"
>>>> END
>>>> IMAGETYPE png24
>>>> EXTENT -83.747063 42.272038 -83.709126 42.297056 SHAPEPATH
>>>> "/umdata/"
>>>> LAYER
>>>> NAME "dude-1"
>>>> TYPE raster
>>>> DATA "dude1.tif"
>>>> PROCESSING "RESAMPLE=AVERAGE"
>>>> PROCESSING "DITHER=YES"
>>>> METADATA
>>>> "wms_title" "dude-1"
>>>> "wms_onlineresource"
>>>> "http://kylemulka.com/cgi-bin/mapserv?map=floorplans.map&"
>>>> "wms_srs" "EPSG:4326"
>>>> END
>>>> STATUS ON
>>>> END
>>>> END
>>>>
>>>> -Kyle
>>>>
>>>>
>>>
>>>
>>>
>>>
>>>
>>
>>
>>
>>
>
>
>
More information about the MapServer-users
mailing list