This is an automated email from the ASF dual-hosted git repository.

acosentino pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-kamelets.git


The following commit(s) were added to refs/heads/main by this push:
     new 38fc2116 Adding a new kamelet that uses the nominatim geocoder
38fc2116 is described below

commit 38fc21167daa1fa21f5f0e66954219c8293eacad
Author: Maria Arias de Reyna <ariasdere...@redhat.com>
AuthorDate: Mon Jul 25 13:13:24 2022 +0200

    Adding a new kamelet that uses the nominatim geocoder
---
 kamelets/nominatim-geocode-action.kamelet.yaml | 111 +++++++++++++++++++++++++
 1 file changed, 111 insertions(+)

diff --git a/kamelets/nominatim-geocode-action.kamelet.yaml 
b/kamelets/nominatim-geocode-action.kamelet.yaml
new file mode 100644
index 00000000..bf1d4756
--- /dev/null
+++ b/kamelets/nominatim-geocode-action.kamelet.yaml
@@ -0,0 +1,111 @@
+# ---------------------------------------------------------------------------
+# 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: nominatim-geocode-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+CjwhLS0gQ3JlYXRlZCB3aXRoIElua3NjYXBlIChodHRwOi8vd3d3Lmlua3NjYXBlLm9yZy8pIC0tPgoKPHN2ZwogICB3aWR0aD0iMjU2IgogICBoZWlnaHQ9IjI1NiIKICAgaWQ9InN2ZzMwMzgiCiAgIHZlcnNpb249IjEuMSIKICAgaW5rc2NhcGU6dmVyc2lvbj0iMS4xLjIgKDBhMDBjZjUzMzksIDIwMjItMDItMDQpIgogICBzb2RpcG9kaTpkb2NuYW1lPSJPcGVuU3RyZWV0TWFwIGxvZ28gMjAxMS5zdmciCiAgIGlua3NjYXBlOmV4cG9ydC1maWxlbmFtZT0iL2hvbWUvZn
 [...]
+    camel.apache.org/provider: "Apache Software Foundation"
+    camel.apache.org/kamelet.group: "Geospatial"
+  labels:
+    camel.apache.org/kamelet.type: "action"
+spec:
+  definition:
+    title: "Nominatim GeoCode Action"
+    description: |-
+      Find locations on Earth by name and address. 
+      This Kamelet expects in the body the `address` to find.
+      The return message will also contain the following headers with the 
geolocation info:
+       
+      - `CamelGeoCoderAddress`
+      - `CamelGeoCoderCity`
+      - `CamelGeoCoderCountryLong`
+      - `CamelGeoCoderCountryShort`
+      - `CamelGeoCoderLat`
+      - `CamelGeoCoderLng`
+      - `CamelGeoCoderLatlng`
+      - `CamelGeoCoderPostalCode`
+      - `CamelGeoCoderRegionCode`
+      - `CamelGeoCoderRegionName`
+      - `CamelGeoCoderStatus`
+      
+      The body will be returned in JSON format.
+    required:
+      - serverUrl
+    type: object
+    properties:
+      serverUrl:
+        title: "Server URL"
+        description: "Url of the Nominatim server"
+        example: "https://nominatim.openstreetmap.org";
+        type: string
+  types:
+    in:
+      mediaType: text/plain
+    out:
+      mediaType: application/json
+      schema:
+        type: object
+        required: ["place_id"]
+        properties:
+          place_id:
+            type: numeric
+          licence:
+            type: string
+          osm_type:
+            type: string
+          osm_id:
+            type: numeric
+          boundingbox:
+            type: array
+          lat:
+            type: numeric
+          lon:
+            type: numeric
+          display_name:
+            type: string
+          place_rank:
+            type: numeric
+          category:
+            type: string
+          address:
+            type: object
+  dependencies:
+    - "camel:core"
+    - "camel:jackson"
+    - "camel:geocoder"
+    - "camel:kamelet"
+  template:
+    from:
+      uri: "kamelet:source"
+      steps:
+      - set-header:
+          name: CamelGeoCoderAddress
+          simple: "${body}"
+      - to: 
+          uri: "geocoder:address:toOverride"
+          parameters:
+            type: "NOMINATIM"
+            serverUrl: "RAW({{serverUrl}})"
+      - marshal:
+          json: {}
+
+
+

Reply via email to