Why does mapserver shave off a pixel from the bounding box?
Trond Michelsen
trondmm-mapserver at CRUSADERS.NO
Tue Nov 13 08:21:29 PST 2007
Hi.
I'm using mapserver 4.10.0 and I've noticed that mapserver changes the
bbox of incoming WMS-requests. At first I thought there was some
inconsistencies with my proj-definitions that caused a small
correction when mapserver fetched external WMS-layers. But now I've
noticed that mapserver always reduces the width and height of the
bounding box with the equivialent of a single pixel, then recenters
it.
e.g. a BBOX of 950,7975,1450,8725 becomes
950.625,7975.625,1449.375,8724.375 when the imagesize is 400x600.
What is the reason for this?
Won't this be a problem when generating tiled images, as there will be
a 1 pixel wide strip of the map "between" the tiles that aren't
plotted?
If mapserver needs to use the smaller bbox internally, shouldn't it at
least use the original bbox when fetching layers from external WMS-
servers? If a layer happens to be cascaded through, say, ten levels of
WMS-servers, all running mapserver, then the final bbox could get
significantly smaller than the original.
Here's a test-script in perl that demonstrates the behaviour:
--8<--
#!/usr/bin/perl
use strict;
use warnings;
use mapscript;
my $mapfile = "test.map";
my $map = mapscript::mapObj->new( $mapfile );
my $req = mapscript::OWSRequest->new();
$req->setParameter(SERVICE => "WMS");
$req->setParameter(VERSION => "1.1.1");
$req->setParameter(REQUEST => "GetMap");
$req->setParameter(LAYERS => "dummy");
$req->setParameter(STYLES => "default");
$req->setParameter(SRS => "EPSG:32632");
$req->setParameter(BBOX => "950,7975,1450,8725");
$req->setParameter(WIDTH => "400");
$req->setParameter(HEIGHT => "600");
$req->setParameter(EXCEPTIONS => "application/vnd.ogc.se_xml");
$req->setParameter(FORMAT => "image/png");
$map->loadOWSParameters($req);
print $map->{extent}->toString(), "\n";
--8<--
and a dummy map-file:
--8<--
MAP
PROJECTION
"init=epsg:32632"
END
LAYER
name "dummy"
type polygon
END
END
--8<--
--
Trond Michelsen
More information about the MapServer-users
mailing list