Web Map Service
The OpenGIS® Web Map Service Interface Standard (WMS) The Web Feature Service (WFS) represents a change in the way geographic information is created, modified and exchanged on the Internet. Rather than sharing geographic information at the file level using File Transfer Protocol (FTP), for example, the WFS offers direct fine-grained access to geographic information at the feature and feature property level. Web feature services allow clients to only retrieve or modify the data they are seeking, rather than retrieving a file that contains the data they are seeking and possibly much more. That data can then be used for a wide variety of purposes, including purposes other than their producers’ intended ones (OGC, 2013). The OGC WMS 1.3.0 corresponds to the ISO 19128 standard. The WMS standard specifies a number of different request types (also called operations), two of which are required or obligatory for a compliant WMS server, GetCapabilities and GetMap.
Overview of WMS Operations
Operation | Description |
---|---|
GetCapabilities | Returns metadata about available layers in the WMS server, including how to generate WMS requests and what values can be used in the required parameteres. The metadata for each layer includes: bounding box, coordinate reference system, URI of the data and whether the layer is mostly opaque or not. |
DescribeLayer | Returns specific information about the requested layer. |
GetMap | Returns a map image based on the set of provided parameters which include: width and height of the image, coordinate reference system, rendering style and image format. |
GetFeatureInfo | Returns attibute information associated to a given coordinate of the map image if the requested layer is ‘queryable’. |
GetLegendGraphic | Returns a legend, as an image, for the requated layer, providing a visual guide to elements represented in the map image. |
GetCapabilities Request
Returns metadata about available layers in the WMS server, including how to generate WMS requests and what values can be used in the required parameters. The metadata for each layer includes: bounding box, coordinate reference system, URI of the data and whether the layer is mostly opaque or not. 1 shows the parameters of this operation.
Parameters of the WMS GetCapabilities request
Parameter | Value Description |
---|---|
SERVICE | In this case the value is WMS telling the server which service request is coming. |
VERSION | Specifies what version of the WMS service specification is being requested, 1.0.0 1.1.0 1.1.1 1.3.0. |
REQUEST | Tells the WMS server which operation is being requested. In this case, GetCapabilities. |
In fact, all operations of the WMS standard require these three parameters when making a request. The example belows show how a WMS GetCapabilities request looks like:
https://gip.itc.utwente.nl/services/world_admin
?SERVICE=WMS&VERSION=1.3.0&REQUEST=GetCapabilitiesMessage
1 shows the resulting service response, which contains all required metadata values specify by the WMS standard. These values can then be used to construct further request and access the associated datasets. Some of the relevant lines have been highlighted, for example the provided coordinate systems and some of the names of available datasets.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
<WMS_Capabilities version="1.3.0" xsi:schemaLocation="http://www.opengis.net/wms https://schemas.opengeospatial.net/wms/1.3.0/capabilities_1_3_0.xsd http://www.opengis.net/sld https://schemas.opengeospatial.net/sld/1.1.0/sld_capabilities.xsd http://mapserver.gis.umn.edu/mapserver"> <Service> <Name>WMS</Name> <Title>WMS - World Administrative Boundaries</Title> <Abstract>WMS/WFS examples with Mapserver for ITC exercises.</Abstract> <OnlineResource xlink:href="https://gip.itc.utwente.nl"/> <ContactInformation> ... </ContactInformation> <Fees>None</Fees> <AccessConstraints>None</AccessConstraints> <MaxWidth>4096</MaxWidth> <MaxHeight>4096</MaxHeight> </Service> <Capability> <Request> <GetCapabilities> ... </GetCapabilities> <GetMap> ... </GetMap> <GetFeatureInfo> ... </GetFeatureInfo> <sld:GetLegendGraphic> ... </sld:GetLegendGraphic> </Request> <Exception> </Exception> <sld:UserDefinedSymbolization SupportSLD="1" UserLayer="0" UserStyle="1" RemoteWFS="0" .../> <Layer queryable="1"> <Name>World-Administrative-Boundaries</Name> <Title>WMS - World Administrative Boundaries</Title> <Abstract>WMS/WFS examples with Mapserver for ITC exercises.</Abstract> <KeywordList> ... </KeywordList> <CRS>EPSG:4326</CRS> <CRS>EPSG:3857</CRS> <EX_GeographicBoundingBox> <westBoundLongitude>-180</westBoundLongitude> <eastBoundLongitude>180</eastBoundLongitude> <southBoundLatitude>-90</southBoundLatitude> <northBoundLatitude>90</northBoundLatitude> </EX_GeographicBoundingBox> <BoundingBox CRS="EPSG:4326" minx="-90" miny="-180" maxx="90" maxy="180"/> <Layer queryable="0" opaque="0" cascaded="0"> <Name>graticule</Name> ... </Layer> <Layer queryable="0" opaque="0" cascaded="0"> <Name>world_bbox</Name> ... </Layer> <Layer queryable="1"> </Layer> <Name>world_map</Name> ... <Layer queryable="1" opaque="0" cascaded="0"> <Name>country_borders</Name> ... </Layer> <Layer queryable="1" opaque="0" cascaded="0"> <Name>country</Name> ... </Layer> </Layer> </Layer> </Capability> </WMS_Capabilities> |
Take the request URL used above and use it in one of your browser's tabs. Navigate the XML response document to familiarize yourself with the information it contains. This content will be used in the GetMap examples that follow.
Sometimes the response also contains the values of the bounding box in all the provided coordinate systems. See the example request below and the matching response in 2, which corresponds one of the services of the Dutch Central Bureau of Statistics (CBS).
https://service.pdok.nl/cbs/wijkenbuurten/2022/wms/v1_0
?request=GetCapabilities&service=WMS
2 shows some parts of the answer to this request. Check the highlighted lines.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
dotdotdot <Layer queryable="1"> <Name>gemeenten</Name> <Title>Gemeenten</Title> <Abstract> Het Bestand Wijk- en Buurtkaart 2022 bevat de geometrie van alle gemeenten, wijken en buurten in Nederland met als attribuut een aantal statistische kerncijfers. De begrenzingen van wijken en buurten zijn gebaseerd op wat de gemeenten aan het CBS doorgeven. De gemeentegrens is afkomstig uit de BRK van het Kadaster. De land-watergrens uit het Bestand Bodemgebruik 2017. Deze eerste versie bevat minder kerncijfers dan 2021 en 2020. In het najaar 2023 volgt een update. </Abstract> <KeywordList> <Keyword>CBS</Keyword> <Keyword>Wijken</Keyword> <Keyword>Buurten</Keyword> <Keyword>Gemeenten</Keyword> <Keyword>Statistiek</Keyword> <Keyword>Bevolkingdichtheid</Keyword> <Keyword>Inwoners</Keyword> <Keyword>Allochtonen</Keyword> <Keyword>Autos</Keyword> <Keyword>Huishoudens</Keyword> <Keyword>Nabijheid</Keyword> </KeywordList> <CRS>EPSG:28992</CRS> <CRS>EPSG:25831</CRS> <CRS>EPSG:25832</CRS> <CRS>EPSG:3034</CRS> <CRS>EPSG:3035</CRS> <CRS>EPSG:3857</CRS> <CRS>EPSG:4258</CRS> <CRS>EPSG:4326</CRS> <CRS>CRS:84</CRS> <EX_GeographicBoundingBox> <westBoundLongitude>2.52713</westBoundLongitude> <eastBoundLongitude>7.37403</eastBoundLongitude> <southBoundLatitude>50.2129</southBoundLatitude> <northBoundLatitude>55.7212</northBoundLatitude> </EX_GeographicBoundingBox> <BoundingBox CRS="EPSG:28992" minx="-25000" miny="250000" maxx="280000" maxy="860000"/> <BoundingBox CRS="EPSG:3857" minx="281318" miny="6483220" maxx="820873" maxy="7503110"/> ... <BoundingBox CRS="EPSG:4326" minx="50.2129" miny="2.52713" maxx="55.7212" maxy="7.37403"/> <BoundingBox CRS="CRS:84" minx="2.52713" miny="50.2129" maxx="7.37403" maxy="55.7212"/> <AuthorityURL name="cbs"> <OnlineResource xlink:href="https://www.cbs.nl/"/> </AuthorityURL> <Identifier authority="cbs">14076c36-c26d-2022-ac36-7e65f530188c</Identifier> ... </Layer> dotdotdot |
GetMap Request
A WMS server responding to a GetMap request returns a map image for a specified area and content. The resulting map image is created by the server using the set of parameter values provided by the service user in the request. 2 show the parameters required by a WMS GetMap operation request.
Parameters of the WMS GetMap request
Parameter | Value Description |
---|---|
SERVICE | In this case the value is WMS telling the server which service request is coming. |
VERSION | Specifies what version of the WMS service specification is being requested, 1.0.0 1.1.0 1.1.1 1.3.0. |
REQUEST | Tells the WMS server which operation is being requested. In this case, GetMap. |
LAYERS | Data sources to be used in the create the image of the response. The value is a comma-separated list of layer names. |
CRS | The identifier of spatial reference system for the map output. This value is provided in the form EPSG:4326. In versions prior to 1.3.0 this parameter is called SRS. |
BBOX | Bounding box for map extent. This value is the coordinates of the area of interest using units according to the CRS given in the previous parameter. For projected coordinate systems the value corresponds to minx,miny,maxx,maxy, otherwise it is minlat,minlong,maxlat,maxlong |
WIDTH | Width of map the image, in pixels. |
HEIGHT | Height of map the image, in pixels. |
FORMAT | The format for the map image. Available formats are listed in the GetCapabilities response. For example, image/png. |
STYLES | Styles in which layers are to be rendered. This value is a comma-separated list of style names. The list may be empty if the default layer styling is used. |
TRANSPARENT | This is a boolean (optional) parameter. It specifies whether the map background should be transparent. The default value is false. |
Using on the information extracted from the metadata records of the GetCapabilities response, we can provide the values for the various parameters of the GetMap request and retrieve an image of the data available through the service. An example GetMap request will look like:
https://gip.itc.utwente.nl/services/world_admin
?SERVICE=WMS&VERSION=1.3.0&REQUEST=GetMap&LAYERS=country_borders&CRS=EPSG:4326&BBOX=-90,-180,90,180&WIDTH=1000&HEIGHT=500&FORMAT=image/png&STYLES=
The response to this request is a map image of the specified width and height dimensions, containing the data for the layers included in the request and covering the area indicated in the bounding box. 1 shows the image produced by the WMS server as a response to the request.
![](_web_map_service/images/world_admin.png)
In this case we requested the maximum extent available which resulted in an image of the whole world. Now, suppose we want to zoom in and get an image, not of the whole world, but a close up on a particular country. To achieve that we have to submit a new request with a different bounding box. We need to determine the appropriate values for the BBOX parameter and use them in a new the request. Such a request could be as follows:
https://gip.itc.utwente.nl/services/world_admin
?SERVICE=WMS&VERSION=1.3.0&REQUEST=GetMap&LAYERS=country_borders&CRS=EPSG:4326&BBOX=-8.30,-93.82,15.69,-48.74&WIDTH=750&HEIGHT=375&FORMAT=image/png&STYLES=
With the modified set of values, the WMS server generated a different image. Basically, a smaller geographical area with the same data content and dimensions of the previous request. 2 shows the response to this new request.
![](_web_map_service/images/colombia.png)
Create your own set of GetMap requests. One to obtain an image that focuses on The Netherlands, and a second one that produces an image focusing on your home Country.
Optionally, if you feel like taking a challenge, try to adjust the WIDTH and HEIGHT parameters in combination with the BBOX parameter to obtain the best image fit. Notice that these three parameters have an aspect ratio relationship (see 3).
Form the GetCapabilities response we know that there are various datasets available through this service. If we want to request more than one layer, we simple create a comma separated list of layer names in the LAYERS parameter of the request. Try the request below in one of your browser tabs.
https://gip.itc.utwente.nl/services/world_admin
?SERVICE=WMS&VERSION=1.3.0&REQUEST=GetMap&LAYERS=country_borders,country&CRS=EPSG:4326&BBOX=-90,-180,90,180&WIDTH=1000&HEIGHT=500&FORMAT=image/png&STYLES=
Create a request that shows the country boundaries with a different visual style, so that you obtain an image similar to the one depicted in 4
![](_web_map_service/images/world_borders.png)
GetFeatureInfo Request
Returns information associated with a given coordinate of the map image if the requested layer is ‘queryable’. The response contains the underlying data, including geometry and attribute values, for a given pixel location on a map. This request uses an (x,y) pixel value from a previously returned WMS image. 3 shows the specific parameters of the GetFeatureInfo request.
Parameters of the WMS GetFeatureInfo request
Parameter | Value Description |
---|---|
SERVICE | In this case the value is WMS telling the server which service request is coming. |
VERSION | Specifies what version of the WMS service specification is being requested, 1.0.0 1.1.0 1.1.1 1.3.0. |
REQUEST | Tells the WMS server which operation is being requested. In this case, GetFeatureInfo. |
QUERY_LAYERS | The value is a comma-separated list of the names of the layers to be queried. |
INFO_FORMAT | MIME type for the content of the response. Possible values include text/plain text/html application/json application/vnd.ogc.gml/3.1.1. This parameter is optional. The GetCapabilities response will show which formats are available. |
X | Pixel column point on the map. 0 is left side. |
Y | Pixel row on the map. 0 is the top. |
FEATURE_COUNT | Maximum number of features to return. Default is 1. This parameter is optional. |
To create a GetFeatureInfo request, the parameters in 3 have to be combined with those of the GetMap request that provides the base image for the query. The X and Y pixel coordinates of the request are based on the pixels of that image. This is an example GetFeatureInfo request
https://gip.itc.utwente.nl/services/world_admin
?SERVICE=WMS&VERSION=1.3.0&REQUEST=GetFeatureInfo&LAYERS=country_borders&CRS=EPSG:4326&BBOX=-90,-180,90,180&WIDTH=1000&HEIGHT=500&FORMAT=image/png&STYLES=&QUERY_LAYERS=country_borders&X=300&Y=240
The content of the corresponding response is shown in 3. The format in this case is text/plain
1 2 3 4 5 6 7 8 9 10 11 12 13 |
GetFeatureInfo results: Layer 'country_borders' Feature 51: ogc_id = '51' cntry_name = 'Colombia' cntry_long_name = 'Colombia' cntry_type = 'Sovereign country' pop_est = '45644023' economy = '6. Developing region' iso_code = 'CO' continent = 'South America' subregion = 'South America' |