Opened 17 years ago

Closed 14 years ago

Last modified 14 years ago

#2079 closed defect (fixed)

WMS request with a BBOX and and SLD containing Filter encoding gives inconsistent result

Reported by: assefa Owned by: assefa
Priority: normal Milestone: 5.6 release
Component: WMS Server Version:
Severity: normal Keywords:
Cc: tomkralidis

Description

Bug reported by Bart : description is in attached PDF.

Looking into this problem, It seems that applying the SLD should be done prior to applying other wms parameters such BBOX/SRS. Conceptually when there is a geographical filter in the SLD (so doing a query), It should be assumed that this query is applied against the original extents of the map (prior of the these extents being modified by parameters such as BBOX). Is this also the way you see it ?

Assuming this, I have moved the code to test and apply the sld before all other parameters. This seems to give the expected result using your data set. Attached is my mapwms.c (changes in function msWMSLoadGetMapParams). Please give it a try. If acceptable I will do the commit.

Attachments (6)

Bug report SLD WMS.pdf (89.7 KB ) - added by assefa 17 years ago.
ms_ticket2079.patch (1.1 KB ) - added by bartvde 16 years ago.
patch that works for me
ms_ticket2079.2.patch (1.1 KB ) - added by bartvde 16 years ago.
patch that works for me
bug_2079.patch (2.3 KB ) - added by assefa 16 years ago.
mapserver-5.2.0-2079.patch (2.6 KB ) - added by bartvde 16 years ago.
WMS_WFS.zip (48.2 KB ) - added by elzouavo 16 years ago.
WMS and WFS tests

Download all attachments as: .zip

Change History (28)

by assefa, 17 years ago

Attachment: Bug report SLD WMS.pdf added

comment:1 by assefa, 17 years ago

Owner: changed from mapserverbugs to assefa

comment:2 by assefa, 17 years ago

Commied fix in the main trunck.

comment:3 by bartvde, 17 years ago

Resolution: fixed
Status: newclosed

Seems fine to me Assefa, for reference, fixed in changeset:6072

comment:4 by bartvde, 17 years ago

Assefa, was this backported to 4.10.X as well? If so, what is the changeset?

comment:5 by bartvde, 17 years ago

okay, this was backported as part of changeset:6082

comment:6 by bartvde, 16 years ago

Resolution: fixed
Status: closedreopened

Unfortunately this is broken again in 5.2. So I am reopening.

comment:7 by bartvde, 16 years ago

The first problem is in FLTParseGMLBox where ppszSRS is never set. This causes a WFS GetFeature request with a BBOX Filter in another SRS to not return any features.

        if (*ppszSRS)
          *ppszSRS = strdup(pszSRS);

should be:

        if (ppszSRS)
          *ppszSRS = strdup(pszSRS);

or not?

SLD WMS with reprojection still does not work, this needs more investigation.

by bartvde, 16 years ago

Attachment: ms_ticket2079.patch added

patch that works for me

by bartvde, 16 years ago

Attachment: ms_ticket2079.2.patch added

patch that works for me

comment:8 by bartvde, 16 years ago

Milestone: 5.0 release5.2.1 release

in reply to:  7 comment:9 by assefa, 16 years ago

The first problem is in FLTParseGMLBox where ppszSRS is never set. This causes a WFS GetFeature request with a BBOX Filter in another SRS to not return any features.

        if (*ppszSRS)
          *ppszSRS = strdup(pszSRS);

should be:

        if (ppszSRS)
          *ppszSRS = strdup(pszSRS);

or not?

This is correct. I will apply the changes.

SLD WMS with reprojection still does not work, this needs more investigation.

I have seen the patch you sent but before any changes to it, I would like to reproduce the problem that you are having. According to your statement, it seems that you are having a problem with Test 4 described in your original pdf doc? For some reason, the changes I had done in changeset:6072 were removed in changeset:6538 and would like to be able to have a test case that shows the problem before rehanging it.

comment:10 by bartvde, 16 years ago

Hi Assefa, yes I believe it is testcase 4 that is failing now. Do you still have the data or I need to make a new testcase?

comment:11 by assefa, 16 years ago

Cc: tomkralidis added

I still have the test cases/data. Test 4 works currently (with your patch of mapogcfilter.c but *without* the patch in mapwms.c) http://127.0.0.1/cgi-bin/mapserv.exe?map=f:/msapps/bart_bugmapogcfilter/bugmapogcfilter.map&LAYERS=NL-prov&REQUEST=GetMap&SERVICE=WMS&FORMAT=image/png&STYLES=default&HEIGHT=450&QUERY_LAYERS=NL-prov&VERSION=1.1.0&SRS=EPSG:28992&WIDTH=450&SLD=http://127.0.0.1/msapps/bart_bugmapogcfilter/bugmapogcfilter.sld&BBOX=0,300000,300000,600000&TRANSPARENT=TRUE&EXCEPTIONS=application/vnd.ogc.se_inimage

Looking at your patch for mapwms.c, I tend to think that It is not appropriate mainly because we want to wait after all the query parameters are read before applying the srs (allowing for error trapping for invalid srs).

The original patch that we did changeset:6072 is still valid: what the patch allowed was that to make sure that we apply the SLD before applying any of the other parameters (such as BBOX/SRS). As described originally in this bug: "Conceptually when there is a geographical filter in the SLD (so doing a query), It should be assumed that this query is applied against the original extents of the map (prior of the these extents being modified by parameters such as BBOX)."

I am attaching a new patch that brings back the changeset:6072

Bart, can you please test with this patch (+ your patch for mapogcfilter.c)

I am also cc'ing Tom to see if there was any reason why part of changeset:6538 did remove the original changes.

by assefa, 16 years ago

Attachment: bug_2079.patch added

comment:12 by bartvde, 16 years ago

Hi Assefa, this patch does not work for me. I am trying this on 5.2.0. For reference I'll attach my complete patch.

I am getting a blank image on the following request:

http://test.intranet.rijkswaterstaat.nl/services/geoservices/basispakket/nationaalwegenbestand?VERSION=1.1.1&FORMAT=image%2Fgif&STYLES=default&TRANSPARENT=TRUE&LAYERS=AAA64&SERVICE=WMS&REQUEST=GetMap&EXCEPTIONS=application%2Fvnd.ogc.se_inimage&SRS=EPSG%3A4326&SLD_BODY=%3CStyledLayerDescriptor%20xmlns%3D%22http%3A%2F%2Fwww.opengis.net%2Fsld%22%20version%3D%221.0.0%22%20xsi%3AschemaLocation%3D%22http%3A%2F%2Fwww.opengis.net%2Fsld%20http%3A%2F%2Fschemas.opengis.net%2Fsld%2F1.0.0%2FStyledLayerDescriptor.xsd%22%20xmlns%3Axsi%3D%22http%3A%2F%2Fwww.w3.org%2F2001%2FXMLSchema-instance%22%3E%3CNamedLayer%3E%3CName%3EAAA64%3C%2FName%3E%3CUserStyle%3E%3CFeatureTypeStyle%3E%3CRule%3E%3CName%3Edefault%3C%2FName%3E%3Cogc%3AFilter%20xmlns%3Aogc%3D%22http%3A%2F%2Fwww.opengis.net%2Fogc%22%3E%3Cogc%3ABBOX%3E%3Cogc%3APropertyName%3Egeometry%3C%2Fogc%3APropertyName%3E%3Cgml%3ABox%20xmlns%3Agml%3D%22http%3A%2F%2Fwww.opengis.net%2Fgml%22%20srsName%3D%22EPSG%3A28992%22%3E%3Cgml%3Acoordinates%20decimal%3D%22.%22%20cs%3D%22%2C%22%20ts%3D%22%20%22%3E204039.4736842105%2C510368.4210526316%20224186.84210526315%2C531905.2631578947%3C%2Fgml%3Acoordinates%3E%3C%2Fgml%3ABox%3E%3C%2Fogc%3ABBOX%3E%3C%2Fogc%3AFilter%3E%3CLineSymbolizer%3E%3CStroke%3E%3CCssParameter%20name%3D%22stroke%22%3E%23FF0000%3C%2FCssParameter%3E%3CCssParameter%20name%3D%22stroke-width%22%3E2%3C%2FCssParameter%3E%3C%2FStroke%3E%3C%2FLineSymbolizer%3E%3C%2FRule%3E%3C%2FFeatureTypeStyle%3E%3C%2FUserStyle%3E%3C%2FNamedLayer%3E%3C%2FStyledLayerDescriptor%3E&BBOX=-0.19903049572838682,49.52560885721632,10.621514476023274,54.50117406687948&WIDTH=1033&HEIGHT=475

Where the SLD is something like:

<StyledLayerDescriptor xmlns="http://www.opengis.net/sld" version="1.0.0" xsi:schemaLocation="http://www.opengis.net/sld http://schemas.opengis.net/sld/1.0.0/StyledLayerDescriptor.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><NamedLayer><Name>AAA64</Name><UserStyle><FeatureTypeStyle><Rule><Name>default</Name><ogc:Filter xmlns:ogc="http://www.opengis.net/ogc"><ogc:BBOX><ogc:PropertyName>geometry</ogc:PropertyName><gml:Box xmlns:gml="http://www.opengis.net/gml" srsName="EPSG:28992"><gml:coordinates decimal="." cs="," ts=" ">204039.4736842105,510368.4210526316 224186.84210526315,531905.2631578947</gml:coordinates></gml:Box></ogc:BBOX></ogc:Filter><LineSymbolizer><Stroke><CssParameter name="stroke">#FF0000</CssParameter><CssParameter name="stroke-width">2</CssParameter></Stroke></LineSymbolizer></Rule></FeatureTypeStyle></UserStyle></NamedLayer></StyledLayerDescriptor>

by bartvde, 16 years ago

Attachment: mapserver-5.2.0-2079.patch added

comment:13 by bartvde, 16 years ago

Assefa, can you try a GetMap request where the SRS differs from the MAP file's projection, with a BBOX filter in the MAP file's projection? That use case does not work for me with your patch applied.

comment:15 by bartvde, 16 years ago

Asefa, the url you are trying has the SLD parameter at the end of the url, which probably explains why yours works and mine does not. Are you able to test with the SLD parameter before the BBOX?

comment:17 by elzouavo, 16 years ago

I have done 11 tests on MapServer 5.2.0 (with PropertyIsEqualTo anf/or PropertyIsLike and/or BBOX with an without <AND> node). I have also test matchCase.

All works OK only for the requests using PropertyIsEqualTo with matchCase without AND node.

Nothing works when a AND node is used.

See the ZIP file that contains :

  • Open Office ODS file that describes all,
  • the mapserver log for each test (level 5),
  • the mapfile,
  • the MapInfo file.

NB : The ZIP contains also WFS tests.

by elzouavo, 16 years ago

Attachment: WMS_WFS.zip added

WMS and WFS tests

in reply to:  11 comment:18 by tomkralidis, 16 years ago

Replying to assefa:

I still have the test cases/data. Test 4 works currently (with your patch of mapogcfilter.c but *without* the patch in mapwms.c) http://127.0.0.1/cgi-bin/mapserv.exe?map=f:/msapps/bart_bugmapogcfilter/bugmapogcfilter.map&LAYERS=NL-prov&REQUEST=GetMap&SERVICE=WMS&FORMAT=image/png&STYLES=default&HEIGHT=450&QUERY_LAYERS=NL-prov&VERSION=1.1.0&SRS=EPSG:28992&WIDTH=450&SLD=http://127.0.0.1/msapps/bart_bugmapogcfilter/bugmapogcfilter.sld&BBOX=0,300000,300000,600000&TRANSPARENT=TRUE&EXCEPTIONS=application/vnd.ogc.se_inimage

Looking at your patch for mapwms.c, I tend to think that It is not appropriate mainly because we want to wait after all the query parameters are read before applying the srs (allowing for error trapping for invalid srs).

The original patch that we did changeset:6072 is still valid: what the patch allowed was that to make sure that we apply the SLD before applying any of the other parameters (such as BBOX/SRS). As described originally in this bug: "Conceptually when there is a geographical filter in the SLD (so doing a query), It should be assumed that this query is applied against the original extents of the map (prior of the these extents being modified by parameters such as BBOX)."

I am attaching a new patch that brings back the changeset:6072

Bart, can you please test with this patch (+ your patch for mapogcfilter.c)

I am also cc'ing Tom to see if there was any reason why part of changeset:6538 did remove the original changes.

Assefa: I think r6538 was done to check the "else" condition (i.e. if OGR is not supported). Having said this, as long as the code update here covers that case, then that's fine with me.

As well, let's make sure this works on msautotest to make sure new issues do not get introduced.

comment:19 by assefa, 15 years ago

Milestone: 5.6 release6.0 release

in reply to:  12 comment:20 by assefa, 14 years ago

Replying to bartvde:

http://test.intranet.rijkswaterstaat.nl/services/geoservices/basispakket/nationaalwegenbestand?

Bart,

Is it possible to get the test data used in this case?

I am trying to see if I can replicate any of the issues described in this bug. I still have the original set of data ("NL-prov") but could not replicate the issue with it.

thx

comment:21 by assefa, 14 years ago

Milestone: 6.0 release5.6 release
Resolution: fixed
Status: reopenedclosed

worked on this and the bug should be corrected in r9549. (Please see #673) for details on the bug. Added an msautotest: wms_get_map_sld_proj.png (in wms_sld_proj.map)

comment:22 by bartvde, 14 years ago

I've done the following tests:

  • GetMap in EPSG:28992 and SLD with BBOX in EPSG:28992 -> OK
  • GetMap in EPSG:4326 and SLD with BBOX in EPSG:28992 -> OK
  • GetMap in EPSG:4326 and SLD with BBOX in EPSG:4326 -> OK
  • GetMap in EPSG:28992 and SLD with BBOX in EPSG:4326 -> OK

So all works fine. Thanks.

Note: See TracTickets for help on using tickets.