.. _cov_json:
CoverageJSON output format
==========================
`CoverageJSON `_ is a format for encoding geotemporal coverage data like grids and time series. For example, it can be as output format for a WCS2.0 getCoverage requesting a TimeSeries on a specific coordinate. As per the specification, the format to be specified to get back a cov-json output is *application/prs.coverage+json*.
Installation
------------
As a community module, the cov-json package needs to be downloaded from the `nightly builds `_,
picking the community folder of the corresponding GeoServer series (e.g. if working on the GeoServer main development branch nightly
builds, pick the zip file form ``main/community-latest``).
To install the module, unpack the zip file contents into GeoServer own ``WEB-INF/lib`` directory and restart GeoServer.
Example: WCS 2.0 - TimeSeries
-----------------------------
Let *test:timeseries* be a sample layer related to a coverage with time dimensions enabled. Suppose we want to get the coverage values for a specific time period on a specific lat/lon coordinate. That will be a slicing on lat/lon coordinate and trimming on time dimension.
A getCoverage request can be posted with a similar content to http://server:port/geoserver/wcs:
.. code-block:: xml
test__timeseries
application/prs.coverage+json
Long
56
Lat
0
Time
2014-01-01T00:00:00.000Z
2017-01-01T00:00:00.000Z
The outcome will be something like this:
.. code-block:: json
{
"type": "Coverage",
"domain": {
"type": "Domain",
"domainType": "PointSeries",
"axes": {
"x": {
"values": [
56.0
]
},
"y": {
"values": [
1.0112359550561785
]
},
"t": {
"values": [
"2014-01-01T00:00:00Z",
"2015-01-01T00:00:00Z",
"2016-01-01T00:00:00Z",
"2017-01-01T00:00:00Z"
]
}
},
"referencing": [
{
"coordinates": [
"x",
"y"
],
"system": {
"type": "GeographicCRS",
"id": "http://www.opengis.net/def/crs/EPSG/0/4326"
}
},
{
"coordinates": [
"t"
],
"system": {
"type": "TemporalRS",
"calendar": "Gregorian"
}
}
]
},
"parameters": {
"TIMESERIES": {
"type": "Parameter",
"description": {
"en": "timeseries"
},
"observedProperty": {
"label": {
"en": "timeseries"
}
}
}
},
"ranges": {
"TIMESERIES": {
"type": "NdArray",
"dataType": "float",
"axisNames": [
"t",
"y",
"x"
],
"shape": [
4,
1,
1
],
"values": [
25.5,
24.76,
26.06,
23.22
]
}
}
}
Note the domainType = PointSeries where x,y axes have a single and the t axis has 4 times in the values. Also note the ranges property is reporting 4 values.