Skip to content

Commit

Permalink
Merge pull request #437 from golioth/pipeline-examples/location
Browse files Browse the repository at this point in the history
  • Loading branch information
hasheddan authored Nov 21, 2024
2 parents 4a98f66 + 7038071 commit 29dfff1
Show file tree
Hide file tree
Showing 2 changed files with 116 additions and 0 deletions.
56 changes: 56 additions & 0 deletions docs/data-routing/5-examples/22-HERE-positioning.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
---
title: HERE Positioning
---
import Pipeline from '@site/src/components/usethispipeline'

[HERE](https://www.here.com/) builds mapping and data tools for enterprises.
HERE's [Positioning API](https://www.here.com/platform/positioning) brings
high-precision location awareness to apps and devices, even in challenging
outdoor environments. The API can easily be accessed via Pipelines using the
[`webhook` transformer](/data-routing/transformers/webhook).

The following example demonstrates using the HERE Positioning API to translate
CBOR Wi-Fi access point data from a device network scan into a position for the
device. The resolved position is delivered to [LightDB
Stream](/application-services/lightdb-stream) as a JSON payload.

Example network scan data:

> CBOR data displayed as JSON for documentation purposes only.
```json
{
"wlan": [
{
"mac": "00:18:39:59:8C:53",
"rss": -87
},
{
"mac": "00:21:55:61:F3:0A",
"rss": -86
},
{
"mac": "00:11:5C:6B:9A:00",
"rss": -71
}
]
}
```

Example position result:
```json
{
"location": {
"accuracy": 13,
"lat": 61.4469261,
"lng": 23.86456411
}
}
```

:::info Reminder
Make sure to create a [secret](/data-routing/secrets) named `HERE_URL` with the
appropriate API key credentials.
:::

<Pipeline link='https://console.golioth.io/pipeline?name=HERE%20Positioning&pipeline=ZmlsdGVyOgogIHBhdGg6ICIvbmV0aW5mbyIKICBjb250ZW50X3R5cGU6IGFwcGxpY2F0aW9uL2Nib3IKc3RlcHM6CiAgLSBuYW1lOiBjb252ZXJ0CiAgICB0cmFuc2Zvcm1lcjoKICAgICAgdHlwZTogY2Jvci10by1qc29uCiAgLSBuYW1lOiBnZXQtbG9jYXRpb24KICAgIHRyYW5zZm9ybWVyOgogICAgICB0eXBlOiB3ZWJob29rCiAgICAgIHBhcmFtZXRlcnM6CiAgICAgICAgdXJsOiAkSEVSRV9VUkwKICAtIG5hbWU6IHNlbmQtbGlnaHRkYgogICAgZGVzdGluYXRpb246CiAgICAgIHR5cGU6IGxpZ2h0ZGItc3RyZWFtCiAgICAgIHZlcnNpb246IHYx' />
60 changes: 60 additions & 0 deletions docs/data-routing/5-examples/23-google-geolocation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
---
title: Google Geolocation
---
import Pipeline from '@site/src/components/usethispipeline'

[Google's Geolocation
API](https://developers.google.com/maps/documentation/geolocation/overview) uses
cell tower and Wi-Fi access point data to determine the latitude and longitude
of a device. The API can easily be accessed via Pipelines using the [`webhook`
transformer](/data-routing/transformers/webhook).

The following example demonstrates using the Google Geolocation API to translate
CBOR Wi-Fi access point data from a device network scan into a position for the
device. The resolved position is delivered to [LightDB
Stream](/application-services/lightdb-stream) as a JSON payload. The
[`json-patch` transformer](/data-routing/transformers/json-patch) is leveraged
to allow for using the same device payload as the [HERE Positioning
example](/data-routing/examples/HERE-positioning) to produce the same JSON
output.

Example network scan data:

> CBOR data displayed as JSON for documentation purposes only.
```json
{
"wlan": [
{
"mac": "3c:37:86:5d:75:d4",
"rss": -35
},
{
"mac": "30:86:2d:c4:29:d0",
"rss": -35
},
{
"mac": "30:22:96:6B:9A:11",
"rss": -22
}
]
}
```

Example position result:
```json
{
"location": {
"accuracy": 20,
"lat": 37.4241224,
"lng": -122.0915874
}
}
```

:::info Reminder
Make sure to create a [secret](/data-routing/secrets) named `GOOGLE_GEO_API_URL`
with the appropriate API key credentials.
:::

<Pipeline link='https://console.golioth.io/pipeline?name=Google%20Geolocation&pipeline=ZmlsdGVyOgogIHBhdGg6ICIvbmV0aW5mbyIKICBjb250ZW50X3R5cGU6IGFwcGxpY2F0aW9uL2Nib3IKc3RlcHM6CiAgLSBuYW1lOiBjb252ZXJ0CiAgICB0cmFuc2Zvcm1lcjoKICAgICAgdHlwZTogY2Jvci10by1qc29uCiAgLSBuYW1lOiB0cmFuc2Z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pQWNjZXNzUG9pbnRzLzIvc2lnbmFsU3RyZW5ndGgifSwKICAgICAgICAgICAgeyJvcCI6ICJyZW1vdmUiLCAicGF0aCI6ICIvd2xhbiJ9CiAgICAgICAgICBdCiAgLSBuYW1lOiBnZXQtbG9jYXRpb24KICAgIHRyYW5zZm9ybWVyOgogICAgICB0eXBlOiB3ZWJob29rCiAgICAgIHBhcmFtZXRlcnM6CiAgICAgICAgdXJsOiAkR09PR0xFX0dFT19BUElfVVJMCiAgLSBuYW1lOiB0cmFuc2Zvcm0tc3RhbmRhcmQtbG9jCiAgICB0cmFuc2Zvcm1lcjoKICAgICAgdHlwZToganNvbi1wYXRjaAogICAgICBwYXJhbWV0ZXJzOgogICAgICAgIHBhdGNoOiB8CiAgICAgICAgICBbCiAgICAgICAgICAgIHsib3AiOiAiYWRkIiwgInBhdGgiOiAiL2xvY2F0aW9uL2FjY3VyYWN5IiwgInZhbHVlIjogMH0sCiAgICAgICAgICAgIHsib3AiOiAibW92ZSIsICJmcm9tIjogIi9hY2N1cmFjeSIsICJwYXRoIjogIi9sb2NhdGlvbi9hY2N1cmFjeSJ9CiAgICAgICAgICBdCiAgLSBuYW1lOiBzZW5kLWxpZ2h0ZGIKICAgIGRlc3RpbmF0aW9uOgogICAgICB0eXBlOiBsaWdodGRiLXN0cmVhbQogICAgICB2ZXJzaW9uOiB2MQ==' />

0 comments on commit 29dfff1

Please sign in to comment.