Opened 15 years ago

Closed 15 years ago

#2843 closed defect (fixed)

WMS Layer requests offset by half pixel from desired

Reported by: warmerdam Owned by: warmerdam
Priority: normal Milestone: 5.4 release
Component: WMS Client Version: svn-trunk (development)
Severity: normal Keywords: BBOX
Cc: rhow@…, dmorissette

Description

My reading of section 6.5.6 of the WMS specification (1.1.0) is that the BBOX parameter in WMS is the bounds of the outer edge of the requested pixels. On the other hand, the EXTENT keyword in the mapfile, and the map->extent structure refers to bounds that are the centers of the edge pixels.

In msBuildWMSLayerURL() (mapwmslayer.c) the bbox is directly derived from map->extent and then put into the BBOX with no adjustment. I believe this is an error and that the BBOX should be offset by half a pixel from the map->extent.

The current situation is resulting in some reprojected/resample cascaded WMS requests being offset by one pixel (depending on half pixel off rounding) causing while edges on some tiles.

I'll attach a proposed patch. I can produce a test case demonstrating the problem if necessary.

Attachments (1)

wms.patch (619 bytes ) - added by warmerdam 15 years ago.
patch to WMS layer implementation

Download all attachments as: .zip

Change History (4)

by warmerdam, 15 years ago

Attachment: wms.patch added

patch to WMS layer implementation

comment:1 by warmerdam, 15 years ago

I have confirmed that:

  • mapwms.c adjusts incoming BBOX's by half a pixel when converting to map->extent.
  • mapwmslayer.c adjusts the origin by half a pixel when writing to world file which is center of pixel oriented.

So I believe that the map extent to bbox translation is the only outstanding problem.

comment:2 by dmorissette, 15 years ago

Cc: dmorissette added
Milestone: 5.4 release
Owner: changed from mapserverbugs to warmerdam

I believe I wrote that code in mapwmslayer.c and I was not aware of the subtle difference in extent handling at the time, so I'd say go ahead with your patch, it makes complete sense.

comment:3 by warmerdam, 15 years ago

Resolution: fixed
Status: newclosed

Daniel, thanks.

I have applied the patch in trunk (r8392) and 5.2 branch (r8393).

I have not prepared any test suite items for this change as it can be hard on different platforms due to rounding issues.

Note: See TracTickets for help on using tickets.