RE [Polluriel potentiel] Re: [mapserver-users] Issue with run-time substitution?

Steve.Toutant at inspq.qc.ca Steve.Toutant at inspq.qc.ca
Wed Aug 31 08:34:08 EDT 2011


Since you don't have a FILTERITEM I don't I don't understand why this is 
working FILTER  (%wfilter%)


Perhaps you should use the brackets and "" if the data type is a string
Per example, if uc is char  I would write this
FILTER ("[uc]" = "%vucv%")
If it is a number
FILTER ([uc] = "%vucv%")






Stephen Davies <sdavies at sdc.com.au>@lists.osgeo.org 
Envoyé par : mapserver-users-bounces at lists.osgeo.org
2011-08-30 21:33
Veuillez répondre à
sdavies at sdc.com.au


A
mapserver-users at lists.osgeo.org
cc

Objet
[Polluriel potentiel]  Re: [mapserver-users] Issue with run-time 
substitution?








I have further reduced a test map file and changed the sequence of 
statements 
but one substitution still fails.

I have a number of other map files where substitution works as expected 
and the 
wfilter substitution in this example also works as expected but I cannot 
see 
what is different about the vucv case.

The URL looks like this:

http://www.agua.com.au/cgi-bin/mapserv?map=/tmp/q.map
&mapext=138.4324071+-35.2807010+138.5729945+-35.1222989
&mre=-1070114.26+-4230140.65+289096.72+-2872042.86
&wfilter=id+in+%2847%29&vucv=137_11

The minimal map file is:

# template map file for Agua Soil Database Water Mgt
#
MAP
  NAME watermgt
 

    PROJECTION
                 "proj=eqc"
        "ellps=GRS80"
        "towgs84=0,0,0"
        "no_defs"
       "lon_0=138.503e"
    END

    SIZE 600 600
    FONTSET "/var/www/html2/benparts/fonts.list"
    SYMBOLSET "/var/www/html2/benparts/symbols"
    UNITS METERS
    IMAGETYPE  jpeg
    OUTPUTFORMAT
                 NAME 'AGG_JPEG'
                 DRIVER AGG/JPEG
                 IMAGEMODE RGB
                 FORMATOPTION "QUALITY=100"
    END
    IMAGECOLOR 255 255 255

    WEB
                 template /var/www/html2/benparts/templates/test1.html
                 imagepath "/var/www/html2/tmp/"
                 imageurl  "/tmp/"
                 LOG "/tmp/mapserv.log"
    END

    LEGEND
                 KEYSIZE 18 12
                 LABEL
                   TYPE BITMAP
                   SIZE MEDIUM
                   COLOR 0 0 94
                 END
                 STATUS ON
    END

    LAYER
      TYPE RASTER
      NAME "bkgrnd"
      STATUS ON
      PROJECTION
       "init=epsg:4283"
      END
      DATA "/var/www/html2/benparts/rasters/JB_Onka_IPOS_Ver2.jpg"
      PROCESSING "DITHER=YES"
    END

    LAYER
      CONNECTIONTYPE postgis
      NAME "weather"
      DATA "geom from weather_station"
      CONNECTION "user=scldad dbname=benparts"
      PROCESSING      "CLOSE_CONNECTION=DEFER"
      STATUS ON
      TYPE POINT
      VALIDATION
        wfilter 'id in.*'
      END
      FILTER  (%wfilter%)
      PROJECTION
        "init=epsg:4283"
      END
      LABELITEM "name"
      CLASS
        NAME       "Weather Station"
        STYLE
          COLOR        214 0 0
          SYMBOL 'circle'
          SIZE 7
        END
        LABEL
          MINDISTANCE 150
          POSITION CR
          SIZE TINY
          COLOR 9 9 9
          STYLE
                GEOMTRANSFORM 'labelpoly'
                COLOR   255 255 255
          END
        END
      END
    END
 
     LAYER
      CONNECTIONTYPE postgis
      NAME "battery"
      VALIDATION
                 vucv '.*'
      END
      DATA "geom from wmd using unique id using SRID=4283"
      CONNECTION "user=scldad dbname=benparts"
      STATUS ON
      TYPE POINT
      FILTER  (uc='%vucv%' and stype='B')
      PROJECTION
        "init=epsg:4283"
      END
      MAXSCALE 5000000
      LABELITEM "label"
      CLASSITEM "state"
      CLASS
                 EXPRESSION "G"
        STYLE
          COLOR        0 255 0
          SYMBOL 'dot'
                   SIZE 7
                   OFFSET 17 0
        END
        LABEL
          POSITION CR
          TYPE TRUETYPE
          FONT arial
          SIZE 8
          COLOR 0 255 0
                   OFFSET 20 0
                   FORCE TRUE
                   STYLE
                                 GEOMTRANSFORM 'labelpoly'
                         COLOR   255 255 255
                   END
        END
      END
      CLASS
                 EXPRESSION "A"
        STYLE
          COLOR        255 215 0
          SYMBOL 'dot'
                   SIZE 7
                   OFFSET 17 0
        END
        LABEL
          POSITION CR
          TYPE TRUETYPE
          FONT arial
          SIZE 8
          COLOR 255 215 0
                   OFFSET 20 0
                   FORCE TRUE
                   STYLE
                                 GEOMTRANSFORM 'labelpoly'
                         COLOR   255 255 255
                   END
        END
      END
      CLASS
                 EXPRESSION "R"
        STYLE
          COLOR        255 0 0
          SYMBOL 'dot'
                   SIZE 7
                   OFFSET 17 0
        END
        LABEL
          POSITION CR
          TYPE TRUETYPE
          FONT arial
          SIZE 12
          COLOR 255 0 0
                   OFFSET 20 0
                   FORCE TRUE
                   STYLE
                                 GEOMTRANSFORM 'labelpoly'
                         COLOR   255 255 255
                   END
        END
      END
    END
  #
  # Start of reference map
  #
  REFERENCE
    IMAGE /var/www/html2/benparts/refmaps/sa.png
    EXTENT -1070114.26 -4230140.65 289096.72 -2872042.86
    SIZE 120 120
    STATUS ON
    MINBOXSIZE 5
    MAXBOXSIZE 100
    COLOR 0 255 0
    OUTLINECOLOR 0 0 0
    MARKERSIZE 8
    MARKER 'star'
  END
  #
  # Start of scalebar
  #
  SCALEBAR
    IMAGECOLOR 0 0 0
    LABEL
      COLOR 255 255 255
      SIZE TINY
    END
    STYLE 1
    SIZE 200 2
    COLOR 255 255 255
    UNITS KILOMETERS
    INTERVALS 2
    TRANSPARENT TRUE
    STATUS ON
  END
END

When I run this, the Postgresql log shows:

LOG:  duration: 0.127 ms  execute <unnamed>: select 
"name",encode(ST_AsBinary(ST_Force_2D("geom"),'NDR'),'hex') as geom,"id" 
from 
weather_station where geom && GeomFromText('POLYGON((138.42349975 
-35.280701,138.42349975 -35.1222989,138.58190185 -35.1222989,138.58190185 
-35.280701,138.42349975 
-35.280701))',find_srid('','weather_station','geom')) 
and (id in (47))
LOG:  duration: 0.060 ms  execute <unnamed>: select 
"state","label",encode(ST_AsBinary(ST_Force_2D("geom"),'NDR'),'hex') as 
geom,"id" from wmd where geom && GeomFromText('POLYGON((138.42349975 
-35.280701,138.42349975 -35.1222989,138.58190185 -35.1222989,138.58190185 
-35.280701,138.42349975 -35.280701))',4283) and (uc='%vucv%' and 
stype='B')

This illustrates that the wfilter substitution worked but the vucv 
substitution 
did not.

Cheers,
Stephen
-- 
=============================================================================
Stephen Davies Consulting P/L                             Voice: 08-8177 
1595
Adelaide, South Australia.                                Fax  : 08-8177 
0133
Records & Collections Management.                         Mobile:040 304 
0583
_______________________________________________
mapserver-users mailing list
mapserver-users at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users



-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/mapserver-users/attachments/20110831/70281f02/attachment.html


More information about the mapserver-users mailing list