[mapserver-users] how to map_layer_class_name in 6.4.0?

Rahkonen Jukka (Tike) jukka.rahkonen at mmmtike.fi
Thu Jan 30 02:16:36 PST 2014


Yes, so it goes.  Mapfile must look like this
....
  VALIDATION
        "title" "."
  END
        CLASS
        NAME "Natura2000"
        TITLE "FOO"
...

This shows FOO in the legend but it can be changed to BAR with

https://.../cgi-bin/...?REQUEST=GetLegendGraphic&SERVICE=WMS&VERSION=1.1.1&LAYER=Natura2000&format=image/png&map.layer[Natura2000].class[0]=TITLE+BAR


Thomas Bonfort wrote:
> Lähetetty: 30. tammikuuta 2014 12:04
> Vastaanottaja: mapserver-users at lists.osgeo.org
> Aihe: Re: [mapserver-users] how to map_layer_class_name in 6.4.0?
> 
> looking through the code, you are allowed to update the class->title, however
> you must supply a "title" validation entry for it (set it to ".*" if you want to allow
> any title)
> 
> --
> thomas
> 
> On 30/01/2014 09:26, Rahkonen Jukka (Tike) wrote:
> > 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&SERV
> > ICE=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&SERV
> >
> ICE=WMS&VERSION=1.1.1&LAYER=Land&FORMAT=image/png&map.layer[land
> ].clas
> > s[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&SERV
> >
> ICE=WMS&VERSION=1.1.1&LAYER=Land&FORMAT=image/png&map.layer[land
> ].clas
> > s[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
> > _______________________________________________
> > 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