Signal K server plugin that:
- Makes country flag images (svg) images available under
/signalk/v2/api/resources/flags
- Populates both the
flag
andport
attributes for a vessel based on the received MMSI value.
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.
/signalk/v2/api/resources/flags/mmsi/{vessel_mmsi}
Example: Return flag image for the MMSI = 211456789
HTTP GET "/signalk/v2/api/resources/flags/mmsi/211456789
/signalk/v2/api/resources/flags/country/{country_code}
country_code
= two-character country code
Example: Return the New Zealand flag image
HTTP GET "/signalk/v2/api/resources/flags/country/nz"
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
HTTP GET "vessels.urn:mrn:signalk:uuid:eec3888d-5925-4e81-b6d4-3d2ff98edeeb"
Example Response:
{
"mmsi": 211456789,
"name": "My Vessel",
"flag": "DE",
"port": "Germany"
... // remainder of vessel data
}