MapServer交互操作:地图比例尺

如何添加地图比例尺

这里是对应文件:

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

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


7    FONTSET "../fonts/fonts.list"7    FONTSET "../fonts/fonts.list"
t8    TEMPLATEPATTERN "example-u*"t8    TEMPLATEPATTERN "example2*"
9    SCALEBAR
10        IMAGECOLOR 255 255 255
11        LABEL
12            COLOR 0 0 0
13            SIZE TINY
14        END
15        STYLE 1
16        SIZE 100 2
17        COLOR 0 0 0
18        UNITS MILES
19        INTERVALS 2
20        TRANSPARENT FALSE
21        STATUS ON
22    END
9    WEB23    WEB

添加地图比例尺:示例

打开 MapServer 地图比例尺示例 New

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