[mapserver-users] Use STYLEITEM to style individual features?

Alexander Schenkel aschenkel at kadenpartner.ch
Thu Nov 29 07:59:32 PST 2012


Dear all,

We have the following setup:

Our features come as DB records out of a PostGIS 1.5 database, which
contains a column "mapserver_style" besides other data columns. We want
to use that column to style the individual features.

Since MapServer 6.0 (we use 6.0.2), the Mapserver LAYER config knows the
"STYLEITEM" configuration attribute, which takes the name of an
item (DB column, in our case), and, according to the documentation,
should contain a STYLE ...END string.

This seems not to be working or we use it the wrong way. Our Mapfile's
LAYER definition looks as follows (cleaned out
all irrelevant information):


######
LAYER
  NAME layername
  DATA "wkb_geometry from (SELECT
wkb_geometry,mapserver_style,some_other_data) as foo using SRID=21781,
using unique ogc_fid"
 
  TYPE POINT
  STATUS ON
  OPACITY 100
  DUMP TRUE
  STYLEITEM "mapserver_style"

  CLASS
  END
END
######

while "mapserver_style" corresponds to the database column containing
the "STYLE .... END" string.

As an example, the "mapserver_style" column for a single feature contains:

STYLE
    SIZE 10
    COLOR 135 255 135
    OUTLINEWIDTH 2
    OUTLINECOLOR 0 0 0
    SYMBOL 'filled square'
END

which does NOT draw any visible feature on the map.

If we just surround this example with "CLASS .... END", it basically
works, BUT the class(es) then match every single feature, leading to
overlapping feature symbols
for every single feature appearing after the class has been defined:

CLASS
    STYLE
        SIZE 10
        COLOR 135 255 135
        OUTLINEWIDTH 2
        OUTLINECOLOR 0 0 0
        SYMBOL 'filled square'
    END
END

So can anybody tell us how we can style features on a per-feature basis
using the STYLEITEM config? Or is this the wrong way?

Many thanks for your support,

alex







More information about the MapServer-users mailing list