Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New action that gets features from OGC API server. #988

Merged
merged 2 commits into from
Jul 27, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
124 changes: 124 additions & 0 deletions kamelets/ogcapi-features-action.kamelet.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
# ---------------------------------------------------------------------------
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ---------------------------------------------------------------------------
apiVersion: camel.apache.org/v1alpha1
kind: Kamelet
metadata:
name: ogcapi-features-action
annotations:
camel.apache.org/kamelet.support.level: "Preview"
camel.apache.org/catalog.version: "main-SNAPSHOT"
camel.apache.org/kamelet.icon: "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+CjxzdmcKICAgd2lkdGg9IjIxMDAiCiAgIGhlaWdodD0iMjEwMCIKICAgdmlld0JveD0iMCAwIDIxMDAgMjEwMCIKICAgdmVyc2lvbj0iMS4xIgogICB4bWw6c3BhY2U9InByZXNlcnZlIgogICBzdHlsZT0iY2xpcC1ydWxlOmV2ZW5vZGQ7ZmlsbC1ydWxlOmV2ZW5vZGQ7c3Ryb2tlLWxpbmV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kiCiAgIGlkPSJnMTEwMiI+CiAgICAgICAgICAgICAgICA8cGF0aAogICBkPSJNIDAsMjkuMzMgLTI1LjQwMywxNC42NjUgMCwtMC4wMDEgMjUuMzk5LDE0LjY2NSAyMS4xNjcsMTcuMTA5IFogTSAtMC4wMDEsLTkuNzc3IC00Mi4zMzYsMTQuNjY1IC0wLjAwMSwzOS4xMDcgNDIuMzMzLDE0LjY2NSBaIgogICBzdHlsZT0iZmlsbDojMDBiMWZmO2ZpbGwtcnVsZTpub256ZXJvIgogICBpZD0icGF0aDExMDAiIC8+CiAgICAgICAgICAgIDwvZz4KICAgICAgICAgICAgPGcKICAgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMTgxLjY2LDE4MS4yMzkpIgogICBpZD0iZzExMDYiPgogICAgICAgICAgICAgICAgPHBhdGgKICAgZD0ibSAwLC0yNC42ODggOC40NjgsLTQuODg4IDguNDY2LC00Ljg4OSAxMGUtNCw5Ljc3NyA4LjQ0NCwtNC44NzUgdiAtMTkuNDQ0IGwgLTQyLjMxMiwyNC40MjkgdiA5LjY2NiBoIDAuMDAxIGwgLTAuMDAxLDIuOTE4IDAuMDAxLDM2LjE5IC0wLjAyMiwtMC4wMTMgdiAwLjEzNiBMIDI1LjM3OSwtMC4xMjMgdiAtMTkuNjY1IGwgLTguNDQ0LDQuODc3IHYgOS43NzYgTCAtOC40NjYsOS41MyAtOC40NjUsLTE5Ljc5OSBaIgogICBzdHlsZT0iZmlsbDojMDBiMWZmO2ZpbGwtcnVsZTpub256ZXJvIgogICBpZD0icGF0aDExMDQiIC8+CiAgICAgICAgICAgIDwvZz4KICAgICAgICA8L2c+CiAgICA8L2c+Cjwvc3ZnPgo="
camel.apache.org/provider: "Apache Software Foundation"
camel.apache.org/kamelet.group: "Geospatial"
labels:
camel.apache.org/kamelet.type: "action"
spec:
definition:
title: "OGC Api Feature Get Item Action"
description: |-
Returns the items of the collection provided of an OGC API Features server.
The collection must be a valid collection name on the server.

Query can be defined in the body too.

See https://www.ogc.org/standards/ogcapi-features
required:
- url
- collection
type: object
properties:
url:
title: URL
description: The URL to fetch for data
type: string
example: "https://emotional.byteroad.net"
pattern: "^(http|https)://.*"
collection:
title: "Collection"
description: "Name of the collection we want to extract items from."
type: string
bbox:
title: "Bounding Box"
description: "Bounding Box of the items we want to retrieve."
example: "160.6,-55.95,-170,-25.89"
default: "-180,-90,180,90"
type: string
limit:
title: "Limit"
description: "Maximum number of items to retrieve. Must be a number between 1 and 10 000."
type: integer
default: 10
split:
title: "Split by Feature"
description: "When true, instead of returning the full geojson, split the message into each feature."
type: boolean
default: false
x-descriptors:
- 'urn:alm:descriptor:com.tectonic.ui:checkbox'
query:
title: "Query"
description: "Separated list by `&` of properties we want to query."
example: "property1=1&property2=dos"
default: ""
type: string
types:
in:
mediaType: text/plain
out:
mediaType: application/json
dependencies:
- "camel:core"
- "camel:http"
- "camel:kamelet"
- "camel:jsonpath"
- "camel:jackson"
template:
from:
uri: "kamelet:source"
steps:
- set-header:
name: "Accept"
constant: "application/geo+json"
- set-header:
name: "CamelHttpQuery"
simple: "limit={{limit}}&bbox={{bbox}}&{{?query}}&${body}"
- set-body:
simple: ""
- to:
uri: "{{url}}/collections/{{collection}}/items"
- remove-header:
name: "Accept"
- remove-header:
name: "CamelHttpQuery"
- convert-body-to:
type: "java.lang.String"
- choice:
when:
- simple: "{{split}}"
steps:
- split:
jsonpath: "$.features[*]"
steps:
- marshal:
json: {}
- to: "kamelet:sink"
otherwise:
steps:
- to: "kamelet:sink"