Child pages
  • WMS primer

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

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.

...

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

Code Block

http://geoport.whoi.edu/thredds/wms/bathy/srtm30plus_v6?service=WMS&request=GetCapabilities

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.). For GIS package users you do not have to read the rest of this tutorial, you can simply feed http://geoport.whoi.edu/thredds/wms/bathy/srtm30plus_v6?service=WMS to your GIS package that can handle WMS, like Google Earth.

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:

Code Block

<WMS_Capabilities version="1.3.0" ... >

<Capability>
<Request>
...
<GetMap>
<Format>image/jpeg</Format>
<Format>image/png</Format>
<Format>application/vnd.google-earth.kmz</Format>
<Format>image/gif</Format>
...
</GetMap>
...
</WMS_Capabilities>

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.

Code Block

<Layer>
 ...
 <CRS>EPSG:4326</CRS>
 <CRS>CRS:84</CRS>
 <CRS>EPSG:41001</CRS>
 <CRS>EPSG:3857</CRS>
 <CRS>EPSG:27700</CRS>
 <CRS>EPSG:3408</CRS>
 <CRS>EPSG:3409</CRS>
 <CRS>EPSG:32661</CRS>
 <CRS>EPSG:32761</CRS>
 ...
 <Layer>
  <Title>UCSD SRTM30_v6 Global DEM (30 sec)</Title>
  <Layer queryable="1">
  <Name>topo</Name>
  ...
  <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>...
  <Style><Name>boxfill/occam_pastel-30</Name>
  ...
  </Layer>
 </Layer>
</Layer>

...

keyword

value

source

service

WMS

Mandatory WMS standard value

request

GetMap

Mandatory WMS standard value

version

1.3.0

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

BBOX

0,50,10,55

bounding box: min(longitude),min(latitude),max(longitude),max(latitude) . WMS is know to be a hotchpotch for coordinate order, this particular server configuration seems to prefer lat-lon.

layers

topo

WMS counterpart of WCS coverage

format

image/png

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.

CRS

EPSG%3A4326

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 spatialreference.org and epsg-registry.org.

SRS

EPSG%3A4326

for WMS version 1.1.1 use SRS instead of same as CRS, and mind that lat-lon have been swapped for WGS84 EPSG%3A4326 compared to version 1.3.0

width

800

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

height

600

height of the image in number of pixels

styles

boxfill/redblue

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 (NB you can copy-n-paste it into your browser address without removing the end-of-line enters). You can copy it into your browser to obtain the image, and see that is it 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.

Code Block

http://geoport.whoi.edu/thredds/wms/bathy/smith_sandwell_v11?service=WMS
&version=1.3.0
&request=GetMap
&bbox=50,0,5055,10,55
&layers=topo
&format=image/png
&crs=EPSG%3A4326
&width=800
&height=600
&styles=boxfill/redblue

...

Some additional, optional WMS keywords are :also possible. In addition, some WMS implementations offers more functionality 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. An import one is COLORSCALERANGE.

keyword

value

source

TRANSPARENT

True

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

standard

time

yyyy-mm-ddTHH:MM:SSZ

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.

standard

elevation

number

elevation of layer desired

standard

BGCOLOR

 

background color of map

...

(format 0x hexadecimal code of color, so white is &BGCOLOR=0xffffff)

standard

COLORSCALERANGE

"auto" or "min,max"

min. and maximum color range values

NOT STANDARD

Image Added - Image Added - Image Added
Figure: example of the same image, same style but different COLORSCALERANGE

See also: MassGIS WMS, Opengeo WMS, NLR geo services

Examples

Gallery