[mapserver-users] Re: Feature wish: Internal mapfile variables

Rahkonen Jukka Jukka.Rahkonen at mmmtike.fi
Tue Oct 4 09:43:52 EDT 2011


Hi,

Nice to see that the idea that I stole from Thomas but that is obviously invented a long time ago by other people too aroused so much discussion. There was some dreaming about more advanced things that I had on my mind but your and Michael's suggestions are simple enough for me to follow.

I was using a name "internal mapfile variable" because I was thinking that contrary to other variables they could not be set from the outside world. If the only way to set them is to write them into the mapfile either directly or through INCLUDE (Stephen's idea which I like a lot) then I suppose that they could be used wherever in the mapfile without any bigger security risk than the one you take by deciding to write a mapfile. Letting users to select from the ready made parameter collections by sending the INCLUDE client_id can be considered safe too, at least if the %client_id% is validated.

With the INCLUDEs and client-params files the old OSM styles by Thomas Bonfort, for example with the Bing style parameters
http://code.google.com/p/mapserver-utils/source/browse/archive/bing.style
or alternatively Mapserver style parameters
http://code.google.com/p/mapserver-utils/source/browse/archive/mapserver.style

could be easily applied with one main mapfile and separate style parameter files. A fixed style could be used by having in the main mapfile line
INCLUDE "bing-style-parameters"
and user selectable styles by using the input variable as Stephen suggested
INCLUDE "client-params-%client_id%.inc"

It would be much more fun to fine tune the map appearance by editing the style parameter file that to touch the thousand lines long main mapfile. Using Python scripts and c preprocessor is not a real alternative for unqualified users like me, especially on Windows when the preprocessor must be run through cygwin.

Besides, at the moment Mapserver does not support WMS STYLES as the documentation http://mapserver.org/ogc/wms_server.html says:

"STYLES=style_list: Comma-separated list of one rendering style per requested layer. Optional if SLD parameter is present. NOTE that MapServer does not support named styles, so most times you would specify "STYLES=" with an empty value. MapServer does support STYLES when used with an SLD."

I can somehow imagine that the STYLES= parameters could be converted into the INCLUDEd style parameter sets and that way we could get the missing WMS style support too.

-Jukka Rahkonen-


> -----Alkuperäinen viesti-----
> Lähettäjä: mapserver-users-bounces at lists.osgeo.org 
> [mailto:mapserver-users-bounces at lists.osgeo.org] Puolesta 
> Stephen Woodbridge
> Lähetetty: 3. lokakuuta 2011 21:52
> Vastaanottaja: mapserver-users at lists.osgeo.org
> Aihe: Re: [mapserver-users] Re: Feature wish: Internal 
> mapfile variables
> 
> One idea regarding this that you might want to consider is 
> the ability 
> to put all the named parameters in an include file, then be able to 
> include that file via a CGI parameter. So it might look like this:
> 
> 
> MAP
>    INCLUDE "client-params-%client_id%.inc"
>    ...
> END
> 
> And then you could have parameter files like:
> 
> client-params-27.inc
> client-params-123.inc
> etc.
> 
> And these would include nothing but your SET ... commands.
> 
> Then when requesting the map:
> 
> /http://localhost/cgi-bin/mapserv?client_id=123&mode=map&map=/
path/to/mapfile.map&...
> 
> This would make it very easy to manage a single mapfile for 
> parameters 
> that are different for each client/user.
> 
> Obviously the client_id could be set via a cookie, or a 
> wrapper script, 
> or a session variable, or manually, etc.
> 
> -Steve W
> 
> On 10/3/2011 2:39 PM, reholl wrote:
> > I'm interested in working on capabilities along these 
> lines.  Are there
> > existing RFCs that touch on this?  If not, perhaps one 
> should be created.
> >
> > This overlaps some configuration ideas I've been mulling 
> over.  From the
> > original comment here about internal vars being handy for 
> "/when the same
> > layers are re-used for several customers who like to have a 
> bit different
> > styling for the same source data/" it occurs to me that a 
> matrix or some
> > other constructs more complex than a flat list of internal 
> variables might
> > be called for -- provided they don't turn the mapfile and 
> internal mapserv
> > into spaghetti..
> >
> > Jukka Rahkonen (have I ordered your name properly?), do you 
> want to start an
> > RFC on this?
> >
> > To anyone -- would this conversation typically migrate over 
> to 'dev' ?
> >
> > Robert Hollingsworth
> >
> >
> > I agree that this is a request that comes up often. As 
> usual we'd just
> > need someone to lead the effort.
> >
> > On 11-10-03 12:12 AM, Rahkonen Jukka wrote:
> >> Hi,
> >>
> >> Inspired by the Thomas Bonfort's rendering chain I have 
> been thinking if
> >> we could have a native support for using  internal mapfile 
> variables.  Now
> >> Thomas is setting for example a bunch of colours in a 
> definition file
> >> which is converted into a real mapfile with python script and c
> >> preprocessor.
> >> http://mapserver-utils.googlecode.com/svn/trunk/README
> >> http://mapserver-utils.googlecode.com/svn/trunk/generate_style.py
> >>
> >> I would like to see a simple way for setting the variables 
> directly in the
> >> mapfile, somehow like
> >> MAP
> >> SET "pedestrian_clr"  "#fafaf5"
> >> SET "forest_clr" "#dcdcb4"
> >> SET "industrial_clr" "#ebe5d9"
> >> ....
> >>
> >> And then later in the layers use
> >> LAYER
> >> .....
> >> COLOR %pedestrian_clr%
> >>
> >> The internal variables could be interpreted only from the 
> mapfile and they
> >> could not be altered by the web users.
> >>
> >> Internal variable would help in maintaining big mapfiles 
> with repeating
> >> styles like in the OpenStreetMap rendering case.  Another 
> use case is when
> >> the same layers are re-used for several customers who like 
> to have a bit
> >> different styling for the same source data.
> >>
> >> -Jukka Rahkonen-
> >>
> >
> > --
> > View this message in context: 
> http://osgeo-org.1803224.n2.nabble.com/Feature-wish-Internal-m
apfile-variables-tp6853853p6856070.html
> > Sent from the Mapserver - User mailing list archive at Nabble.com.
> > _______________________________________________
> > 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