STAC Collection¶
CWL example¶
cwlVersion: v1.2
class: CommandLineTool
label: "Echo STAC Collection"
baseCommand: echo
requirements:
- class: InlineJavascriptRequirement
- class: SchemaDefRequirement
types:
- $import: https://raw.githubusercontent.com/eoap/schemas/main/stac.yaml
inputs:
stac_collection:
type: https://raw.githubusercontent.com/eoap/schemas/main/stac.yaml#Collection
label: "STAC Collection"
doc: "STAC Collection defined in STAC format"
inputBinding:
valueFrom: |
${
// Validate if type is 'Collection'
if ('Collection' !== inputs.stac_collection.type) {
throw "Invalid STAC type: expected 'Collection', got '" + inputs.stac_collection.type + "'";
}
// get the STAC Collection description
return "STAC Collection ID: " + inputs.stac_collection.id;
}
outputs:
echo_output:
type: stdout
stdout: echo_output.txt
Input example¶
stac_collection:
stac_version: "1.0.0"
type: "Collection"
id: collection-id
description: a collection description
license: 'Creative Commons Attribution-ShareAlike 4.0 International'
links:
- rel: "self"
href: "./item.json"
type: "application/json"
title: "This collection"
Execute the example¶
Run the example with:
cwltool examples/stac/collection.cwl examples/stac/collection.yaml
This produces the output:
INFO /opt/hostedtoolcache/Python/3.13.5/x64/bin/cwltool 3.1.20250715140722
INFO Resolved '../../examples/stac/collection.cwl' to 'file:///home/runner/work/schemas/schemas/examples/stac/collection.cwl'
INFO [job collection.cwl] /tmp/yuejz_qs$ echo \
'STAC Collection ID: collection-id' > /tmp/yuejz_qs/echo_output.txt
INFO [job collection.cwl] completed success
INFO Final process status is success
The content of the echo_output.txt
file is:
STAC Collection ID: collection-id