Created
September 15, 2020 08:29
-
-
Save LarsSchy/d3a8285f4d06bc47ae358151048ed792 to your computer and use it in GitHub Desktop.
Example how to set up named styles in Mapserver
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
MAP | |
# Style test mapfile, how to set up named styles in mapserver | |
# | |
# Lars Schylberg, 2020-09-15 | |
# | |
# example: root layers access: LAYERS=ST&styles=color& | |
# individual layers: LAYERS=square,circle&styles=green,grey& | |
# default: LAYERS=ST&styles=& | |
# or LAYERS=ST&styles=default& | |
# Gives correct GetCapabilities response | |
# | |
NAME ST | |
EXTENT 0 0 20 15 | |
SIZE 200 150 | |
UNITS DD | |
IMAGECOLOR 200 200 200 | |
CONFIG "MS_ERRORFILE" "/tmp/style_test.log" | |
DEBUG 5 | |
OUTPUTFORMAT | |
NAME "AGG" | |
DRIVER AGG/PNG | |
IMAGEMODE RGB | |
END | |
WEB | |
IMAGEPATH "/tmp/ms_tmp/" | |
IMAGEURL "/ms_tmp/" | |
METADATA | |
"wms_srs" "EPSG:3006 EPSG:4326 EPSG:3857" | |
"ows_enable_request" "*" | |
"ows_title" "Style test" | |
END | |
END | |
PROJECTION | |
"init=epsg:4326" | |
END | |
SYMBOL | |
NAME "circle" | |
TYPE ELLIPSE | |
FILLED TRUE | |
POINTS 1 1 END | |
END | |
SYMBOL | |
NAME "square" | |
TYPE VECTOR | |
FILLED TRUE | |
POINTS 0 0 0 1 1 1 1 0 0 0 END | |
END | |
# | |
# Start of layer definitions | |
# | |
LAYER | |
NAME "circle" | |
GROUP "ST" | |
TYPE POINT | |
FEATURE POINTS 10 5 END END | |
FEATURE POINTS 15 10 END END | |
EXTENT 0 0 20 15 | |
METADATA | |
"wms_title" "Circles" | |
"wms_enable_request" "*" | |
"wms_group_title" "Circles" | |
END | |
STATUS on | |
CLASSGROUP "color" | |
CLASS | |
NAME "circle-color" | |
GROUP "color" | |
STYLE | |
COLOR 255 0 0 | |
SIZE 15 | |
WIDTH 1 | |
SYMBOL "circle" | |
END | |
END | |
CLASS | |
NAME "circle-grey" | |
GROUP "grey" | |
STYLE | |
COLOR 50 50 50 | |
SIZE 15 | |
WIDTH 1 | |
SYMBOL "circle" | |
END | |
END | |
CLASS | |
NAME "circle-green" | |
GROUP "green" | |
STYLE | |
COLOR 0 255 0 | |
SIZE 15 | |
WIDTH 1 | |
SYMBOL "circle" | |
END | |
END | |
END # Layer | |
LAYER | |
NAME "square" | |
GROUP "ST" | |
TYPE POINT | |
FEATURE POINTS 10 10 END END | |
FEATURE POINTS 15 5 END END | |
METADATA | |
"wms_title" "Squares" | |
"wms_enable_request" "*" | |
"wms_group_title" "Squares" | |
"wms_extent" "0 0 20 15" | |
END | |
STATUS on | |
CLASSGROUP "color" | |
CLASS | |
NAME "square-color" | |
GROUP "color" | |
STYLE | |
COLOR 0 0 255 | |
SIZE 15 | |
WIDTH 1 | |
SYMBOL "square" | |
END | |
END | |
CLASS | |
NAME "square-grey" | |
GROUP "grey" | |
STYLE | |
COLOR 100 100 100 | |
SIZE 15 | |
WIDTH 1 | |
SYMBOL "square" | |
END | |
END | |
CLASS | |
NAME "square-green" | |
GROUP "green" | |
STYLE | |
COLOR 0 255 0 | |
SIZE 15 | |
WIDTH 1 | |
SYMBOL "square" | |
END | |
END | |
END # Layer | |
END # Map File |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment