MapServer / MapServer-import

3 stars 2 forks source link

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

Open tbonfort opened 12 years ago

tbonfort commented 12 years ago

Reporter: assefa Date: 2007/04/27 - 15:39 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.

tbonfort commented 12 years ago

Author: assefa Date: 2007/05/02 - 16:07 Commied fix in the main trunck.

tbonfort commented 12 years ago

Author: bartvde Date: 2007/05/02 - 17:45 Seems fine to me Assefa, for reference, fixed in changeset:6072

tbonfort commented 12 years ago

Author: bartvde Date: 2007/05/04 - 14:57 Assefa, was this backported to 4.10.X as well? If so, what is the changeset?

tbonfort commented 12 years ago

Author: bartvde Date: 2007/05/04 - 15:05 okay, this was backported as part of changeset:6082

tbonfort commented 12 years ago

Author: bartvde Date: 2008/07/21 - 15:58 Unfortunately this is broken again in 5.2. So I am reopening.

tbonfort commented 12 years ago

Author: bartvde Date: 2008/07/22 - 09:34 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.

tbonfort commented 12 years ago

Author: assefa Date: 2008/07/23 - 16:51

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.

tbonfort commented 12 years ago

Author: bartvde Date: 2008/07/23 - 18:39 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?

tbonfort commented 12 years ago

Author: assefa Date: 2008/07/23 - 21:10 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.

tbonfort commented 12 years ago

Author: bartvde Date: 2008/07/24 - 10:19 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>
tbonfort commented 12 years ago

Author: bartvde Date: 2008/07/24 - 13:19 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.

tbonfort commented 12 years ago

Author: assefa Date: 2008/07/24 - 15:12 Bart,

I had tested this case with your sample data where the GetMap request uses epsg 4326 and the map files has an epsg of 28992 and I get one polygon back:

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:4326&WIDTH=450&BBOX=-11.4978209692,47.29982228038,16.1647439812,63.89736125062&TRANSPARENT=TRUE&EXCEPTIONS=application/vnd.ogc.se_inimage&SLD=http://127.0.0.1/msapps/bart_bugmapogcfilter/bugmapogcfilter.sld

Do you still have this data that I am using?

Is it possible to use it or send me off list new test sample?

tbonfort commented 12 years ago

Author: bartvde Date: 2008/07/25 - 13:36 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?

tbonfort commented 12 years ago

Author: assefa Date: 2008/07/25 - 15:15 Bart,

the patch ensures that the SLD is applied before any other parameters (regardless of the order in which the parameters are found in the URL). I can confirm that using this url, I still get what is expected: 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&SLD=http://127.0.0.1/msapps/bart_bugmapogcfilter/bugmapogcfilter.sld&HEIGHT=450&QUERY_LAYERS=NL-prov&VERSION=1.1.0&SRS=EPSG:4326&WIDTH=450&BBOX=-11.4978209692,47.29982228038,16.1647439812,63.89736125062&TRANSPARENT=TRUE&EXCEPTIONS=application/vnd.ogc.se_inimage

tbonfort commented 12 years ago

Author: elzouavo Date: 2008/09/08 - 16:07 I have done 11 tests on MapServer 5.2.0 (with PropertyIsEqualTo anf/or PropertyIsLike and/or BBOX with an without node). I have also test matchCase.[[BR]]

'''All works OK only for the requests using PropertyIsEqualTo with matchCase without AND node.'''[[BR]]

Nothing works when a AND node is used.

See the ZIP file that contains :

NB : The ZIP contains also WFS tests.

tbonfort commented 12 years ago

Author: tomkralidis Date: 2008/09/22 - 18:43 Replying to [comment:11 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 ee73b87bfa3d832bc09200a7da72e973407e581f (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.

tbonfort commented 12 years ago

Author: assefa Date: 2009/11/12 - 21:03 Replying to [comment:12 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

tbonfort commented 12 years ago

Author: assefa Date: 2009/11/16 - 22:16 worked on this and the bug should be corrected in 52d4711f32012b3131dd33fce8287831bfc5c749 (r9549). (Please see #673) for details on the bug. Added an msautotest: wms_get_map_sld_proj.png (in wms_sld_proj.map)

tbonfort commented 12 years ago

Author: bartvde Date: 2009/12/10 - 10:42 I've done the following tests:

So all works fine. Thanks.