Style Library

Parent Previous Next

The Style Library

Overview

With MapServer MapManager, the styles are managed and categorised (i.e. Points, Lines and Polygons) in the Style Library so that when you want to change the style of a layer only the relevant style categories are loaded. The Style Library dialogue is available from the Main Menu under the Tools -> Style Library. In the Style Library dialogue you can view, edit and add new styles and categories.





The Concept of the Style Library

The Style Library is designed around a map file with layers and classes (mmstyles.map located in the templates directory of MapManager). Each layer represents a style category and the styles within each category/layer are exposed as classes.


User can add style categories (i.e. layers), add styles (i.e. classes) within a category and modify existing styles.



The styles configured in the Style Library can be selected for the styles of the map in the Style Properties dialogue by choosing the style category in the combo-box and selecting the style in the list right below the category combo.



When selecting a specific style, all the default properties configured within the style library are automatically applied, then you can override any of these properties using the Style Properties dialogue.



Style Library Configuration

Configuring the Style Library can be done with following activities by default:


Adding new categories or styles

We can add new categories and styles by using the button on the local toolbar or the context menu of the tree view (See images below).







Renaming style categories or styles

To rename a style category or style, right click on the node and select the 'Rename' item in the context menu. You can also modify the name of the StyleLibrary by renaming the upper level node, see below:




Editing style properties

The properties of the selected style can be edited in the Style Properties dialogue by double clicking on the style node or selecting the Properties menu item in the context menu.



Then the style properties can be edited in the dialogue below:



The dialogue contains the following parameters:


Saving the Style Library configuration

Once the Style Library configuration is modified we can save the current version of mmstyles.map by clicking on the 'Save' button at the bottom right of the Style Library dialogue.

Using the text editor to modify the Style Library configuration

The text tab of the Style Library dialogue provides the option to edit the configuration (mmstyles.map) in the text editor.


We can locate any item in the text editor by right clicking on the item in the tree view first and select the 'Go To Layer (Text)' and 'Go To Class (Text)' menu items depending on whether a style category or a style node is selected.

Technical requirements

SYMBOL
    NAME "arrow"
    TYPE SVG
    IMAGE "C:\IntraMaps\intramaps80\custom_symbols\intramaps.svg"
END





SYMBOL
    NAME 'pen-2'
    TYPE SIMPLE
END
SYMBOL
    NAME 'pen-3'
    TYPE SIMPLE
END
SYMBOL
    NAME 'pen-4'
    TYPE SIMPLE
END

etc...


Adding a Symbol to the Symbolset file

Open the Style Library and go to to the Symbolset tab. Use the text editor to add a symbol. It is recommended that symbols that will be used across many map files are added to the Symbolset. Symbols used only in one or two map files can be added as inline symbols to the map file. It is recommended that you do not add inline symbols to the Style Library file (mmstyles.map)


Adding all symbols from a TrueType font in MapManager Style Library

The Style Library allows you to automatically add all the symbols/characters from a TrueType Font, without the need to reference every single character/symbol in the Symbolset file. Instead these characters are automatically copied to the Style Library map file as inline symbols. When used in your map, MapManager also copies the required symbol as an inline symbol in your map file.

To configure this functionality, open the Style Library in MapManager, go to the Text tab and add the first symbol from the True Type font:


SYMBOL
    NAME "MapServerAnimals-33"
    TYPE TRUETYPE
    ANTIALIAS TRUE
    CHARACTER "!"
    FONT "MapServerAnimals"
END


Create a layer and add the following metadata and class, with the character-count metadata tag indicating how many symbols you want to add, start from the one you have just added above and ensure that the class name is the font name configure in the font file:


LAYER
    METADATA
        "character-count" "222"
    END # METADATA
    NAME "MapServer Animals"
    STATUS OFF
    TILEITEM "location"
    TYPE POINT
    UNITS METERS
    CLASS
        NAME "MapServerAnimals"
        STYLE
            COLOR 0 0 0
            GAP 10
            SIZE 24
            SYMBOL "MapServerAnimals-33"
        END # STYLE
    END # CLASS
    FEATURE
    END # FEATURE
END # LAYER