#3168 closed defect (fixed)
raster queries: WMS GetFeatureInfo with FEATURE_COUNT not respected
Reported by: | bartvde | Owned by: | warmerdam |
---|---|---|---|
Priority: | normal | Milestone: | 5.6 release |
Component: | WMS Server | Version: | svn-trunk (development) |
Severity: | normal | Keywords: | |
Cc: | aboudreault, assefa |
Description
When using a WMS GetFeatureInfo request with a FEATURE_COUNT parameter which is not 1, all goes well for vector layers (that number of results is returned), but for raster layers it seems like the whole dataset is returned.
Attachments (1)
Change History (14)
by , 15 years ago
Attachment: | ticket3168.patch added |
---|
comment:1 by , 15 years ago
Patch contains 3 files, but Trac preview only shows 2 of them (not my change to mapquery.c)
comment:2 by , 15 years ago
Milestone: | → 5.6 release |
---|---|
Owner: | changed from | to
Status: | new → assigned |
I'm having a hard time reproducing. Can you please tell me how you setup your layer to return raster results in GML format?
comment:3 by , 15 years ago
Cc: | added |
---|
comment:4 by , 15 years ago
I can reproduce this error. To reproduce
$ cd msautotest/wxs $ ../../mapserver/mapserv QUERY_STRING="map=tomk_workshop.map&version=1.1.1&service=WMS&request=GetFeatureInfo&srs=EPSG:4326&bbox=-180,-90,180,90&format=image/png&layers=land_shallow_topo_2048,rivers&styles=,&transparent=true&width=500&height=300&query_layers=land_shallow_topo_2048&info_format=application/vnd.ogc.gml&x=141&y=91&radius=10&feature_count=1"
The above is a variation on the wms_get_feature_info_raster.gml
test in tomk_workshop.map
. The above will return 1 record.
Running:
$ ../../mapserver/mapserv QUERY_STRING="map=tomk_workshop.map&version=1.1.1&service=WMS&request=GetFeatureInfo&srs=EPSG:4326&bbox=-180,-90,180,90&format=image/png&layers=land_shallow_topo_2048,rivers&styles=,&transparent=true&width=500&height=300&query_layers=land_shallow_topo_2048&info_format=application/vnd.ogc.gml&x=141&y=91&radius=10&feature_count=2"
and you'll see that > 2 records are returned.
comment:5 by , 15 years ago
Owner: | changed from | to
---|---|
Status: | assigned → new |
Assigning to Alan, unless someone else wants to grab it.
comment:6 by , 15 years ago
Hi: here's a patch based on r9462:
Index: maprasterquery.c =================================================================== --- maprasterquery.c (revision 9462) +++ maprasterquery.c (working copy) @@ -909,7 +909,7 @@ /************************************************************************/ int msRasterQueryByPoint(mapObj *map, layerObj *layer, int mode, pointObj p, - double buffer) + double buffer, int maxresults) { #ifndef USE_GDAL msSetError( MS_IMGERR, @@ -918,6 +918,7 @@ return MS_FAILURE; #else int result; + int previous_maxresults; double layer_tolerance; rectObj bufferRect; rasterLayerInfo *rlinfo = NULL; @@ -980,8 +981,11 @@ pointRect.maxy = p.y; rlinfo->range_mode = MS_SINGLE; + previous_maxresults = rlinfo->query_result_hard_max; + rlinfo->query_result_hard_max = maxresults; result = msRasterQueryByRect( map, layer, pointRect ); + rlinfo->query_result_hard_max = previous_maxresults; if( rlinfo->query_results > 0 ) return result; } Index: mapquery.c =================================================================== --- mapquery.c (revision 9462) +++ mapquery.c (working copy) @@ -1113,7 +1113,7 @@ /* Raster layers are handled specially. */ if( lp->type == MS_LAYER_RASTER ) { - if( msRasterQueryByPoint( map, lp, map->query.mode, map->query.point, map->query.buffer ) == MS_FAILURE ) + if( msRasterQueryByPoint( map, lp, map->query.mode, map->query.point, map->query.buffer, map->query.maxresults ) == MS_FAILURE ) return MS_FAILURE; continue; } Index: mapserver.h =================================================================== --- mapserver.h (revision 9462) +++ mapserver.h (working copy) @@ -1742,7 +1742,7 @@ MS_DLL_EXPORT void msQueryFree(mapObj *map, int qlayer); /* todo: rename */ MS_DLL_EXPORT int msRasterQueryByShape(mapObj *map, layerObj *layer, shapeObj *selectshape); MS_DLL_EXPORT int msRasterQueryByRect(mapObj *map, layerObj *layer, rectObj queryRect); -MS_DLL_EXPORT int msRasterQueryByPoint(mapObj *map, layerObj *layer, int mode, pointObj p, double buffer ); +MS_DLL_EXPORT int msRasterQueryByPoint(mapObj *map, layerObj *layer, int mode, pointObj p, double buffer, int maxresults ); /* in mapstring.c */ MS_DLL_EXPORT void msStringTrim(char *str);
Running the resulting patch aganist the tests per comment:4, yields the same result.
comment:8 by , 15 years ago
Replying to warmerdam:
This approach looks ok to me.
To clarify, I'm still getting erroneous results, even with this patch:
- feature_count=0: 380 features
- feature_count=1: 1 feature
- feature_count=2: 380 features
Anything higher than feature_count=1 returns 380 records.
I wonder whether the issue is in maprasterquery.c/msRasterQueryByPoint logic.
comment:9 by , 15 years ago
Cc: | added; removed |
---|---|
Owner: | changed from | to
Seizing this ticket. I'll see if I can figure out the behavior Tom is seeing.
follow-up: 11 comment:10 by , 15 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Corrected in trunk (r9464), I think in time for beta4.
comment:11 by , 15 years ago
comment:13 by , 15 years ago
In r9502 a few fixes to the maxresults handling were incorporated for the default case where maxresults is zero which should mean unlimited.
patch to fix this issue