-
-
Notifications
You must be signed in to change notification settings - Fork 364
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
WMS GetCapabilities truncated for a CONNECTIONTYPE POSTGIS #4039
Comments
|
Author: jmckenna |
|
Author: jmckenna
(good news is that this has been reported with non-MS4W binaries as well: see #3977 comment:4) |
|
Author: dmorissette |
|
Author: jmckenna |
|
Author: sholl I did not test the mentioned trick with adding WMS_EXTENT to the metadata to solve the problem though. Too bad I cannot add a testcase since the data is not freely available; but I am highly interested in having a solution for this issue. Stephan |
|
I'm having a similar issue on Linux, with a Postgis Layer. is displayed in WMS/WFS Capabilities as : It is truncated at the first & |
|
@jmckenna can you provide the mapfile that triggers this (without the data is ok)? |
when passed an unitialized rectObj, msProjectRect() will try to sample the rect by going through msProjectRectGrid() which is non needed. This commit reprojects (minx,miny) and updates the rectObj accordingly. Might solve #4039 as the failure is happening somewhere inside the rect reprojection code.
|
@tbonfort I am able to trigger this locally (with Windows, MapServer 6.2.0-beta2, PostgreSQL 9.1.4, PostGIS 2.0). Here is a test case (tiny sql to load 2 points into database included in /data/ folder): http://labs.gatewaygeomatics.com/dl/ticket4039.zip (9KB) See the included file: commands.txt |
|
I've found such issues with earlier versions of MapServer and by adding fflush(NULL) to the end of msCleanup (maputil.c) always solved this problem. May be we should apply such change "officially" if we experience the same with the current version too. |
|
@jmckenna I cannot reproduce the hang on linux. However, given where the hang is occuring for you, I suspect that proj is having a problem computing the latlon bounds returned by the postgis driver (which are known to be invalid as that particular driver does not implement this function). I have added a patch that accounts for this situation, could you check if this fixes the issue ? git remote add tbonfort git://github.com/tbonfort/mapserver.git
git fetch tbonfort
git checkout b4039
# usual clean,build, install, testbefore patch: <LatLonBoundingBox minx="-180" miny="-8.2419e+12" maxx="180" maxy="8.2419e+12" />
<BoundingBox SRS="EPSG:26918"
minx="-2.5e+07" miny="-2.5e+07" maxx="2.5e+07" maxy="2.5e+07" />after: <LatLonBoundingBox minx="-180" miny="-90" maxx="180" maxy="90" />
<BoundingBox SRS="EPSG:26918"
minx="-2.5e+07" miny="-2.5e+07" maxx="2.5e+07" maxy="2.5e+07" /> |
|
@dmorissette could you please comment on this fix ? |
|
@tbonfort I've tested this patch and the workaround does work on Windows. I wonder if this breaks the WMS spec, as LatLongBoundingBox should be "the minimum bounding rectangle in decimal I'm +1 for this change. |
|
@tbonfort, This issue has come up several times in the past and there seems to be no good fix for it.
|
|
I really like @dmorissette's suggestions to fall back on map.extent and include an XML warning (I follow these warnings very closely). |
|
My intent on this issue was to prevent a segfault/hang from happening, no more no less. The MS_BOUNDS_MAX=25000000 was the value returned previously by the postgis driver, and my patch just treats this special case.
|
|
Unless I'm mistaken, the PostGIS driver used to return infinite values (+/-FLT_MIN,FLT_MAX) in previous releases which was even worse than the 25000000 value. It seemed to me that the 25000000 value was introduced by your patch no? (72217df) A layer without a LatLonBBox would be invalid if I remember the spec correctly, so I agree with you that using map extent + warning is the best way to go for 6.2. ows/wms_extent auto could be kept as a future enhancement for 6.4 |
|
Daniel, |
|
Ha! mappostgis.c defines: |
|
Looking at the spec, the latlon extent is inherited from the parent layer (i.e. probably from map.extent) if not included.
diff --git a/mappostgis.c b/mappostgis.c
index ab88061..4bd65fa 100644
--- a/mappostgis.c
+++ b/mappostgis.c
@@ -65,10 +65,6 @@
#include "maptime.h"
#include "mappostgis.h"
-#ifndef FLT_MAX
-#define FLT_MAX 25000000.0
-#endif
-
#define FP_EPSILON 1e-12
#define FP_EQ(a, b) (fabs((a)-(b)) < FP_EPSILON)
#define FP_LEFT -1
@@ -2999,27 +2995,6 @@ int msPostGISLayerGetItems(layerObj *layer)
}
/*
-** msPostGISLayerGetExtent()
-**
-** Registered vtable->LayerGetExtent function.
-**
-** TODO: Update to use proper PostGIS functions to pull
-** extent quickly and accurately when available.
-*/
-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;
-
-}
-
-/*
* make sure that the timestring is complete and acceptable
* to the date_trunc function :
* - if the resolution is year (2004) or month (2004-01),
@@ -3373,7 +3348,7 @@ int msPostGISLayerInitializeVirtualTable(layerObj *layer)
layer->vtable->LayerGetShape = msPostGISLayerGetShape;
layer->vtable->LayerClose = msPostGISLayerClose;
layer->vtable->LayerGetItems = msPostGISLayerGetItems;
- layer->vtable->LayerGetExtent = msPostGISLayerGetExtent;
+ /* layer->vtable->LayerGetExtent = msPostGISLayerGetExtent; */
layer->vtable->LayerApplyFilterToLayer = msLayerApplyCondSQLFilterToLayer;
/* layer->vtable->LayerGetAutoStyle, not supported for this layer */
layer->vtable->LayerCloseConnection = msPostGISLayerClose; |
|
How do you guys interpret this sentence from the spec ?
|
|
I interpret that as we must have a LatLonBoundingBox always (so your second point). |
|
I'd interpret it the other way, i.e. "inherited" everywhere else in the WMS spec means that if it's stated in the parent already then there is no need to repeat it, and the child layer inherits the value automatically. I wonder why we always thought that it was required for every layer, perhaps the rule has changed between versions of the spec. |
…er#4039) when passed an unitialized rectObj, msProjectRect() will try to sample the rect by going through msProjectRectGrid() which is non needed. This commit reprojects (minx,miny) and updates the rectObj accordingly. Might solve MapServer#4039 as the failure is happening somewhere inside the rect reprojection code.
return an error instead of invalid extents to avoid peculiar behavior in proj when reprojecting invalid values. this will also trigger a warning in capabilities documents. closes MapServer#4039
Reporter: jmckenna
Date: 2011/10/04 - 18:09
Trac URL: http://trac.osgeo.org/mapserver/ticket/4039
The text was updated successfully, but these errors were encountered: