MapServer 中可以将 WFS 作为图层添加。这样,就是作为 WFS 客户端来使用了。
由于 WFS 需要通过网络传输数据,所以最好使用数据量较小的数据。 这里选择使用的是点状要素数据。
01 MAP
02 IMAGETYPE "PNG"
03 EXTENT -180 -90 180 90
04 SIZE 600 300
05 SHAPEPATH "/gdata"
06 IMAGECOLOR 100 100 100
07 WEB
08 IMAGEPATH "/owg/ms_tmp/"
09 IMAGEURL "/ms_tmp/"
10 METADATA
11 "wfs_title" "world country"
12 "wfs_onlineresource" "http://webgis.cn/cgi-bin/mapserv?map=/owg/mft6.map"
13 "wfs_srs" "EPSG:4326"
14 "wfs_abstract" "This text describes your wfs service"
15 "wfs_enable_request" "*"
16 "wms_enable_request" "*"
17 "ows_keywordlist" "world"
18 "gml_include_items" "all"
19 END
20 END
21 PROJECTION
22 "init=epsg:4326"
23 END
24 SYMBOL
25 NAME "circle"
26 TYPE ELLIPSE
27 FILLED TRUE
28 POINTS
29 10 10
30 END
31 END
32 LAYER
33 NAME "wcity_wfs"
34 TYPE POINT
35 OFFSITE 0 0 0
36 STATUS ON
37 CONNECTIONTYPE WFS
38 CONNECTION "http://webgis.cn/cgi-bin/mapserv?map=/owg/mft2.map&"
39 METADATA
40 "wfs_version" "1.0.0"
41 "wfs_srs" "EPSG:4326"
42 "wfs_typename" "world-city"
43 "wfs_request_method" "GET"
44 "wfs_connectiontimeout" "60"
45 END
46 PROJECTION
47 "init=epsg:4326"
48 END
49 CLASS
50 NAME "cities"
51 SYMBOL "circle"
52 SIZE 6
53 COLOR 255 255 0
54 END
55 END
56 LAYER
57 NAME "wcountry"
58 DATA "wcountry.shp"
59 STATUS OFF
60 TYPE POLYGON
61 CLASS
62 NAME "The Upper Great Lakes States"
63 STYLE
64 COLOR 232 232 232
65 OUTLINECOLOR 32 32 32
66 END
67 END
68 END
69 END
效果为:
注意,上面的图是传统的 MapServer 生成的地图。由定义 WFS 点状图层在前面,所以被多边形遮挡住了大部分。