.. index:: single: WCS Server .. _WCS_server: ***************************************************************************** WCS Server ***************************************************************************** :Author: Jeff McKenna :Contact: jmckenna at gatewaygeomatics.com :Author: Stephan Meissl :Contact: stephan.meissl at eox.at :Last Updated: 2011-03-30 .. contents:: Table of Contents :depth: 2 :backlinks: top Introduction ============ A WCS (or Web Coverage Service) allows for the publication of "coverages"- digital geospatial information representing space-varying phenomena. In the MapServer world it allows for unfiltered access to raster data. Conceptually it is easy think of WCS as a raster equivalent of WFS. The following documentation is based on the `Open Geospatial Consortium's (OGC) Web Coverage Service Interfaces Implementation Specification version 1.0.0`_. Links to WCS-Related Information -------------------------------- - `OGC'c WCS Standard page`_ - `WCS 1.0.0 specification`_ - `WCS 1.1.1c1 specification`_ - WCS 2.0 - `GML 3.2.1 Application Schema Coverages`_ - `WCS 2.0 Specification - Core`_ - `WCS 2.0 Specification - KVP Protocol Binding Extension`_ - `WCS 2.0 Specification - XML/POST Protocol Binding Extension`_ - :ref:`WMS Server HowTo ` Software Requirements --------------------- In order to enable MapServer to serve WCS data, it MUST be compiled against certain libraries: - PROJ.4: The reprojection library. Version 4.4.3 or greater is required. - GDAL: raster support library. - MapServer: version >= 4.4 (tested with 5.0.2 while updating this document) For WCS 1.1.x (MapServer 5.2) and WCS 2.0 (MapServer 6.0) support there is an additional requirement: - libxml2: An xml parser and generation library. Please see the :ref:`MapServer UNIX Compilation and Installation HowTo ` for detailed instructions on compiling MapServer with support for these libraries and features. For Windows users, `MapServer for Windows (MS4W)`_ comes with WCS Server support. .. index:: pair: WCS Server; Mapfile Configuring Your Mapfile to Serve WCS Layers ============================================ Much as in the WMS and WFS support, WCS publishing is enabled by adding certain magic METADATA keyword/value pairs to a .map file. MapServer will serve and include in its WCS capabilities only the layers that meet the following conditions: - Data source is a raster, which is processed using GDAL (e.g GeoTIFF, Erdas Imagine, ...) - LAYER NAME must be set - LAYER TYPE is set to RASTER - WEB metadata or LAYER metadata "wcs_enable_request" must be set - WEB metadata "wcs_label" must be set - LAYER metadata "wcs_label" must be set - LAYER metadata "wcs_rangeset_name" must be set - LAYER metadata "wcs_rangeset_label" must be set - LAYER is enabled to be served via WCS (see `MS RFC 67`_) - LAYER PROJECTION must be set, even if PROJECTION is set at the MAP level (a bug?) Example WCS Server Mapfile -------------------------- The following is an example of a simple WCS Server mapfile. Note the comments for the required parameters. .. code-block:: mapfile MAP NAME WCS_server STATUS ON SIZE 400 300 SYMBOLSET "../etc/symbols.txt" EXTENT -2200000 -712631 3072800 3840000 UNITS METERS SHAPEPATH "../data" IMAGECOLOR 255 255 255 FONTSET "../etc/fonts.txt" # # Start of web interface definition # WEB IMAGEPATH "/ms4w/tmp/ms_tmp/" IMAGEURL "/ms_tmp/" METADATA "wcs_label" "GMap WCS Demo Server" ### required "wcs_description" "Some text description of the service" "wcs_onlineresource" "http://127.0.0.1/cgi-bin/mapserv.exe?" ### recommended "wcs_fees" "none" "wcs_accessconstraints" "none" "wcs_keywordlist" "wcs,test" "wcs_metadatalink_type" "TC211" "wcs_metadatalink_format" "text/plain" "wcs_metadatalink_href" "http://someurl.com" "wcs_address" "124 Gilmour Street" "wcs_city" "Ottawa" "wcs_stateorprovince" "ON" "wcs_postcode" "90210" "wcs_country" "Canada" "wcs_contactelectronicmailaddress" "blah@blah" "wcs_contactperson" "me" "wcs_contactorganization" "unemployed" "wcs_contactposition" "manager" "wcs_contactvoicetelephone" "613-555-1234" "wcs_contactfacimiletelephone" "613-555-1235" "wcs_service_onlineresource" "http://127.0.0.1/cgi-bin/mapserv.exe?" "wcs_enable_request "*" END END PROJECTION "init=epsg:42304" END LAYER NAME bathymetry METADATA "wcs_label" "Elevation/Bathymetry" ### required "wcs_rangeset_name" "Range 1" ### required to support DescribeCoverage request "wcs_rangeset_label" "My Label" ### required to support DescribeCoverage request END TYPE RASTER ### required STATUS ON DATA bath_mapserver.tif PROJECTION "init=epsg:42304" END END END # Map File .. index:: pair: WCS Server; Output formats Output Formats -------------- The raster formats supported by MapServer WCS are determined by the wcs_formats metadata item on the LAYER. This should contain a space separated list of OUTPUTFORMAT driver names separated by spaces. If absent, all raster OUTPUTFORMATs are allowed. WCS is a "raw data" oriented format. So it often most suitable to use it with format using the BYTE, INT16 and FLOAT32 IMAGEMODEs with GDAL related output formats rather than the built in "rendering oriented" output formats. By default the only GDAL format driver defined is the GTiff driver. The following are example output format declarations utilizing the raw image modes:: OUTPUTFORMAT NAME GEOTIFF_16 DRIVER "GDAL/GTiff" MIMETYPE "image/tiff" IMAGEMODE FLOAT32 EXTENSION "tif" END OUTPUTFORMAT NAME AAIGRID DRIVER "GDAL/AAIGRID" MIMETYPE "image/x-aaigrid" IMAGEMODE INT16 EXTENSION "grd" FORMATOPTION "FILENAME=result.grd" END The FORMATOPTION FILENAME defines the preferred name of the result file when returned WCS GetCoverage results. Test Your WCS 1.0 Server ======================== Validate the Capabilities Metadata ---------------------------------- OK, now that we've got a mapfile, we have to check the XML capabilities returned by our server to make sure nothing is missing. Using a web browser, access your server's online resource URL to which you add the parameters "SERVICE=WCS&VERSION=1.0.0&REQUEST=GetCapabilities" to the end, e.g. :: http://my.host.com/cgi-bin/mapserv?map=mywcs.map&SERVICE=WCS &VERSION=1.0.0&REQUEST=GetCapabilities If you get an error message in the XML output then take necessary actions. Common problems and solutions are listed in the FAQ at the end of this document. If everything went well, you should have a complete XML capabilities document. Search it for the word "WARNING"... MapServer inserts XML comments starting with "