[mapserver-users] how to map_layer_class_name in 6.4.0?

Rahkonen Jukka (Tike) jukka.rahkonen at mmmtike.fi
Thu Jan 30 00:26:17 PST 2014


Hi,

Let's try to make more people involved. We have a server to play with online, so everybody can have a try. Let's have a look at the default legend item
http://demo.mapserver.org/cgi-bin/foss4g?REQUEST=GetLegendGraphic&SERVICE=WMS&VERSION=1.1.1&LAYER=Land&FORMAT=image/png

It is possible to change the legend fill this way
http://demo.mapserver.org/cgi-bin/foss4g?REQUEST=GetLegendGraphic&SERVICE=WMS&VERSION=1.1.1&LAYER=Land&FORMAT=image/png&map.layer[land].class[0].style[0]=+COLOR+0+255+0

Now we need only an url that changes the legend title to something else than "Coastlines". I made a few unsuccessful trials starting from
http://demo.mapserver.org/cgi-bin/foss4g?REQUEST=GetLegendGraphic&SERVICE=WMS&VERSION=1.1.1&LAYER=Land&FORMAT=image/png&map.layer[land].class[0]=NAME+FOO

Let's see if someone discovers the right syntax. Documentation does not help much with this but page http://mapserver.org/cgi/controls.html suggests that almost everything is possible for those who know the secret
"Beginning with version 3.3 it is possible to change virtually any map file value from a form or a URL (see Run-time Substitution). The syntax for this is fairly straightforward, and depends on what version of MapServer you are using. One potentially very powerful use of this ability to change mapfile parameters through a URL involves changing class expressions on-the-fly. VALIDATION is used to control run-time substition. Try it out."

This could be understood that all substitutions via URL would require validation but fortunately that is not true or otherwise changing styles with this method would not generally work. 

-Jukka Rahkonen-

thomas bonfort wrote:
> 
> Try changing/using the class title instead of the class name , I suspect the name
> properties are identifiers that cannot be updated by url.
> 
> 
> --
> thomas
> 
> On 29 January 2014 02:47, zach cruise <zachc1980 at gmail.com> wrote:
> > in the past, I could do a runtime substitution of a class name by
> > passing it like so:
> >
> > ..&map_layer1_class1_name=new_name
> >
> > where in the map file, I had:
> >
> > MAP
> >  LAYER
> >   NAME "layer1"
> >   CLASS
> >    NAME "class1"
> >
> > and in the legend file, I had:
> >
> > [leg_class_name]
> >
> > so what changed?
> > _______________________________________________
> > mapserver-users mailing list
> > mapserver-users at lists.osgeo.org
> > http://lists.osgeo.org/mailman/listinfo/mapserver-users
> _______________________________________________
> mapserver-users mailing list
> mapserver-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapserver-users


More information about the mapserver-users mailing list