read up the mapfile

Steve Lime steve.lime at DNR.STATE.MN.US
Sat Sep 3 12:04:53 EDT 2005


There you go! And only 10 lines of code. You should post this to mapserver-users. Might get some other folks to help run with it.

Steve

>>> Huub Fleuren <hfl at HOME.NL> 09/02/05 1:51 PM >>>
Okay,
This is a rudimentary include for the actual labour pre-preprocessing fase
works with awk (on windows with awk95, a 32bit version of awk (long names))
http://cm.bell-labs.com/cm/cs/who/bwk/awk95.exe

any (recursive) perl code can do the same

t'is run by

awk95 -f include.awk  
your_main_map_template.map_stuffed_with_INCLUDE_filenames

example mapfile

MAP
  INCLUDE include_files.txt
  INCLUDE web.txt
  INCLUDE legend.txt
  INCLUDE scalebar.txt
  INCLUDE first.layer
  INCLUDE second.layer
  INCLUDE third.layer
  #INCLUDE not_this.layer
END
layers 1,2 and 3 could INCLUDE a_common.class


*file contents : include.awk*
BEGIN {
    OUTPUT = "my.map"
    while ((error = getline) == 1) {
        gsub(/^.*[I]/,"I")
        if ($1 == "INCLUDE") {
            print "#"$2 >> OUTPUT
            system ("awk95 -f include.awk " $2)
        } else {
            print $0 >> OUTPUT
        }
    }
}


Regards, Huub



More information about the mapserver-dev mailing list