Join GitHub today
Add an option to treat WMS BBOX in PixelIsPoint mode #4652
Add a "wms_bbox_mode" metadata that can be set to "PixelIsPoint" in a given mapfile to tell MapServer to treat the BBOX received in WMS GetMap requests as if it was provided in PixelIsPoint mode. Essentially disabling the conversion from PixelIsArea (WMS model) to PixelIsPoint (MapServer internal model) that is present in mapwms.c for that specific mapfile.
This option is required to accommodate WorldWind clients which (incorrectly) send requests with a BBOX in PixelIsPoint model. Until the client code is fixed, this option would be required to allow MapServer to serve imagery and elevation data to WorldWind clients.
The option would have no side-effect for general users who do not use it.
The WMS specification states that the BBOX in a GetMap URL corresponds to the georeferenced coordinates of the outside boundary of the corner pixels of the requested image... essentially saying that WMS uses the PixelIsArea model to reuse the terminology used in some GIS libs.
As you all know, MapServer uses the PixelIsPoint model internally, that is: the map->extents coordinates correspond to the georeferenced coordinates of the center of the corner pixels of the requested image.
When WMS was introduced several years ago, we had to introduce WMS-specific code to convert the GetMap BBOX from the WMS PixelIsArea model to MapServer's internal PixelIsPoint model... you can see this code here:
Setting metadata "wms_bbox_mode" to "PixelIsPoint" in a mapfile would disable this block of code and produce the result that WorldWind clients expect, even if it's not strictly WMS compliant.
Have you considered to call it "EnablePixelIsPoint" and make Mapserver to require also a GetMap vendor parameter like &pixel_is_point=TRUE before this half a pixel adjustment happens? That way both WorldWind and standard WMS clients could be happy with the same service.
Good question. Initially that was not possible (I save you the details) but the new WorldWind setup uses a wrapper in which we could add such a param to the URL, making what you suggest possible.
To make things even more straightforward, how about we simply add a vendor-specific parameter called "bbox_pixel_is_point=TRUE" in the GetMap URL? There is no need for any setting in the mapfile to enable this since the absence of the vendor-specific bbox_pixel_is_point=TRUE in the URL is enough to disable this behavior for normal clients.