Skip to content

panaaj/signalk-flags

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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
  2. 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

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

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

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
}

About

SIgnal K flags resource provider plugin

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •