[mapserver-dev] Version conditionals in mapfile?

Stephen Woodbridge woodbri at swoodbridge.com
Sun Dec 22 14:36:41 PST 2013


Hi all,

I want to start a discussion on the possibility of adding version 
conditionals to mapfile to make it easier to support a single mapfile 
across multiple versions of mapserver.

The idea would be to add some syntax that would allow something like:

IF VERSION <op> <value>
   ... use if true
ENDIF

or may be in short hand

VERSION<op>(<value>) ... use if true to end of line
or
VERSION <op> <value>? ... use if true to end of line

where <op> could be like GT|GE|EQ|LE|LT
and <value> could be VVvv or VV.vv where VV is the major version and vv 
is the minor version and patch should not impact mapfile syntax so we 
could ignore them.

Yes, this could be done using the C preprocessor or a script, but that 
does not solve the use case of having a single file that can be deployed 
and work for various versions of mapserver.

In a production environment, you might have multiple mapfiles and 
multiple versions of mapserver. This would greatly simplify maintaining 
the production server or migrating applications between servers that 
might have different versions of mapserver installed.

Why do I care? I'm in the process of upgrading a bunch of servers and 
I'm annoyed by the fact that I have 3 versions of mapserver that I need 
to support and I'm having to make three separate mapfiles that are 99% 
the same. Oh and this has the ripple effect that if you name these with 
a version number in the mapfile name, than all the applications that 
reference the mapfile have to know what version they are requesting maps 
from so they can specify the correct version named mapfile.

Discussion:

Does this sound like something that would be useful to our users?

On the surface, this seems like it should be fairly easy to implemented 
in the parser, but I could be wrong.

Any thoughts on this?

-Steve W


More information about the mapserver-dev mailing list