Opened 19 years ago

Closed 19 years ago

#1252 closed defect (fixed)

like filter starting with wildcard does not work

Reported by: bartvde@… Owned by: mapserverbugs
Priority: high Milestone:
Component: MapScript-PHP Version: 4.4
Severity: normal Keywords:
Cc:

Description

Using the Chameleon querybuilder to select everything ending with 'kerk', we get
the following regular expression generated by mapscript (wildcard used is @):

"cham_x_build_expressions"	"|@|0|GEMNAAM|LIKE||@kerk|"

EXPRESSION /*økerk/

This should be EXPRESSION /.*kerk$/ or not?

Change History (5)

comment:1 by assefa, 19 years ago

Bart,

 The lowlevel code should conver the wild character to ".*" (Bug #1107)
(somthing like @kirk should give /*.kirk/ 
 What exactly is the content of the ogc filter ?  I am a bit confused reading
the "cham_x_build_expressions". 
 

comment:2 by bartvde@…, 19 years ago

Hi Assefa,

I specify the following in the Chameleon querybuilder: GEMNAAM LIKE @kerk with @ 
as wildcard.

the filter generated by Mapscript is:

<StyledLayerDescriptor version="1.0.0" xmlns="http://www.opengis.net/sld" xmlns:
gml="http://www.opengis.net/gml" xmlns:ogc="http://www.opengis.net/ogc" xmlns:
xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/
XMLSchema-instance" xsi:schemaLocation="http://www.opengis.net/sld http://
schemas.opengeospatial.net/sld/1.0.0/StyledLayerDescriptor.xsd">
<NamedLayer>
<Name>gemeentes</Name>
<UserStyle>
<FeatureTypeStyle>
<Rule>
<ogc:Filter><AND><BBOX><PropertyName>Name</PropertyName><gml:Box 
srsName=''><coordinates>95499.9999999,496422.222222 140166.666667,523222.
222222</coordinates></gml:Box></BBOX><ogc:PropertyIsLike wildCard="*" 
singleChar="#" escape="!"><ogc:PropertyName>GEMNAAM</ogc:PropertyName><ogc:
Literal>*økerk</ogc:Literal></ogc:PropertyIsLike></AND></ogc:Filter>
<MinScaleDenominator>10000.000000</MinScaleDenominator>
<MaxScaleDenominator>400000.000000</MaxScaleDenominator>
<PolygonSymbolizer>
<Fill>
<CssParameter name="fill">#ff0000</CssParameter>
</Fill>
</PolygonSymbolizer>
</Rule>
</FeatureTypeStyle>
</UserStyle>
</NamedLayer>
</StyledLayerDescriptor>

The complete LAYER definition is:

  LAYER
    CLASSITEM "GEMNAAM"
    CONNECTION "http://geoservice1-agi.minvenw.nl/cgi-bin/mapserv.exe?map=/ms4w/
apps/general/map/gemeentes.map&&ttt=1"
    CONNECTIONTYPE WMS
    DUMP TRUE
    MAXSCALE 400000
      METADATA
        "wms_srs"	"EPSG:28992 EPSG:4326"
        "wms_onlineresource"	"http://geoservice1-agi.minvenw.nl/cgi-bin/oracle/
mapserv.exe?map=/ms4w/apps/general/map/gemeentes.map&"
        "cham_x_build_expressions"	"|@|0|GEMNAAM|LIKE||@kerk|"
        "wms_style_default_title"	""
        "wms_latlonboundingbox"	"2.68506 49.54247 7.75847 54.61588"
        "wms_style_default_legendurl"	"0 0  "
        "wfs_filter"	"<BBOX><PropertyName>Name</PropertyName><gml:Box 
srsName=''><coordinates>95499.9999999,496422.222222 140166.666667,523222.
222222</coordinates></gml:Box></BBOX>"
        "layer_index"	"3"
        "wms_name"	"gemeentes"
        "wms_formatlist"	"image/jpeg,image/png"
        "wms_format"	"image/png"
        "selected"	"0"
        "wms_sld_body"	"auto"
        "wms_boundingbox"	"EPSG:28992 0 288007.5 288009 624000"
        "LEGEND_ORDER"	"3"
        "wms_server_version"	"1.1.0"
        "wms_title"	"Gemeentes"
        "wms_style"	""
      END
    MINSCALE 10000
    NAME "ExpressionBuilderAnnotation"
    PROJECTION
      "init=epsg:28992"
    END
    SIZEUNITS PIXELS
    STATUS ON
    TEMPLATE ""
    TOLERANCE 0
    TOLERANCEUNITS PIXELS
    TYPE POLYGON
    UNITS METERS
    CLASS
      EXPRESSION /*økerk/
      METADATA
      END
      STYLE
        ANGLE 360
          COLOR 255 0 0
        MAXSIZE 500
        MINSIZE 1
        SYMBOL 0
      END
    END
  END

Could it be a Chameleon problem instead of a Mapscript problem you think?

comment:3 by bartvde@…, 19 years ago

I have debugged this in the Chameleon code, it seems a problem with the applySLD 
function from Mapscript.

Here my debug info:

From expressionbuilder.widget.php:

Line 311:
                                else
                                {
                                    // version of mapscript does not support
                                    // so use own method
                                    echo '<h1>'.$szFilterString.'</h1>';

Contains:

<h1><AND><BBOX><PropertyName>Name</PropertyName><gml:Box 
srsName=''><coordinates>-116666.666667,285000 441666.666667,620000</
coordinates></gml:Box></BBOX><PropertyIsLike wildcard='@' singleChar='.' 
escape='!'><PropertyName>GEMNAAM</PropertyName><Literal>@kerk</Literal></
PropertyIsLike></AND></h1>

So this still seems correct.

Following debug part (around line 910):

        echo '<h2>'.$szSLD.'</h2>';
        // apply sld to layer to create classes
        $oTmpLayer->applySLD( $szSLD, $szLayerName );

contains:
<h2><StyledLayerDescriptor version="1.0.
0"><NamedLayer><Name>expressionbuildertempsld</
Name><UserStyle><FeatureTypeStyle><Rule><Filter><AND><BBOX><PropertyName>Name</
PropertyName><gml:Box srsName=''><coordinates>-116666.666667,285000 441666.
666667,620000</coordinates></gml:Box></BBOX><PropertyIsLike wildcard='@' 
singleChar='.' escape='!'><PropertyName>GEMNAAM</PropertyName><Literal>@kerk</
Literal></PropertyIsLike></AND></Filter><PointSymbolizer>
                                <Graphic>
                                  <Size>5</Size>
                                  <Mark>
                                    <WellKnownName>square</WellKnownName>
                                    <Fill>
                                      <CssParameter name="fill">#ff0000</
CssParameter>
                                    </Fill>
                                  </Mark>
                                </Graphic>
                              </PointSymbolizer></Rule></FeatureTypeStyle></
UserStyle></NamedLayer></StyledLayerDescriptor></h2>

So still okay.

Last debug (around line 923):
        // get first class
        if ( $oTmpLayer->numclasses > 0 )
        {
            // get first class
            $oClass = $oTmpLayer->getClass(0);

            // get expression
            echo '<h3>'.$oClass->getExpression().'</h3>';
            $aszReturn[0] = $oClass->getExpression();

contains:
<h3>/*økerk/</h3>

Here it is messed up.

comment:4 by assefa, 19 years ago

Bart,

 I corrected the bug that seems to give you this problem (new version of
mapogcfilter.c). Please give it a try and let me know. The correction was
applied in the 4.5 branch as well as the 4.4.x branch.

comment:5 by bartvde@…, 19 years ago

Resolution: fixed
Status: newclosed
Hi Assefa,

I tested with CVS version, and compiled a php_mapscript dll, it works fine now.

Thanks!

Setting status to fixed.

Bart
Note: See TracTickets for help on using tickets.