GeoJSON Point¶
CWL example¶
cwlVersion: v1.2
class: CommandLineTool
label: "Echo GeoJSON Point"
baseCommand: echo
requirements:
- class: InlineJavascriptRequirement
- class: SchemaDefRequirement
types:
- $import: https://raw.githubusercontent.com/eoap/schemas/main/geojson.yaml
inputs:
point_of_interest:
type: https://raw.githubusercontent.com/eoap/schemas/main/geojson.yaml#Point
label: "Point of Interest"
doc: "Point of interest defined in GeoJSON format"
inputBinding:
valueFrom: |
${
// Validate if type is 'Point'
if (inputs.point_of_interest.type !== 'Point') {
throw "Invalid GeoJSON type: expected 'Point', got '" + inputs.point_of_interest.type + "'";
}
var coordinates = inputs.point_of_interest.coordinates;
return "Point Coordinates: " + coordinates.join(', ');
}
outputs:
echo_output:
type: stdout
stdout: echo_output.txt
Input example¶
point_of_interest:
class: https://raw.githubusercontent.com/eoap/schemas/main/geojson.yaml#Point
type: Point
coordinates:
- 125.6
- 10.1
bbox:
- 125.6
- 10.1
- 125.6
- 10.1
Execute the example¶
Run the example with:
cwltool examples/geojson/geojson-point.cwl examples/geojson/geojson-point.yaml
This produces the output:
INFO /opt/hostedtoolcache/Python/3.13.5/x64/bin/cwltool 3.1.20250110105449
INFO Resolved '../examples/geojson/geojson-point.cwl' to 'file:///home/runner/work/schemas/schemas/examples/geojson/geojson-point.cwl'
INFO [job geojson-point.cwl] /tmp/unn8_6m7$ echo \
'Point Coordinates: 125.6, 10.1' > /tmp/unn8_6m7/echo_output.txt
INFO [job geojson-point.cwl] completed success
INFO Final process status is success
The content of the echo_output.txt
file is:
Point Coordinates: 125.6, 10.1