https://github.com/panaaj/signalk-flags
SIgnal K flags resource provider plugin
https://github.com/panaaj/signalk-flags
Last synced: 7 days ago
JSON representation
SIgnal K flags resource provider plugin
- Host: GitHub
- URL: https://github.com/panaaj/signalk-flags
- Owner: panaaj
- License: apache-2.0
- Created: 2025-05-05T06:49:31.000Z (about 1 month ago)
- Default Branch: main
- Last Pushed: 2025-05-10T07:56:42.000Z (about 1 month ago)
- Last Synced: 2025-06-09T00:36:02.679Z (8 days ago)
- Language: TypeScript
- Size: 17.6 KB
- Stars: 1
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# Signal K Flag Resources Plugin:
## About
Signal K server plugin that:
1. Makes country flag images (svg) images available under `/signalk/v2/api/resources/flags`
1. Populates both the `flag` and `port` attributes for a vessel based on the received MMSI value.### HTTP API endpoints
Flag images (in svg format) can be retrieved by making HTTP requests to the available API endpoints, the definitions of which can be found in the **Signal K Admin Console** by clicking on **OpenAPI** and selecting **plugins/signalk-flags**.
#### Using MMSI
- `/signalk/v2/api/resources/flags/mmsi/{vessel_mmsi}`
_Example: Return flag image for the MMSI = 211456789_
```bash
HTTP GET "/signalk/v2/api/resources/flags/mmsi/211456789
```#### Using Country Code
- `/signalk/v2/api/resources/flags/country/{country_code}`
_`country_code` = two-character country code_
_Example: Return the New Zealand flag image_
```bash
HTTP GET "/signalk/v2/api/resources/flags/country/nz"
```---
### Vessel Schema Atttributes
The plugin also populates both the `flag` and `port` attributes for a vessel based on the received MMSI value as follows:
- `flag` = two letter country code _(e.g. "DE")_
- `port` = name of the country _(e.g. "Germany")_The attributes are then available as part of the Signal K data model and can be retrieved along with other vessel data.
_Example: Fetch vessel details via HTTP request to Signal K API_
```bash
HTTP GET "vessels.urn:mrn:signalk:uuid:eec3888d-5925-4e81-b6d4-3d2ff98edeeb"
```_Example Response:_
```JSON
{
"mmsi": 211456789,
"name": "My Vessel",
"flag": "DE",
"port": "Germany"
... // remainder of vessel data
}
```