Why does mapserver shave off a pixel from the bounding box?

Trond Michelsen trondmm-mapserver at CRUSADERS.NO
Tue Nov 13 11:46:58 EST 2007


On Tue, Nov 13, 2007 at 05:21:29PM +0100, Trond Michelsen wrote:
> 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.

Hang on... I should probably have looked harder at the source before
posting. I just found this in mapwms.c:

  /*
  ** WMS extents are edge to edge while MapServer extents are center of
  ** pixel to center of pixel.  Here we try to adjust the WMS extents
  ** in by half a pixel.  We wait till here because we want to ensure we
  ** are doing this in terms of the correct WIDTH and HEIGHT.
  */

So, I assume mapserver actually plots everything to the edge of the
original BBOX. In that case, I still think it's a bug that the
adjusted BBOX is used when fetching layers from remote WMS-servers.

I haven't tested with mapserver 5.0 yet, though, but I've looked at
the source, and there doesn't seem to be any changes in how mapserver
adjusts the extents.

-- 
Trond Michelsen



More information about the mapserver-users mailing list