[mapserver-users] Mapserver Expressions
Charlie Allgrove
charlie.allgrove at bsgwireless.com
Tue Dec 17 08:28:08 PST 2013
So...
Given my shapefile contains 2 attributes only, LAT and LONG, I *think*
you're suggesting something like this:
Adding CLASSITEM 'LAT' into the LAYER
and modifying the expressions in my original post (for example)
FROM
...
EXPRESSION('%tile%' ~ '16$')
...
TO
...
EXPRESSION(('%tile%' ~ '16$') && ([LAT] ne 0))
...
Given my dataset, it's a safe assumption that LAT will never be 0.
Does that sound about right?
Thanks in advance!
Charlie
-----Original Message-----
From: Lime, Steve D (MNIT) [mailto:Steve.Lime at state.mn.us]
Sent: 17 December 2013 15:50
To: Eichner, Andreas - SID-NLKM; Charlie Allgrove;
mapserver-users at lists.osgeo.org
Subject: RE: [mapserver-users] Mapserver Expressions
Assuming Andreas is correct, yes this would be a bug given cases like this.
I can create a ticket titled "Expressions without column references fail.".
As a work around Charlie could add a sub-expression to those expressions
that depend on a column but that always evaluate to true.
Steve
-----Original Message-----
From: Eichner, Andreas - SID-NLKM [mailto:Andreas.Eichner at sid.sachsen.de]
Sent: Tuesday, December 17, 2013 8:01 AM
To: Lime, Steve D (MNIT); Charlie Allgrove; mapserver-users at lists.osgeo.org
Subject: AW: [mapserver-users] Mapserver Expressions
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