Thematic mapping in MapServer
kenboss
kenboss at dilbert.dnr.state.mn.us
Mon Jan 10 06:40:39 PST 2000
As per Steve's suggestion, here's a mapfile from the ForestView application
(http://www.ra.dnr.state.mn.us/forestview/) demonstrating the creation of a
number of map themes from a single shapefile. You'll need to drill down fairly
deep into the application to get to a point where this file is actually in use
(to where you've selected a township and forest inventory (CSA) data is
displayed). I suppose the easiest way to get there would be to just type
something like "T63R23W" into the text input box at the upper left of the first
map page.
The first layer of the mapfile handles all queries; the rest are different
visual slices of the same shapefile. Many of the thematic slices are actually
based on a single attribute field (ctype), and are defined using regular
expressions. Other themes are based on different attribute fields (csize, age,
tbr).
Note that this is a mapserv 3.2 application.
Hope this is helpful,
--Ken
=============================================================================
Ken Boss
Digital Image Analysis / Web Stuff Forestry Resource Assessment
kenboss at dilbert.dnr.state.mn.us Minnesota Dept. of Natural Resources
Voice: 218 327 4449 ext. 237 413 SE 13th Street
Fax: 218 327 4517 Grand Rapids, MN 55744 USA
www.ra.dnr.state.mn.us
=============================================================================
-------------- next part --------------
NAME FV2
SIZE 375 375
# EXTENT 583079.750 4884196.000 592899.562 4894012.000
SHAPEPATH ../shapes/township
UNITS meters
MARKERSET ../symbols/general.sym
WEB
TEMPLATE fvj_csa_disp.html
MAXSCALE 100000
MINSCALE 15000
END
LEGEND
STATUS on
KEYSIZE 25 15
# OUTLINECOLOR 0 0 0
# IMAGECOLOR 245 245 245
LABEL
COLOR 0 0 0
TYPE TRUETYPE
FONT "trebuchet_ms-bold"
SIZE 16
END # Label definition
END # Legend
SCALEBAR
STATUS on
SIZE 325 5
COLOR 255 255 255
BACKGROUNDCOLOR 0 0 0
OUTLINECOLOR 0 0 0
IMAGECOLOR 255 255 255
UNITS miles
INTERVALS 5
LABEL
SIZE small
COLOR 0 0 0
END
END # Scalebar
REFERENCE
SIZE 93 105
IMAGE ../symbols/cnty_ref.gif
EXTENT 148055 4774590 803382 5514130
STATUS on
END # Reference
#####################
# Layer Definitions #
#####################
LAYER
NAME stands
TYPE polygon
STATUS off
DATA standpy3
QUERYITEM ctype
QUERY
EXPRESSION "^[1-9]$|^[1-7]|81"
TEMPLATE fv_for_query.html
JOIN
NAME cntyj
TABLE /webdata/csa/tables/county.dbf
FROM county
TO county
END
JOIN
NAME radj
TABLE /webdata/csa/tables/rad.dbf
FROM rad_
TO rad_
END
JOIN
NAME csizej
TABLE /webdata/csa/tables/csize.dbf
FROM csize
TO csize
END
JOIN
NAME cdensej
TABLE /webdata/csa/tables/cdense.dbf
FROM cdense
TO cdense
END
JOIN
NAME usizej
TABLE /webdata/csa/tables/csize.dbf
FROM usize
TO csize
END
JOIN
NAME tbrj
TABLE /webdata/csa/tables/tbr.dbf
FROM tbr
TO tbr
END
END
QUERY
EXPRESSION "^8[2-9]|^9"
TEMPLATE fv_nonfor_query.html
JOIN
NAME cntyj
TABLE /webdata/csa/tables/county.dbf
FROM county
TO county
END
JOIN
NAME radj
TABLE /webdata/csa/tables/rad.dbf
FROM rad_
TO rad_
END
END
END # Layer stands
LAYER
NAME genfor
TYPE polygon
STATUS off
DATA standpy3
CLASSITEM ctype
CLASS
NAME "Hardwoods"
EXPRESSION "^[1-9]$|^[1-4]|^7[8,9]"
SYMBOL 0
COLOR 0 151 0
END
CLASS
NAME "Conifers"
EXPRESSION "^[5,6]|^7[1-4]|^81"
SYMBOL 0
COLOR 0 117 117
END
CLASS
NAME "Unprod. Conifers"
EXPRESSION "^7[5-7]"
SYMBOL 0
COLOR 0 185 185
END
CLASS
NAME "Non-Forest"
EXPRESSION "8[2-9]|9[1-5,89]"
SYMBOL 0
COLOR 219 219 219
END
END # Layer genfor
LAYER
NAME hardtypes
TYPE polygon
STATUS off
DATA standpy3
CLASSITEM ctype
CLASS
NAME "Ash"
EXPRESSION "^1$"
SYMBOL 0
COLOR 185 136 0
END
CLASS
NAME "Aspen"
EXPRESSION "12|78"
SYMBOL 0
COLOR 212 212 128
END
CLASS
NAME "Birch"
EXPRESSION "13"
SYMBOL 0
COLOR 236 221 0
END
CLASS
NAME "Balm of Gilead"
EXPRESSION "14"
SYMBOL 0
COLOR 0 219 219
END
CLASS
NAME "Oak"
EXPRESSION "30|79"
SYMBOL 0
COLOR 105 105 34
END
CLASS
NAME "Cottonwood"
EXPRESSION "15"
SYMBOL 0
COLOR 0 117 117
END
CLASS
NAME "Walnut"
EXPRESSION "25"
SYMBOL 0
COLOR 222 158 222
END
CLASS
NAME "Willow"
EXPRESSION "^6$"
SYMBOL 0
COLOR 0 219 0
END
CLASS
NAME "Lowland Hardwoods"
EXPRESSION "^9$"
SYMBOL 0
COLOR 0 0 117
END
CLASS
NAME "Central Hardwoods"
EXPRESSION "40"
SYMBOL 0
COLOR 246 122 0
END
CLASS
NAME "Northern Hardwoods"
EXPRESSION "20"
SYMBOL 0
COLOR 202 0 0
END
CLASS
NAME "Conifers"
EXPRESSION "^[5,6]|^7[1-4]|^7[5-7]|^81"
SYMBOL 0
COLOR 24 75 24
END
CLASS
NAME "Non-Forest"
EXPRESSION "^8[2-8]|^9"
SYMBOL 0
COLOR 219 219 219
END
END # Layer hardtypes
LAYER
NAME contypes
TYPE polygon
STATUS off
DATA standpy3
CLASSITEM ctype
CLASS
NAME "White Pine"
EXPRESSION "51"
SYMBOL 0
COLOR 0 151 0
END
CLASS
NAME "Norway Pine"
EXPRESSION "52"
SYMBOL 0
COLOR 151 90 0
END
CLASS
NAME "Jack Pine"
EXPRESSION "53"
SYMBOL 0
COLOR 0 66 66
END
CLASS
NAME "Scotch Pine"
EXPRESSION "54"
SYMBOL 0
COLOR 172 245 98
END
CLASS
NAME "White Spruce"
EXPRESSION "61"
SYMBOL 0
COLOR 0 236 236
END
CLASS
NAME "Black Spruce"
EXPRESSION "71|74|75"
SYMBOL 0
COLOR 0 0 117
END
CLASS
NAME "White Cedar"
EXPRESSION "73|77"
SYMBOL 0
COLOR 30 94 94
END
CLASS
NAME "Red Cedar"
EXPRESSION "81"
SYMBOL 0
COLOR 248 95 95
END
CLASS
NAME "Balsam Fir"
EXPRESSION "62"
SYMBOL 0
COLOR 100 49 0
END
CLASS
NAME "Tamarack"
EXPRESSION "72|76"
SYMBOL 0
COLOR 98 98 202
END
CLASS
NAME "Hardwoods"
EXPRESSION "^[1-9]$|^[1-4]|^7[8,9]"
SYMBOL 0
COLOR 236 0 0
END
CLASS
NAME "Non-Forest"
EXPRESSION "^8[2-8]|^9"
SYMBOL 0
COLOR 219 219 219
END
END # Layer contypes
LAYER
NAME forsize
TYPE polygon
STATUS off
DATA standpy3
CLASSITEM csize
CLASS
NAME "0 to 1 in. DBH"
EXPRESSION "1"
SYMBOL 0
COLOR 219 190 0
END
CLASS
NAME "1 to 3 in. DBH"
EXPRESSION "2"
SYMBOL 0
COLOR 202 162 0
END
CLASS
NAME "3 to 5 in. DBH"
EXPRESSION "3"
SYMBOL 0
COLOR 185 136 0
END
CLASS
NAME "5 to 9 in. DBH"
EXPRESSION "4"
SYMBOL 0
COLOR 168 112 0
END
CLASS
NAME "9 to 15 in. DBH"
EXPRESSION "5"
SYMBOL 0
COLOR 151 90 0
END
CLASS
NAME "15 to 20 in. DBH"
EXPRESSION "6"
SYMBOL 0
COLOR 134 71 0
END
CLASS
NAME "20 to 25 in. DBH"
EXPRESSION "7"
SYMBOL 0
COLOR 117 54 0
END
CLASS
NAME "25+ in. DBH"
EXPRESSION "8"
SYMBOL 0
COLOR 100 39 0
END
CLASS
NAME "Non-Forest"
EXPRESSION "0"
SYMBOL 0
COLOR 219 219 219
END
END # Layer forsize
LAYER
NAME forage
TYPE polygon
STATUS off
DATA standpy3
CLASSITEM age
CLASS
NAME "1-9 Years"
EXPRESSION "^[1-9]$"
SYMBOL 0
COLOR 0 236 0
END
CLASS
NAME "10-19 Years"
EXPRESSION "^1[0-9]$"
SYMBOL 0
COLOR 0 219 0
END
CLASS
NAME "20-29 Years"
EXPRESSION "^2[0-9]$"
SYMBOL 0
COLOR 0 202 0
END
CLASS
NAME "30-39 Years"
EXPRESSION "^3[0-9]$"
SYMBOL 0
COLOR 0 185 0
END
CLASS
NAME "40-49 Years"
EXPRESSION "^4[0-9]$"
SYMBOL 0
COLOR 0 168 0
END
CLASS
NAME "50-74 Years"
EXPRESSION "^[5,6][0-9]$|^7[0-4]"
SYMBOL 0
COLOR 0 151 0
END
CLASS
NAME "75-99 Years"
EXPRESSION "^7[5-9]$|^[8,9][1-9]"
SYMBOL 0
COLOR 0 134 0
END
CLASS
NAME "100-124 Years"
EXPRESSION "^1[0,1][0-9]|^12[0-4]"
SYMBOL 0
COLOR 0 117 0
END
CLASS
NAME "125-149 Years"
EXPRESSION "^12[5-9]|^1[3,4][0-9]"
SYMBOL 0
COLOR 0 100 0
END
CLASS
NAME "150+ Years"
EXPRESSION "^1[5-9][0-9]|^2[0-9][0-9]"
SYMBOL 0
COLOR 0 83 0
END
CLASS
NAME "Non-Forest"
EXPRESSION "0"
SYMBOL 0
COLOR 219 219 219
END
END # Layer forage
LAYER
NAME oldgrowth
TYPE polygon
STATUS off
DATA standpy3
CLASSITEM tbr
CLASS
NAME "Old Growth"
EXPRESSION "5"
SYMBOL 0
COLOR 80 110 51
END
CLASS
NAME "OG Management Zone"
EXPRESSION "6"
SYMBOL 0
COLOR 135 215 55
END
CLASS
NAME "Future/Potential OG"
EXPRESSION "7"
SYMBOL 0
COLOR 0 151 151
END
END # Layer
LAYER
NAME gencov
TYPE polygon
STATUS off
DATA standpy3
CLASSITEM ctype
CLASS
NAME "Hardwoods"
EXPRESSION "^[1-9]$|^[1-4]|^7[8,9]"
SYMBOL 0
COLOR 0 202 0
END
CLASS
NAME "Conifers"
EXPRESSION "^[5,6]|^7[1-4]|^7[5-7]|^81"
SYMBOL 0
COLOR 24 75 24
END
CLASS
NAME "Shrublands"
EXPRESSION "^8[5,6]"
SYMBOL 0
COLOR 135 135 44
END
CLASS
NAME "Cutover Areas"
EXPRESSION "82"
SYMBOL 0
COLOR 95 248 248
END
CLASS
NAME "Grasslands"
EXPRESSION "^8[3,4]"
SYMBOL 0
COLOR 212 212 128
END
CLASS
NAME "Agriculture"
EXPRESSION "91"
SYMBOL 0
COLOR 236 221 0
END
CLASS
NAME "Wetlands"
EXPRESSION "98|99"
SYMBOL 0
COLOR 105 34 105
END
CLASS
NAME "Water"
EXPRESSION "96|97"
SYMBOL 0
COLOR 0 0 236
END
CLASS
NAME "Rock Outcrop"
EXPRESSION "95"
SYMBOL 0
COLOR 168 168 168
END
CLASS
NAME "Developed"
EXPRESSION "92|93|94"
SYMBOL 0
COLOR 165 54 54
END
END # Layer gencov
LAYER
NAME boundaries
TYPE line
STATUS default
DATA standpy3
CLASS
NAME "Stand Boundaries"
SYMBOL 0
COLOR 200 200 200
END
END
END # Mapfile
More information about the MapServer-users
mailing list