wiki:WMSGuide

Version 15 (modified by bphamhuu, 3 weeks ago) (diff)

add note for creating WMS query style correctly in Tomcat (character { } without encoding is not valid standard)

WMS 1.3 Guide

This page contains a small intro on the capabilities of the WMS 1.3 service offered by Petascope.

Administration

The WMS 1.3 is self-administered by all intents and purposes, the database schema is created automatically and updates each time the Petascope servlet starts if necessary. The only input needed from the administrator is the service information which should be filled in $RMANHOME/etc/wms_service.properties before the servlet is started.

Errors and Workarounds

NOTE: If using QGIS and when ingest a new layer by wcst_import to Petascope and you cannot load this new layer in QGIS. In this case, the problem is due to QGIS cache the WMS GetCapabilities? from last request so the new layer does not exist (see here for clear caching solution: http://osgeo-org.1560.x6.nabble.com/WMS-provider-Cannot-calculate-extent-td5250516.html)

Data ingestion & removal

Layers can be easily created from existing coverages in WCS. The InsertWCSLayer request will create a layer from a coverage served by the web coverage service offered by Petascope. Example of such a request:

http://example.org/rasdaman/ows?service=WMS&version=1.3.0&request=InsertWCSLayer&wcsCoverageId=MyCoverage

This has several advantages:

  • Creating the layer is extremely simple and can be done by both humans and machines
  • The possibilities of inserting data into WCS are quite advanced (see wiki:WCSTImportGuide)
  • Data is not duplicated among the services offered by Petascope

To remove a layer use the following request:

http://example.org/rasdaman/ows?service=WMS&version=1.3.0&request=DeleteLayer&layer=MyLayerName

Transparent nodata value

By adding parameter transparent=true to WMS Request, the returned image will be added NoData? Value=0 int the bands's metadata, then WMS client will consider all the pixels with 0 value is transparent, e.g:

http://localhost:8080/rasdaman/ows?service=WMS&version=1.3.0&request=GetMap&layers=waxlake1&bbox=618887,3228196,690885,%203300195.0&crs=EPSG:32615&width=600&height=600&format=image/png&TRANSPARENT=TRUE

If not add this parameter, the return image will not be added the metadata 'Nodata Value', therefore, will not be transparent in WMS client.

Style creation

Styles can be created for layers using rasql query fragments. This allows users to define several visualization options for the same dataset in a flexible way. Examples of such options would be color classification, NDVI detection etc. The following HTTP request will create a style with the name, abstract and layer provided in the KVP parameters below

NOTE: for Tomcat version 7+ it requires the query (WCPS fragment, Rasql fragment) to be encoded correctly. Please use this website http://meyerweb.com/eric/tools/dencoder/ to encode your query first:

e.g:

switch case $c > 1000 return {red: 107; green:17; blue:68} default return {red: 150; green:103; blue:14})

is translated to

switch%20case%20%24c%20%3E%201000%20return%20%7Bred%3A%20107%3B%20green%3A17%3B%20blue%3A68%7D%20default%20return%20%7Bred%3A%20150%3B%20green%3A103%3B%20blue%3A14%7D)
  • WCPS query fragment (version 9.5):
http://localhot:8080/rasdaman/ows?
service=WMS&
version=1.3.0&
request=InsertStyle&
name=wcpsQueryFragment&
layer=test_wms_4326&
abstract=This style marks the areas where fires are in progress with the color red&
wcpsQueryFragment=switch case $c > 1000 return {red: 107; green:17; blue:68} default return {red: 150; green:103; blue:14})

You can add a WCPS fragment (coverage expression inside encode() operator) from a working WCPS query to make a WMS style for a layer. The variable $c will be replaced by a layer name when sending a GetMap? request containing this layer's style.

  • Rasql transform fragment (deprecated):
http://example.org/rasdaman/ows?service=WMS&version=1.3.0&request=InsertStyle
&name=FireMarkup
&layer=dessert_area
&abstract=This style marks the areas where fires are in progress with the color red
&rasqlTransformFragment=case $Iterator when ($Iterator + 2) > 200 then {255, 0, 0} else {0, 255, 0} end

The rasqlTransformFragment contains the query fragment that can modify the normal result of the layer. The variable $Iterator will be replaced with the actual name of the rasdaman collection and the whole fragment will be integrated inside the regular GetMap? query

Removal

To remove a particular style you can use a DeleteStyle? request. Note that this is a non-standard extension of WMS 1.3.

http://example.org/rasdaman/ows?service=WMS&version=1.3.0&request=DeleteStyle&layer=dessert_area&style=FireMarkup

Testing the WMS

You can test the service using your favorite WMS client or directly through a GetMap? request like the following:

http://example.org/rasdaman/ows?service=WMS&version=1.3.0&request=GetMap
&layers=MyLayer
&bbox=618885.0,3228195.0,690885.0,3300195.0
&crs=EPSG:32615
&width=600
&height=600
&format=image/png