EOX-A/libcoverage.js

Name: libcoverage.js

Owner: EOX IT Services GmbH

Description: A WCS (Web Coverage Service) client library for JavaScript.

Created: 2012-05-02 11:02:44.0

Updated: 2017-07-27 17:02:17.0

Pushed: 2017-04-30 17:20:16.0

Homepage: null

Size: 473

Language: HTML

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

libcoverage.js

Libcoverage.js is an extensible client library for the Open Geospatial Constortium (OGC) Web Coverage Service 2.0+ interface standard using a MIT style license.

It features means to create requests from parameters and parse the results returned from a WCS service.

Installation

You can use libcoverage.js either via npm:

install libcoverage

Or as a pre-bundled package:

ipt src="path/to/libcoverage.min.js"></script>
Usage

Loading the modules (When not using the pre-bundled Version)

parse = require("libcoverage/src/parse");
kvp = require("libcoverage/src/kvp");
eoParse = require("libcoverage/src/eowcs/parse");
eoKvp = require("libcoverage/src/eowcs/parse");

Installing EO-WCS parsing extensions

e.pushParseFunctions(eoPparse.parseFunctions);

Creating a GetCapabilities KVP request

url = kvp.getCapabilitiesURL(baseUrl, {
datesequence: "someupdatesequence",
ctions: ["ServiceIdentification", "Contents"]

Creating a DescribeCoverage KVP request

url = kvp.describeCoverageURL(baseUrl, [
overageA", "coverageB"

Creating a GetCoverage KVP request

url = kvp.getCoverageURL(baseUrl, "coverageId", {
rmat: "image/tiff",
bsetX: [3.15, 3.25],
bsetY: [22.28, 23.00],
ze: [100, 700],
terpolation: "nearest"

Full GetCapabilities round-trip

xhr = new XMLHttpRequest();
open('GET', kvp.getCapabilitiesURL(baseUrl), true);
onload = function(e) {
r capabilities = parse.parse(this.response);
nsole.log(capabilities);

send();

For compatibility reasons, the pre-bundled version of libcoverage.js exports a WCS object object in the global scope (the window) with the following sub-elements, mapping to the respective modules:

To get a complete picture of all available functions and parameters, please refer to the API docs.

Note: libcoverage.js does not have any further dependency but relies on the XPath API, and thus needs a browser that correctly supports it.

Extending libcoverage.js

Since WCS 2.0 uses a Core/Extension approach it is vital for a client library to be extensible to easily adapt new extensions. This is mostly important for parsing service responses.

Libcoverage.js allows the registration of new parsing functions for the node name of the elements it shall parse. The results of all registered functions for the same tag are deep-merged together, so the extending parse functions should only parse information not yet included in the main parsing result.

To extend the core parsing capabilities with some specific functionality, one first has to design the parsing function which always takes the XML DOM node as parameter:

parseExtendedCapabilities = function(node) {
return {
    // parse data and insert it here
    specialData: someFinder(node, "SomePath").text
}

Then, the function has to be registered for the node name (without the namespace prefix):

Core.Parse.pushParseFunction("Capabilities", parseExtendedCapabilities);
Example extension: EO-WCS

Libcoverage.js ships with a client extension for Earth Observation (EO-WCS). It provides a new function for generating requests (WCS.EO.KVP.describeEOCoverageSetURL) and new element parsing functions for Capabilities, CoverageDescriptions and EOCoverageSetDescriptions which are registered once the module is loaded.

The extended Capabilities parse function extends the parsed object with additional information about advertised dataset series. The CoverageDescriptions objects, on the other hand, are extended by the time interval and the footprint.

Integrations

Currently there is only one integration, namely for the MVC framework Backbone. The integration provides the models Service and Coverage and the collection CoverageSet. If the EO-WCS extension for libcoverage.js is also available, then the EOCoverageSet is included aswell. The models integrate seamlessly within Backbone and can be used alongside other models and object synchronization.

Unfortunately, as with the current status of Web Coverage Service - Transactional (WCS-T) it is not possible to integrate creation or modification of coverages within backbone and thus all related function calls will fail. This may change once the transactional interface extension for WCS 2.0 is specified.

References

This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.