Opened 18 years ago

Closed 16 years ago

#1851 closed defect (wontfix)

WMS server returns wrong BoundingBox for PostGIS layers

Reported by: nikita.shulga@… Owned by: mapserver-bugs@…
Priority: high Milestone: 5.2 release
Component: PostGIS Interface Version: 4.8
Severity: normal Keywords:
Cc: sdlime

Description (last modified by dmorissette)

LayerGetExtent function for PostIGIS layers is dummy function(defined in mappostgis.c) always returns (-
MAXFLOAT,-MAXFLOAT,MAXFLOAT,MAXFLOAT), so layer extent for PostGIS-layer is not specified in .map-
file one will get enormously large BoundingBox and LatLonBoundingBox as reply to 
GetCapabilitiesRequest...
All one have to do to fix it is to issue following query "select extent(%geometry_column%) from %
table_name% %filter%" to PostGIS DB and parse its results.. This code is already present in mappostgis.c 
but it disabled because, as commentary to function said, "Never seen this function actually called"

Change History (4)

comment:1 by refractions, 18 years ago

Summary: WMS server returns wrong BoundingBox for PostGIS layers WMS server returns wrong BoundingBox for PostGIS layers
You are better off using the wms_extent keyword in your mapping file and setting the extent manually.  
Otherwise, if you uncomment the select extent() code, postgis will calculate the extent every time 
getcapabilities is called, and that is a slow operation involving a sequence scan of the entire table.  It is a 
trade-off.  If we set up for automatic extents calculation, instead we'll get bugs saying "getcapabilities is 
really slow when I use postgis layers, fix that".

comment:2 by dmorissette, 17 years ago

Cc: sdlime added
Description: modified (diff)
Milestone: 5.2 release

I think we should fix this and use select extent()... in 5.2. Returning an infinite BoundingBox in GetCapabilities is just wrong. If anyone finds their GetCapabilities too slow they can always use ows_extent metadata to force the extent value and avoid the full table scan.

Any objections from the mappostgis.c maintainers?

comment:3 by pramsey, 17 years ago

Serious objections, it's a massive "gotcha" that's completely hidden from people in terms of "why is this happening?" At least the infinite bounding boxes are a visible error. How about something completely different, an XML comment that appears when ows_extent isn't set saying "please set ows_extent"?

comment:4 by pramsey, 16 years ago

Resolution: wontfix
Status: newclosed
Note: See TracTickets for help on using tickets.