OGC Bounding Box¶
CWL Example¶
cwlVersion: v1.2
class: CommandLineTool
label: "Echo OGC BBox"
baseCommand: echo
requirements:
- class: InlineJavascriptRequirement
- class: SchemaDefRequirement
types:
- $import: https://raw.githubusercontent.com/eoap/schemas/main/ogc.yaml
inputs:
aoi:
type: https://raw.githubusercontent.com/eoap/schemas/main/ogc.yaml#BBox
label: "Area of interest"
doc: "Area of interest defined as a bounding box"
inputBinding:
valueFrom: |
${
// Validate the length of bbox to be either 4 or 6
var bboxLength = inputs.aoi.bbox.length;
if (bboxLength !== 4 && bboxLength !== 6) {
throw "Invalid bbox length: bbox must have either 4 or 6 elements.";
}
// Convert bbox array to a space-separated string for echo
return inputs.aoi.bbox.join(' ') + " CRS: " + inputs.aoi.crs;
}
outputs:
echo_output:
type: stdout
stdout: echo_output.txt
Input example¶
aoi:
class: "https://raw.githubusercontent.com/eoap/schemas/main/ogc.yaml#BBox"
bbox: [100.0, 0.0, 101.0, 1.0]
crs: "CRS84"
Execute the example¶
Run the example with:
cwltool examples/ogc-bbox/ogc-bbox.cwl examples/ogc-bbox/ogc-bbox.yaml > output.json
This produces the output:
INFO /opt/hostedtoolcache/Python/3.13.5/x64/bin/cwltool 3.1.20250110105449
INFO Resolved '../examples/ogc-bbox/ogc-bbox.cwl' to 'file:///home/runner/work/schemas/schemas/examples/ogc-bbox/ogc-bbox.cwl'
INFO [job ogc-bbox.cwl] /tmp/sz5t39n8$ echo \
'100 0 101 1 CRS: CRS84' > /tmp/sz5t39n8/echo_output.txt
INFO [job ogc-bbox.cwl] completed success
INFO Final process status is success
The content of the echo_output.txt
file is:
100 0 101 1 CRS: CRS84