[mapserver-users] Mapserver Expressions

Eichner, Andreas - SID-NLKM Andreas.Eichner at sid.sachsen.de
Tue Dec 17 06:00:47 PST 2013


Substitution works quite well but classification does not because the class' expression hasn't been tokenized when msEvalExpression is called by msShapeGetClass.

Root cause of this is in msLayerWhichItems(maplayer.c) which shall tokenize the class' expression but doesn't due to making this dependent of the number of used items being greater than zero. Since you don't use items anywhere in your layer they won't be tokenized at all and will always fail (return FALSE) in msEvalExpression().

Basically it should be safe to simply comment out the if-expression in maplayer.c at line 700:

-  if(nt > 0) {
+  /* if(nt > 0) */ {

I strongly believe that this isn't intended behaviour and should be considered a bug.

> -----Ursprüngliche Nachricht-----
> Von: mapserver-users-bounces at lists.osgeo.org [mailto:mapserver-users-
> bounces at lists.osgeo.org] Im Auftrag von Lime, Steve D (MNIT)
> Gesendet: Montag, 16. Dezember 2013 22:00
> An: Charlie Allgrove; mapserver-users at lists.osgeo.org
> Betreff: Re: [mapserver-users] Mapserver Expressions
> 
> Did you get this fixed? The layer looks right to me. --Steve
> 
> 
> 
> From: mapserver-users-bounces at lists.osgeo.org [mailto:mapserver-
> users-bounces at lists.osgeo.org] On Behalf Of Charlie Allgrove
> Sent: Wednesday, December 11, 2013 11:11 AM
> To: mapserver-users at lists.osgeo.org
> Subject: [mapserver-users] Mapserver Expressions
> 
> 
> 
> Hi
> 
> 
> 
> I'm looking to change the symbol used on a given layer, based on the
> (Google) zoom level supplied to the mapserv CGI.
> 
> 
> 
> The Layer in question in the map file looks like this:
> 
> 
> 
> LAYER
> 
>     VALIDATION
> 
>         'tile'  '^[0-9]+ [0-9]+ [0-9]{1,2}$'
> 
>     END
> 
>     PROJECTION
> 
>         "init=epsg:4326"
> 
>     END
> 
>     NAME hubs
> 
>     TYPE point
> 
>     STATUS ON
> 
>     DATA 'hub_data.shp'
> 
>     CLASS
> 
>      EXPRESSION('%tile%' ~ '16$')
> 
>       NAME 'hub_layer_small'
> 
>       STYLE
> 
>         SYMBOL 'cloud_500'
> 
>       END #STYLE
> 
>     END #CLASS
> 
>     CLASS
> 
>       EXPRESSION('%tile%' ~ '17$')
> 
>       NAME 'hub_layer_large'
> 
>       STYLE
> 
>         SYMBOL 'cloud_200'
> 
>       END #STYLE
> 
>     END #CLASS
> 
>     CLASS
> 
>       NAME 'hub_layer_default'
> 
>       STYLE
> 
>         SYMBOL 'cloud_200'
> 
>        SIZE 2
> 
>       END #STYLE
> 
>     END #CLASS
> 
> 
> 
>     TEMPLATE "xxx"
> 
>         METADATA
> 
>             "wms_title" "Hub data layer"
> 
>         END
> 
>   END #LAYER
> 
> 
> 
> 
> 
> Requests are made to the CGI with the following example querystring:
> 
> ?layer=hubs&mode=tile&tilemode=gmap&tile=19288 24631 16
> 
> 
> 
> I *thought* it was possible to use EXPRESSION to test the 'tile'
> variable and act accordingly, but it's not working (I always get the
> default class used instead).
> 
> 
> 
> > ./mapserv -v
> 
> MapServer version 6.0.1 OUTPUT=GIF OUTPUT=PNG OUTPUT=JPEG
> SUPPORTS=PROJ SUPPORTS=AGG SUPPORTS=CAIRO SUPPORTS=FREETYPE
> SUPPORTS=ICONV SUPPORTS=FRIBIDI SUPPORTS=WMS_SERVER
> SUPPORTS=WMS_CLIENT SUPPORTS=WFS_SERVER SUPPORTS=WFS_CLIENT
> SUPPORTS=WCS_SERVER SUPPORTS=SOS_SERVER SUPPORTS=FASTCGI
> SUPPORTS=THREADS SUPPORTS=GEOS INPUT=POSTGIS INPUT=OGR INPUT=GDAL
> INPUT=SHAPEFILE
> 
> 
> 
> Any pointers? Thanks in advance.
> 
> 
> 
> Charlie
> 
> 



More information about the mapserver-users mailing list