<html>
<head><title></title></head>
<body><div class="iw_mail" dir="ltr">
<p style="margin:0;">Hi Jörg,<br><br>I also had this same thought and it would be a good mechanism.<br>But I solved it with my own preprocessing.<br><br>I have been doing Nautical charts with Mapserver for a<br>couple of years and realized that I was reusing<br>the same layers up to 18 times. <br><br>So I did templates where I had LAYER->NAME, LAYER->GROUP,<br>LAYER->DATA and STYLE->COLOR as variables in Mapserver templates. <br>Color for instance has fixed names like "DEPVS",<br>that means depth very shallow. <br>But depending on if it is day mode, dawn dusk mode or night mode<br>the colors have different rgb or hex values. <br>All variables are stored in csv files.  The variables are read into<br>associative arrays in a bash script.  Then  I use my Mapserver<br>mapfile templates that are processed with a very long sed statement<br>that substitutes the variables depending on color mode and scale level.  <br><br>Layer names and groups have one csv file that tells how to<br>assemble all the layers.  To make it even more flexible, I can<br>also use offical IHO colors, Swedish or French color tables<br>to get different look and feel.<br><br>An example is for instance the layer template for rivers:<br><br>#### Rivers Lines ####<br><br>LAYER<br>    NAME  "Rivers_line_{CL}"<br>    GROUP "{GROUP}"<br>    METADATA<br>        "ows_title"   "Rivers"<br>        "ows_enable_request"   "*"<br>        "gml_include_items" "all"<br>        "wms_feature_mime_type" "text/html"<br>    END<br>    TEMPLATE blank.html<br>    TYPE LINE<br>    STATUS ON<br>    MAXSCALEDENOM {MAXSCALE}<br>    DATA "{PATH}"<br>    CLASS<br>        NAME "Rivers (lines)"<br>        STYLE<br>           # DEPVS<br>           # RGB # COLOR {DEPVS_rgb}<br>           COLOR "{DEPVS}"<br>           WIDTH 1.5<br>           # RGB # COLOR {OUTLL_rgb}<br>           OUTLINECOLOR "{OUTLL}"<br>           OUTLINEWIDTH 0.3<br>        END<br>    END<br>END<br><br><br>All this can be seen in the git hub:  <a href="https://github.com/LarsSchy/SMAC-M">https://github.com/LarsSchy/SMAC-M</a><br>I finally got permission from my company to release it this summer, so that we can discuss this.<br>I would like to do a demo site with open data, but haven't had time to do this yet.<br><br>The script: process_layer_color.sh shows the real processing part and the sed script.<br><br><a href="https://github.com/LarsSchy/SMAC-M/blob/master/chart-installation/generate_map_files/scripts/process_layer_colors.sh">https://github.com/LarsSchy/SMAC-M/blob/master/chart-installation/generate_map_files/scripts/process_layer_colors.sh</a><br><br>Have fun<br><br>Lars Schylberg<br>Saab AB<br></p>
<br><div dir="ltr" style="font-size: 13px; font-family: Lucida Console,Courier New,Courier,Monospace;">-----Originalmeddelande-----<br>> Från: "Jörg Thomsen (WhereGroup)" <<a href="mailto:joerg.thomsen@wheregroup.com">joerg.thomsen@wheregroup.com</a>><br>> Till: <a href="mailto:mapserver-users@lists.osgeo.org">mapserver-users@lists.osgeo.org</a><br>> Datum: 2017-10-13 09:43<br>> Ämne: [mapserver-users] passing variables to includes<br>><br>> Hi,<br>><br>> I had a MapServer Training this week and one of the participations asks<br>> a nice question:<br>><br>> Is it possible to pass variables to includes? I think this is a very<br>> good idea, it could save a lot of includefiles. In know it's very close<br>> to mapscript, but has anyone done this without?<br>><br>
</div>
</div></body>
</html>