GetCapabilities
accessWeb Map Service (Web Map Service,WMS) generates "maps" about geospatial data, which belongs to the specification published by OGC. A map is a visual description of geographic data, not geographic data itself. Web map service provides unified access to the interface supported by the map server through the Web client on the Internet.
The basic web map service provides 4 interfaces GetCapabilities
, GetMap
, GetFeaturelnfo
and DescribeLayer
to support the creation and display of registered and layered, map-like view information , these views come from multiple service sources, both remote and heterogeneous.
When requesting a map, the client can specify the information displayed on the map, layer styles, bounds, projection or spatial reference system, as well as output format, image size, background transparency and color, etc. When generating maps with the same BBox (bounding rectangle), SRS (spatial reference system) and dimensions, these maps can be overlaid to further generate a composite map. WMS supports the creation of a network of distributed map services so that clients can generate custom maps.
The basic Web mapping service mainly provides the following functions:
The stacked map server aggregates the contents of multiple independent map servers into one server, and provides other servers with functions such as output format conversion, coordinate conversion and so on.
The style layer descriptor (Styled-Layer Descriptor,SLD) allows you to define symbols for feature data, rather than the established named layers and their styles. SLD is an extension of WMS. WMS services that support SLD get elements from WFS. The map is then drawn using the style information provided by the user. The style layer descriptor adds operations that are not supported by basic WMS: DescribeLayer
、 GetLegendGraphic
、 GetStyles
And PutStyles
.
It is explained here that the WMS service is published using MapServer. As explained in the previous section, a Mapfile corresponds to a map. Through WMS access, you can access layer information in Mapfile more flexibly. The map design function of Mapfile is enhanced to a service function.
Since each WMS is independent, a description of the respective functions must be provided. This "service metadata" enables each client to formulate legitimate requests and to construct a queryable directory to guide clients to specific WMSes. GetCapabilities
allows a client (or client agent) to request a WMS to reveal its mapping content and processing capabilities. The returned result is an XML document that describes the content of the service information and the parameters that can be requested; in the case of a specific WMS, general information about the service itself and specific information about the available maps are returned.
This Mapfile is configured with the WMS service. The contents of Mapfile mfb1.map
is:
01 MAP
02 IMAGETYPE "PNG"
03 EXTENT -180 -90 180 90
04 SIZE 600 300
05 SHAPEPATH "/gdata"
06 IMAGECOLOR 255 255 255
07 WEB
08 METADATA
09 "wms_title" "WMS Demo Server"
10 "wms_onlineresource" "//webgis.pub/cgi-bin/mapserv?map=/owg/mfb1.map&"
11 "ows_onlineresource" "//webgis.pub/cgi-bin/mapserv?map=/owg/mfb1.map&"
12 "wms_srs" "EPSG:4269 EPSG:4326"
13 "wms_enable_request" "* !GetFeatureInfo"
14 END
15 END
16 LAYER
17 NAME "topo"
18 DATA "land_shallow_topo_8192.tif"
19 STATUS OFF
20 TYPE RASTER
21 PROCESSING "BANDS=1,2,3"
22 PROJECTION
23 "init=epsg:4326"
24 END
25 END
26 LAYER
27 NAME "states"
28 DATA "wcountry.shp"
29 STATUS OFF
30 TYPE POLYGON
31 CLASS
32 NAME "The Upper Great Lakes States"
33 STYLE
34 COLOR 232 232 232
35 OUTLINECOLOR 32 32 32
36 END
37 END
38 END
39 END
With the front mfa1.map
Compared to:
6 | IMAGECOLOR 255 255 255 | 6 | IMAGECOLOR 255 255 255 | ||
n | n | 7 | WEB | ||
8 | METADATA | ||||
9 | "wms_title" "WMS Demo Server" | ||||
10 | "wms_onlineresource" "//webgis.pub/cgi-bin/mapserv?map=/owg/mfb1.map&" | ||||
11 | "ows_onlineresource" "//webgis.pub/cgi-bin/mapserv?map=/owg/mfb1.map&" | ||||
12 | "wms_srs" "EPSG:4269 EPSG:4326" | ||||
13 | "wms_enable_request" "* !GetFeatureInfo" | ||||
14 | END | ||||
15 | END | ||||
7 | LAYER | 16 | LAYER | ||
n | 8 | NAME "world-country" | n | 17 | NAME "topo" |
18 | DATA "land_shallow_topo_8192.tif" | ||||
19 | STATUS OFF | ||||
20 | TYPE RASTER | ||||
21 | PROCESSING "BANDS=1,2,3" | ||||
22 | PROJECTION | ||||
23 | "init=epsg:4326" | ||||
24 | END | ||||
25 | END | ||||
26 | LAYER | ||||
27 | NAME "states" | ||||
9 | DATA "wcountry.shp" | 28 | DATA "wcountry.shp" | ||
12 | CLASS | 31 | CLASS | ||
t | 13 | NAME "World Countries" | t | 32 | NAME "The Upper Great Lakes States" |
14 | STYLE | 33 | STYLE |
Note the version 1.3.0
here. OGC's WMS has two major versions, 1.1.1
and 1.3.0
. If you use 1.1.1
, you may be prompted to save the file after accessing, and you will find that it is an XML format file after saving. With 1.3.0
, it will be opened directly in the browser.
GetCapabilities
access//webgis.pub/cgi-bin/mapserv?map=/owg/mfb1.map&SERVICE=WMS&VERSION=1.3.0&REQUEST=GetCapabilities
MapServer supports returning maps via CGI mode, and you can use the mode=map
Parameters.
For example:
//webgis.pub/cgi-bin/mapserv?map=/owg/mfb1.map&layer=states&mode=map"
Just as: