Skip to content

OGC API

This page shows how to use the workflow using web APIs.

NOTE

This part is still in development

Start the workflow

Access the OGC API - Processes at the entry point http://ogc.api.fairsendd.eodchosting.eu. Further documentation is provided at the Swagger OpenAPI page.

Get information about the process:

bash
curl -X 'GET' \
  'http://ogc.api.fairsendd.eodchosting.eu/processes/squared?f=json' \
  -H 'accept: application/json'
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100  2522  100  2522    0     0   6029      0 --:--:-- --:--:-- --:--:--  6019
{
    "version":"0.1.0",
    "id":"squared",
    "title":"Squared processor",
    "description":"An example process that takes a number or integer and returns the squared result",
    "jobControlOptions":[
        "sync-execute"
    ],
    "keywords":[
        "squared"
    ],
    "links":[
        {
            "type":"text/html",
            "rel":"about",
            "title":"information",
            "href":"https://example.org/process",
            "hreflang":"en-US"
        },
        {
            "type":"application/json",
            "rel":"self",
            "href":"/processes/squared?f=json",
            "title":"Process description as JSON",
            "hreflang":"en-US"
        },
        {
            "type":"text/html",
            "rel":"alternate",
            "href":"/processes/squared?f=html",
            "title":"Process description as HTML",
            "hreflang":"en-US"
        },
        {
            "type":"text/html",
            "rel":"http://www.opengis.net/def/rel/ogc/1.0/job-list",
            "href":"/jobs?f=html",
            "title":"Jobs list as HTML",
            "hreflang":"en-US"
        },
        {
            "type":"application/json",
            "rel":"http://www.opengis.net/def/rel/ogc/1.0/job-list",
            "href":"/jobs?f=json",
            "title":"Jobs list as JSON",
            "hreflang":"en-US"
        },
        {
            "type":"application/json",
            "rel":"http://www.opengis.net/def/rel/ogc/1.0/execute",
            "href":"/processes/squared/execution?f=json",
            "title":"Execution for this process as JSON",
            "hreflang":"en-US"
        }
    ],
    "inputs":{
        "value":{
            "title":"Number",
            "description":"number or integer",
            "schema":{
                "oneOf":[
                    "number",
                    "integer"
                ]
            },
            "minOccurs":1,
            "maxOccurs":1,
            "metadata":null,
            "keywords":[
                "number"
            ]
        }
    },
    "outputs":{
        "squared":{
            "title":"Squared",
            "description":"An example process that takes a number or integer and returns the squared result",
            "schema":{
                "type":"object",
                "contentMediaType":"application/json"
            }
        }
    },
    "example":{
        "inputs":{
            "value":3
        }
    },
    "outputTransmission":[
        "value"
    ]
}

Execute the workflow and start the job:

bash
curl -X 'POST' \
  'http://ogc.api.fairsendd.eodchosting.eu/processes/squared/execution' \
  -H 'accept: application/json' \
  -H 'Content-Type: application/json' \
  -d '{
  "inputs": {
    "value": 3
  }
}'
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100    73  100    37  100    36    100     97 --:--:-- --:--:-- --:--:--   198
{
    "id":"squared",
    "value":9
}

Get results

Access job results using its id:

python
import xarray as xr
import matplotlib.pyplot as plt


job_id = "test1"
ds_path = "E051N018T3_rqatrend_VH_D022_thresh_3.0.zarr"
ds = xr.open_zarr(f"http://s3.fairsendd.eodchosting.eu/userdata/{job_id}/{ds_path}")
/root/miniconda3/lib/python3.12/site-packages/xarray/conventions.py:289: SerializationWarning: variable 'layer' has multiple fill values {np.float32(1e+32), np.float64(1e+32)} defined, decoding all values to NaN.
  var = coder.decode(var, name=name)
python
ds.layer.plot()
plt.show()