MapServer交互操作:地图图例

如何添加地图图例


这里是对应文件:

01 MAP
02     IMAGETYPE "PNG"
03     EXTENT -180 -90 180 90
04     SIZE 600 300
05     SHAPEPATH "/gdata"
06     IMAGECOLOR 255 255 255
07     FONTSET "../fonts/fonts.list"
08     TEMPLATEPATTERN "example2*"
09     LEGEND
10         KEYSIZE 12 12
11         LABEL
12             TYPE BITMAP
13             SIZE MEDIUM
14             COLOR 0 0 89
15         END
16         STATUS ON
17     END
18     REFERENCE
19         IMAGE "../images/worldref.png"
20         SIZE 155 105
21         EXTENT -180 -90 180 90
22         STATUS ON
23         MINBOXSIZE 10
24         MAXBOXSIZE 150
25         COLOR -1 -1 -1
26         OUTLINECOLOR 128 0 0
27         MARKERSIZE 8
28         MARKER "star"
29     END
30     SCALEBAR
31         IMAGECOLOR 255 255 255
32         LABEL
33             COLOR 0 0 0
34             SIZE TINY
35         END
36         STYLE 1
37         SIZE 100 2
38         COLOR 0 0 0
39         UNITS MILES
40         INTERVALS 2
41         TRANSPARENT FALSE
42         STATUS ON
43     END
44     WEB
45         TEMPLATE "to be replaced by map_web_template variable in section2.html"
46         IMAGEPATH "/owg/ms_tmp/"
47         IMAGEURL "/ms_tmp/"
48         METADATA
49             "wms_title" "WMS Demo Server"
50             "wms_onlineresource" "http://192.168.4.211/cgi-bin/mapserv?map=/mstu/htdocs/example2.map&"
51             "wms_srs" "EPSG:3857 EPSG:4326"
52         END
53     END
54     LAYER
55         NAME "modis"
56         DATA "land_shallow_topo_8192.tif"
57         STATUS OFF
58         TYPE RASTER
59         PROCESSING "BANDS=1,2,3"
60         OFFSITE 71 74 65
61     END
62     LAYER
63         NAME "modis_jpl"
64         TYPE RASTER
65         OFFSITE 0 0 0
66         STATUS OFF
67         CONNECTIONTYPE WMS
68         CONNECTION "http://wcs.osgeo.cn:8088/service?"
69         METADATA
70             "wms_srs" "EPSG:4326"
71             "wms_name" "maplet_i887"
72             "wms_server_version" "1.1.1"
73             "wms_format" "image/jpeg"
74         END
75         PROJECTION
76             "init=epsg:4326"
77         END
78     END
79     LAYER
80         NAME "states_poly"
81         DATA "wcountry.shp"
82         STATUS OFF
83         TYPE POLYGON
84         LABELITEM "NAME"
85         CLASS
86             NAME "States"
87             STYLE
88                 COLOR 232 232 232
89             END
90         END
91     END
92     LAYER
93         NAME "states_line"
94         DATA "wcountry.shp"
95         STATUS OFF
96         TYPE LINE
97         CLASS
98             NAME "State Boundary"
99             STYLE
100                 COLOR 132 132 32
101             END
102         END
103     END
104     LAYER
105         NAME "wriver"
106         DATA "wriver.shp"
107         STATUS OFF
108         TYPE LINE
109         CLASS
110             NAME "World River"
111             STYLE
112                 COLOR 0 0 255
113             END
114         END
115     END
116     LAYER
117         NAME "wroads"
118         DATA "wroads.shp"
119         STATUS OFF
120         TYPE LINE
121         CLASS
122             NAME "World Road"
123             STYLE
124                 COLOR 100 200 100
125             END
126         END
127     END
128 END

你可以在这里看到 HTML Template 源代码.

7    FONTSET "../fonts/fonts.list"7    FONTSET "../fonts/fonts.list"
n8    PROJECTIONn8    TEMPLATEPATTERN "example2*"
9        "init=epsg:4326"9    LEGEND
10        KEYSIZE 12 12
11        LABEL
12            TYPE BITMAP
13            SIZE MEDIUM
14            COLOR 0 0 89
15        END
16        STATUS ON
10    END17    END
n11    TEMPLATEPATTERN "example2*"n
12    REFERENCE18    REFERENCE
19        COLOR -1 -1 -125        COLOR -1 -1 -1
n20        OUTLINECOLOR 0 255 255n26        OUTLINECOLOR 128 0
21        MARKERSIZE 1627        MARKERSIZE 8
22        MARKER "star"28        MARKER "star"
53        PROCESSING "BANDS=1,2,3"59        PROCESSING "BANDS=1,2,3"
nn60        OFFSITE 71 74 65
54    END61    END
83        END90        END
n84        PROJECTIONn
85            "init=epsg:4326"
86        END
87    END91    END
97            END101            END
n98        ENDn
99        PROJECTION
100            "init=epsg:4326"
101        END102        END
113        END114        END
n114        PROJECTIONn
115            "init=epsg:4326"
116        END
117    END115    END
128        END126        END
t129        PROJECTIONt
130            "init=epsg:4326"
131        END
132    END127    END

添加地图图例:示例

打开 MapServer 地图图例示例 New

下面展示的是使用表单进行提交,各种参数通过 input 来传递。效果与上面是一样的: