Search code examples
stylesmapserver

Extract the style information from another file


Good afternoon.

I'm trying to get the information from my STYLE LAYERS of mapfiles be drawn from some other .list file but I can not do this. The reason I want it is not having to change the STYLE of all mapfiles when I want to make some minor amendments in mapfiles.

For example, below I have the information given STYLE LAYER, but I would draw this other file information.

STYLE


    COLOR 160,160,100
       END STYLE #
       STYLE
         OUTLINECOLOR 100 100 100
         WIDTH 1
       END STYLE #

Thank you.


Solution

  • I use the INCLUDE object in my map files to do that. I create small snippets of mapfiles:

      STYLE
        SYMBOL 'square'
        COLOR 0 0 0
        SIZE 24
      END #Style
    

    name them something like "_house_style.map". I put a leading underscre so I know it is just a snippet.

    Then include them with

    INCLUDE "_house_style.map"