New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add an option to treat WMS BBOX in PixelIsPoint mode #4652

Closed
dmorissette opened this Issue May 8, 2013 · 5 comments

Comments

Projects
None yet
4 participants
@dmorissette
Contributor

dmorissette commented May 8, 2013

The need:

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.

Background:

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:

mapserver/mapwms.c

Lines 1678 to 1694 in 8b75bd0

/*
** 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.
*/
if( adjust_extent && map->width>1 && map->height>1 ) {
double dx, dy;
dx = (map->extent.maxx - map->extent.minx) / map->width;
map->extent.minx += dx*0.5;
map->extent.maxx -= dx*0.5;
dy = (map->extent.maxy - map->extent.miny) / map->height;
map->extent.miny += dy*0.5;
map->extent.maxy -= dy*0.5;
}

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.

@ghost ghost assigned aboudreault May 8, 2013

@aboudreault

This comment has been minimized.

Show comment
Hide comment
@aboudreault

aboudreault May 8, 2013

Member

Thanks Daniel for the issue. I'll work on this as soon as possible.

Member

aboudreault commented May 8, 2013

Thanks Daniel for the issue. I'll work on this as soon as possible.

@jmckenna

This comment has been minimized.

Show comment
Hide comment
@jmckenna

jmckenna May 21, 2013

Member

adding myself as participant to this ticket (can test).

Member

jmckenna commented May 21, 2013

adding myself as participant to this ticket (can test).

@jratike80

This comment has been minimized.

Show comment
Hide comment
@jratike80

jratike80 Jun 6, 2013

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.

jratike80 commented Jun 6, 2013

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.

@dmorissette

This comment has been minimized.

Show comment
Hide comment
@dmorissette

dmorissette Jun 6, 2013

Contributor

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.

Contributor

dmorissette commented Jun 6, 2013

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.

@aboudreault

This comment has been minimized.

Show comment
Hide comment
@aboudreault

aboudreault Jun 21, 2013

Member

Committed, doc updated.

Member

aboudreault commented Jun 21, 2013

Committed, doc updated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment