Child pages
  • WMS primer
Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 22 Next »

In this primer we will demonstrate how to obtain a small set of data from a large collection of datasets using the OGC Web Mapping Service (WMS) protocol. We will show that requesting images through WMS is just as easy as buying an ice cream.

Find a WMS server

Find a data web source that hosts a WMS server (go to an ice cream vendor). You can find WMS servers through hearsay, or via catalog services. OpenEarth provides a limited list to start with. We will use the Shuttle Radar Topography Mission datasets hosted at the Woods Hole Institute THREDDS OPeNDAP server as example in this primer. THREDDS OPeNDAP servers can be configured to serve WMS for orthogonal datasets with proper geographic information.

Request an overview of the content of a WMS server

Ask for what the server has to offer (see which flavours he has and which kind of cups). You need to add the following mandatory <keyword,value> pairs to the base server url, separated by an &, e.g.: ?service=WMS&request=GetCapabilities.






Mandatory WMS standard value



Mandatory WMS standard value

This procedure works for all subsequent <keyword,value> pairs in this primer:

This url will return an xml file that contains an inventory of the available datasets. (You can also request availabe datasets for one WMS version only by appending the optional version keyword.)

Inspect the overview of the content of a WMS server

Look at what versions of WMS the server has to offer (check whether the ice cream is fresh). For each version there is a
tag WCS_Capabilities with attribute version, as shown in the reduced xml file example below:

<WMS_Capabilities version="1.3.0" ... >


For each WMS version a number of datasets is hosted. Select one dataset (ice cream flavour) from the list through the Layer tag. The name of the dataset is the name tag, in this case there is only topo. The xml file indicates that this dataset can be delivered in four well-known image different formats (this ice cream flavour ice cream is available in a cup, a cone and on a stick): jpg, png, kmz ad gif.

  <Title>UCSD SRTM30_v6 Global DEM (30 sec)</Title>
  <Layer queryable="1">
  <Style><Name>boxfill/redblue        </Name>...
  <Style><Name>boxfill/redblue        </Name>...
  <Style><Name>boxfill/alg            </Name>...
  <Style><Name>boxfill/ncview         </Name>...
  <Style><Name>boxfill/greyscale      </Name>...
  <Style><Name>boxfill/alg2           </Name>...
  <Style><Name>boxfill/occam          </Name>...
  <Style><Name>boxfill/rainbow        </Name>...
  <Style><Name>boxfill/sst_36         </Name>...
  <Style><Name>boxfill/ferret         </Name>...

From the above xml extract we will can distill all values necesarry to request an image. Note that this dataset is available in 9 coordinate systems (EPSG:4326 is required, this is the WGS84 lat-lon system), and in 11 different color maps.

Request some WMS server content

Now we can actually get a subset from the dataset want by using request=GetMap instead of the request=GetCapabilities we used above to obtain the meta-data (order ice cream). The following <keyword,value> pairs are mandatory for the Getmap request.






Mandatory WMS standard value



Mandatory WMS standard value



One of the mandatory WMS standard values returned by returned by the request=GetCapabilities



bounding box: min(longitude),min(latitude),max(longitude),max(latitude)



WMS counterpart of WCS coverage



One of the mandatory WMS standard values by returned by the request=GetCapabilities tag <Capability><Request><GetCapabilities><Format>. In the example above there are 4 formats.



One of the server-defined values by returned by the request=GetCapabilities tag <Layer><Layer><Layer queryable="1"><CRS>. In the example above there are 9 geographic projections available . Note that the colon in EPSG:4326 has been replaced by by %3A because colons are not allowed in urls. CRS always consists of namespace:identifier, in this case there are two namespaces.For more info on the projections see and



width of the image in number of pixels. The xml file show a max
MaxWidth and MaxHeight allowd by the server.



height of the image in number of pixels



One of the server-defined values by returned by the request=GetCapabilities tag <Layer><Layer><Layer queryable="1"><Name>topo</Name><Style><Name>. In the example above there are 10 styles, for screenshots click the gallery below. Unfortunately, it is not easily possible to supply your own colormap and colorlimits. for this you need to obtain the data and plot it yourselves, please refer to our WCS primer.

A valid WMS request example for one of the available formats is given below. You can copy it into your browser to obtain the image, and see that is works. We chose the same bounding boxes as in the OPeNDAP primer that access these very same datasets via netCDF libraries in Matlab, python or R. We discussed the pros and cons of WCS vs OPeNDAP in a paper in Transactions in GIS that was presented at the FOSS4G conference.

Use WMS server content

The procedure described above is illustratory to understand how WMS works, and to implement your own WMS request in scripting languages like Matlab, Python or R. However, most users of WMS will never ever have to see how WMS works, because user-friendly computer programs can construct the WMS urls for you. Or the WMS has been integrated as back-ground technology in web-portals. Well-known user-friendly WMS clients are Google Earth for the general public, and GIS packages for professionals like ESRI ArcGis and QGIS.


Some additional, optional WMS keywords are:






Background transparency of map, valid for encoding format that can handle transparency, e.g. png.



ISO time notation. Only when data are time-dependent. When not specified for data that is time-depended, the latest time is returned. Time is not implemented in most GIS-minded software packages yet. For an example on how to specify time requests see MapServer . For an example of time implementation see the ADAGUC WMS server and WMS web client.



elevation of layer desired



background color of map

WMS offers more than described in this primer. It it also possible to request a legend for a specific style, and to request the data at one pixel an image you requested. For these more sophisticated options, please refer to the full WMS specifications or WMS extentions with some non-standard extensions by THREDDS/ncWMS


  • No labels