Book Image

GeoServer Cookbook

By : Stefano Iacovella
Book Image

GeoServer Cookbook

By: Stefano Iacovella

Overview of this book

Table of Contents (17 chapters)
GeoServer Cookbook
Credits
About the Author
Acknowledgments
About the Reviewers
www.PacktPub.com
Preface
Index

Publishing raster data with WCS


The WCS option is always present in the panel to configure services. As we already noted, WCS is used to publish raster data, so this may sound odd to you. Indeed, ArcGIS for Server lets you enable the WCS option, only if the map project for the service contains one of the following:

  • A map containing raster or mosaic layers

  • A raster or mosaic dataset

  • A layer file referencing a raster or mosaic dataset

  • A geodatabase that contains raster data

If you try to enable the WCS option on SampleWorldCities, you won't get an error. Then, try to ask for the capabilities:

$ curl -XGET "http://localhost/arcgis/services/SampleWorldCities/MapServer/WCSServer?SERVICE=WCS&VERSION=1.1.1&REQUEST=GetCapabilities" -o capabilitiesArcGISWCS.xml

You'll get a proper document, compliant to the standard and well formatted, but containing no reference to any dataset. Indeed, the sample service does not contain any raster data:

<Capabilities xsi:schemaLocation="http://www.opengis.net/wcs/1.1.1 http://schemas.opengis.net/wcs/1.1/wcsGetCapabilities.xsd http://www.opengis.net/ows/1.1/ http://schemas.opengis.net/ows/1.1.0/owsAll.xsd" version="1.1.1">
    <ows:ServiceIdentification>
        <ows:Title>WCS</ows:Title>
        <ows:ServiceType>WCS</ows:ServiceType>
        <ows:ServiceTypeVersion>1.0.0</ows:ServiceTypeVersion>
        <ows:ServiceTypeVersion>1.1.0</ows:ServiceTypeVersion>
        <ows:ServiceTypeVersion>1.1.1</ows:ServiceTypeVersion>
        <ows:ServiceTypeVersion>1.1.2</ows:ServiceTypeVersion>
        <ows:Fees>NONE</ows:Fees>
        <ows:AccessConstraints>None</ows:AccessConstraints>
    </ows:ServiceIdentification>
...
    <Contents>
        <SupportedCRS>urn:ogc:def:crs:EPSG::4326</SupportedCRS>
        <SupportedFormat>image/GeoTIFF</SupportedFormat>
        <SupportedFormat>image/NITF</SupportedFormat>
        <SupportedFormat>image/JPEG</SupportedFormat>
        <SupportedFormat>image/PNG</SupportedFormat>
        <SupportedFormat>image/JPEG2000</SupportedFormat>
        <SupportedFormat>image/HDF</SupportedFormat>
    </Contents>
</Capabilities>

If you want to try out WCS, other than the GetCapabilities operation, you need to publish a service with raster data; or, you may take a look at the sample service from ESRI arcgisonline™.

Try the following request:

$ curl -XGET "http://sampleserver3.arcgisonline.com/ArcGIS/services/World/Temperature/ImageServer/WCSServer?SERVICE=WCS&VERSION=1.1.0&REQUEST=GETCAPABILITIES" -o capabilitiesArcGISWCS.xml

Parsing the XML file, you'll find that the contents section now contains coverage, raster data that you can retrieve from that server:

…
<Contents>
  <CoverageSummary>
    <ows:Title>Temperature1950To2100_1</ows:Title>
    <ows:Abstract>Temperature1950To2100</ows:Abstract>
    <ows:WGS84BoundingBox>
      <ows:LowerCorner>-179.99999999999994 -55.5</ows:LowerCorner>
      <ows:UpperCorner>180.00000000000006 83.5</ows:UpperCorner>
    </ows:WGS84BoundingBox>
    <Identifier>1</Identifier>
  </CoverageSummary>
  <SupportedCRS>urn:ogc:def:crs:EPSG::4326</SupportedCRS>
  <SupportedFormat>image/GeoTIFF</SupportedFormat>
  <SupportedFormat>image/NITF</SupportedFormat>
  <SupportedFormat>image/JPEG</SupportedFormat>
  <SupportedFormat>image/PNG</SupportedFormat>
  <SupportedFormat>image/JPEG2000</SupportedFormat>
  <SupportedFormat>image/HDF</SupportedFormat>
</Contents>

You can, of course, use all the operations supported by standard. The following request will return a full description of one or more coverages within the service in the GML format.

An example of the URL is shown as follows:

$ curl -XGET "http://sampleserver3.arcgisonline.com/ArcGIS/services/World/Temperature/ImageServer/WCSServer?SERVICE=WCS&VERSION=1.1.0&REQUEST=DescribeCoverage&COVERAGE=1" -o describeCoverageArcGISWCS.xml

Also, you can obviously request for data, and use requests that will return coverage in one of the supported formats, namely GeoTIFF, NITF, HDF, JPEG, JPEG2000, and PNG:

Another URL example is shown as follows:

$ curl -XGET "http://sampleserver3.arcgisonline.com/ArcGIS/services/World/Temperature/ImageServer/WCSServer?SERVICE=WCS&VERSION=1.0.0&REQUEST=GetCoverage&COVERAGE=1&CRS=EPSG:4326&RESPONSE_CRS=EPSG:4326&BBOX=-158.203125,-105.46875,158.203125,105.46875&WIDTH=500&HEIGHT=500&FORMAT=jpeg" -o coverage.jpeg