[mapserver-users] Dynamic LabelItem

Steve Lime Steve.Lime at dnr.state.mn.us
Mon Jun 29 11:50:20 PDT 2009


MapServer 5.4 does open up this possibility. It's not done via substitution but rather by passing
a bit of mapfile syntax. For example, 

  ...&map.layer[foo]=LABELITEM+newitem&...

However, you must set a validation pattern for MapServer to compare the new value against before
it will change it. So your layer definition might look like:

LAYER
  NAME 'foo'
  ...
  VALIDATION
    'labelitem' '^item1|item2|item3$'
  END
  ...
  LABELITEM 'item1'
END

In this case you could dynamically change LABELITEM to item1, item2 or item3 but item4 would throw
an error. Hope this helps.

Steve

>>> On 6/29/2009 at 1:08 PM, in message <1246298901193-3176090.post at n2.nabble.com>,
stretch <andrew.deklerk at gmail.com> wrote:

> Anyone have any ideas?
> 
> stretch wrote:
>> 
>> Hi All
>> 
>> We are using mapserv cgi to generate WMS and access via openlayers.
>> 
>> Searching reveals that it is not possible to dynamically change the
>> labelitem by substitution i.e
>> LABELITEM='%LABELFIELD%'
>> 
>> Is it possible however to do it via &map_layername_labelitem="labelfield"
>> in your url, or any other such method. Any help would be really
>> appreciated, because otherwise it means creating different layers for each
>> labelling option.
>> 
>> Thanks
>> Andrew 
>> 




More information about the MapServer-users mailing list