Projection issues on WFS-Server

Frank Warmerdam warmerdam at POBOX.COM
Thu Mar 9 09:04:13 EST 2006

Stephan Holl wrote:
> I cannot reproducing from shapefile. I exported into shape using
> ogr2ogr and added this layer into the mapfile.
> The Bounding-box is shown correct now for the shapefile and still wrong
> for the layer in postGIS.
> Well, as noone had this problem before, it seems that I am the only
> one...


Well, this is certainly useful information, and would seem to support the
idea that the problem is to some extent related to the PostGIS connector
in MapServer.

When I look in mappostgis.c I see this implementation for the getextent

int msPOSTGISLayerGetExtent(layerObj *layer, rectObj *extent)
     if(layer->debug) {
         msDebug("msPOSTGISLayerGetExtent called\n");

     extent->minx = extent->miny = -1.0 * FLT_MAX ;
     extent->maxx = extent->maxy = FLT_MAX;

     return MS_SUCCESS;

... followed by a big chunk of commented out code that presumably actually
computes the extents.  The code is introduced with this comment:

         /* this should get the real extents,but it requires a table read */
         /* unforunately, there is no way to call this function from 
mapscript, so its */
         /* pretty useless.  Untested since you cannot actually call it. */

It would seem you get bad extents because the PostGIS connector deliberately
does not attempt to produce the extents.

Likely your best bet is to manually set the extent using the wfs_extent
or ows_extent metadata on the layer in your mapfile.  As long as things are
reasonable static this should be straight forward.

Alternatively this function could be implemented, but even if it was, I
imagine it would be expensive to evaluate for large layers.

Any mappostgis.c maintainers out there that would care to comment?

Best regards,
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at
light and sound - activate the windows |
and watch the world go round - Rush    | President OSGF,

More information about the mapserver-users mailing list