OGC Web Services
By: Mark George Allen
Tags: Wms, Mapping, Web Mapping, Ogc, Wfs

OGC Web Services

There are many web map protocols and standards but for this post I will only be detailing the OGC standards as used by most web-based GIS, namely WMS, WMTS and WFS.

The Open Geospatial Consortium worked on standardizing web-based mapping technologies and released WMS (Web Mapping Service) 1.0.0 in 2000. GIS software was already quite mature at the time, but the internet was still relatively young and there had not been a standard approach for creating maps, map images, cartography, or user movable and zoom-able digital maps through the internet. Google Maps and Bing Maps would not appear for another five years in 2005.

WMS is a framework to allow the consumption of mapping data over the internet. A user can view a mapping area by using a Get request with a bounding box (area of interest), a map layer, a styles list, the service type, the number of pixels of the final image, and the projection system of the map. A WMS allows for the consumption of mapping data when a user has an area of interest, a bounding box of coordinates, and is usually rendered in real time by a spatial server. The user receives an image, either PNG or JPEG, of the bounding box provided. Other parameters were added to the WMS protocol, but the core user case is the same.

Image return from GOV open data

The above WMS GetMap request will return a 1000 by 1000 pixels image from an open data British Government service. The bounding box and the pixel dimensions have to have equal aspect ratios otherwise skewing or stretching of the image will occur. Also note the SRS, Spatial Reference System, that identifies which projection system is used. WMS is not that user-friendly in terms of being able to quickly change the area of interest, or even ensure that no skewing of data is present. In a projected system where coordinates represent metres from an origin point, such as British National Grid, this is much easier. It's easier to calculate the bounding box size and therefore the needed pixel aspect ratio. But in non-projected world based coordinate systems that are based on arcs this is much more difficult. It is therefore much easier to use a GIS program such as QGIS to consume WMS data.

When Google Maps and Bing Maps were established in around 2005, many users wanted to be able to view mapping online as well as pan, zoom and interrogate data (sometimes known as a slippy map). Although you can use a WMS to serve up slippy maps, the WMS standard wasn't designed for it and it can be difficult to work with. WMS is best in one image per Get request scenarios such as static maps. Another useful aspect of WMS is that layers can be combined with the use of a comma separated list. Therefore, it is possible to have one GetMap request return a base map layer and a separate feature layer such as above — tree preservation order data, overlain.

A new protocol was developed in 2010. The WMTS, is a Web Mapping Tiled Service, and shares the same basic premise of WMS except that the images returned are in small tiles of 256 or 512 size and usually pre rendered so that they can be returned very quickly to the user.

Image rendering can be quite taxing on servers especially for complex data sets full of different data types, town and place labels, cartographic styles etc. So being able to pre render small images at different map scales, often called tiles, to be sent over the internet rather than large scene images can drastically improve the speed of the service as well as the stability of the server. These tiles can also be cached on the user side.

Confusingly there is also another tile standard called TMS, Tile Map Service, developed by OSGeo, however TMS is not an OGC registered standard. Many web mapping technologies use TMS however for its simplicity.

The OGC have released many standards, however WMS and WMTS are the main raster(image) based protocols. WFS was released around 2006 and allows a user to interrogate geo spatial data. It allows for the return of vector geometries as well as tabular data corresponding to those geometries. It enabled GIS level data analysis, manipulation and editing all through the web. WFS can be quite resource heavy both on the server and a network due to the amounts of data delivered. Where a WMS only returns a rendered image that is usually compressed and relatively small, WFS may return large amounts of data in GML format. GML is a spatial data format very similar to XML in layout. WFS is very useful for when users need to view, analyse and edit geographic data usually within a GIS program. The WFS protocol allows for geometry and data editing that will save the changes back to the storage medium, usually a spatial database. GML is quite an old format and is not always that easy to use. However, the latest WFS specification version 3 which the OGC are about to release appears to be much more modern and user-friendly being designed around JSON objects, read more here for more details.

Due to the sheer amount of data that can be within a layer, for instance the service used here holds data for the whole of the UK, it is important to use some sort of filter. Usually server managers have a maximum number of features that a GetFeature request will return so as not to tax the servers too much. However, it is best practice for the user to either filter the data using an area of interest, the bbox parameter, or by using the Count/MaxFeature (Count is used in WFS 2.0.0) parameter to reduce the number of features returned. In the example below, the bounding box parameter filters the data response by only returning those features that intersect the bounding box.

Example of WFS data return, data GOV open data

The WCS Web Coverage Service, is a protocol that is similar to WFS, but it allows for a user to interagate spatial data and make a request for raster data. This service is less commonly used, and it usually used for specialist satalite imagery data or other geographical raster based data that can hold information over many years and in different contexts. WCS has more powerful filtering then WMS, and allows for multiple imagery formats and even multi-dimensional data, i.e. multi-year imagery that might show average rainful or tempertures over a time period.