GeoJSON Feature¶
CWL example¶
cwlVersion: v1.2
class: CommandLineTool
label: "Echo GeoJSON Feature"
baseCommand: echo
requirements:
- class: InlineJavascriptRequirement
- class: SchemaDefRequirement
types:
- $import: https://raw.githubusercontent.com/eoap/schemas/main/geojson.yaml
inputs:
aoi:
type: https://raw.githubusercontent.com/eoap/schemas/main/geojson.yaml#Feature
label: "Area of interest"
doc: "Area of interest defined in GeoJSON format"
inputBinding:
valueFrom: |
${
// Validate if type is 'Feature'
if (inputs.aoi.type !== 'Feature') {
throw "Invalid GeoJSON type: expected 'Feature', got '" + inputs.aoi.type + "'";
}
// get the Feature geometry type
return "Feature with id '" + inputs.aoi.id + "' is of type: " + inputs.aoi.geometry.type;
}
outputs:
echo_output:
type: stdout
stdout: echo_output.txt
Input example¶
aoi:
class: https://raw.githubusercontent.com/eoap/schemas/main/geojson.yaml#Feature
id: "aoi-1"
type: "Feature"
bbox:
- 73.958
- -40.8003
- 73.9737
- 40.7648
geometry:
type: MultiPolygon
coordinates:
- - - - -73.958
- 40.8003
- - -73.9498
- 40.7968
- - -73.9737
- 40.7648
- - -73.9814
- 40.7681
- - -73.958
- 40.8003
- - - - -73.958
- 40.8003
- - -73.9498
- 40.7968
- - -73.9737
- 40.7648
- - -73.958
- 40.8003
bbox:
- 73.958
- -40.8003
- 73.9737
- 40.7648
Execute the example¶
Run the example with:
cwltool examples/geojson/feature.cwl examples/geojson/feature.yaml
This produces the output:
INFO /opt/hostedtoolcache/Python/3.13.5/x64/bin/cwltool 3.1.20250715140722
INFO Resolved '../../examples/geojson/feature.cwl' to 'file:///home/runner/work/schemas/schemas/examples/geojson/feature.cwl'
INFO [job feature.cwl] /tmp/fembj5qp$ echo \
'Feature with id '"'"'aoi-1'"'"' is of type: MultiPolygon' > /tmp/fembj5qp/echo_output.txt
INFO [job feature.cwl] completed success
INFO Final process status is success
The content of the echo_output.txt
file is:
Feature with id 'aoi-1' is of type: MultiPolygon