I've got a spatial table in Oracle and a WMS-T in Mapserver, defined in a layer that query that table. The table has several columns and I pass the column to select as a parameter in OpenLayers, so the layer definition in mapserver is the following:
LAYER
NAME "layer_example"
CONNECTION "oracle/user@oracleservice/oracle"
CONNECTIONTYPE ORACLESPATIAL
DATA "geom FROM (SELECT E.%type% as value, E.YEAR as YEAR, E.SHAPE_60M as geom FROM EMISSIONS E
WHERE E.level=%level% ) USING NONE"
TYPE POLYGON
STATUS OFF
TRANSPARENCY 100
VALIDATION
'level' '^[0-9]$'
'type' '^[a-zA-Z0-9]+$' #column name
END
PROJECTION
"init=epsg:4326"
END
UNITS METERS
SIZEUNITS PIXELS
TOLERANCE 0
TOLERANCEUNITS PIXELS
CLASSITEM value
### LEGEND DEFINITION HERE ###
METADATA
"ows_title" "emissions"
"ows_srs" "EPSG:3035 EPSG:4326 EPSG:900913"
"ows_timeformat" "YYYY"
"ows_timeextent" "2000/2011"
"ows_timeitem" "YEAR"
"ows_timedefault" "2000"
"wms_enable_request" "*"
"wms_metadataurl_format" "text/xml"
"wms_metadataurl_type" "ISO19115:2003"
END
END
The problem is the legend! Since the columns in the table has got different classes of values for their legends, how can I define the legend on fly? I tried to define legends in different files and then INCLUDE "legend_%type%.map", but the variable substitution doesn't work for INCLUDE. Actually, it would be great if Mapserver had this feature.
Anyway, some ideas and suggestions? Hope the question is clear!