Replies: 3 comments 3 replies
-
BTW, the current plugin code is here: https://github.com/hoeken/signalk-location-info |
Beta Was this translation helpful? Give feedback.
-
I'm leaning towards storing the json directly since its pretty simple and easy to parse. I played around with it, and its even pretty easy to pull out the country in Grafana. Its also really easy to use that json in node-red and through something like the get api. One neat little demo I made was a web app page that is part of the plugin that you can embed which will show you the map of the country you are currently in. Would make a handy little addition to a dashboard if you cant remember what courtesy flag you should put up. |
Beta Was this translation helpful? Give feedback.
-
That's a nice, simple idea for a plugin! I, too, would provide the full array. Some parsing is required in any case (no country vs 1 country), so the array really doesn't change things that much. In practice, I'm not sure it makes much of a difference, though. I'd assume locations with territorial water disputes are quite rare, and most sailors would want to keep away from them. :-) Some ideas I immediately had:
|
Beta Was this translation helpful? Give feedback.
-
I'm working on a general purpose plugin to lookup info based on your current position. The first one I'm doing is country. I'm using this npm module: https://github.com/simonepri/country-iso
That module can return a few different types of results:
My main question is should I store the result as json, or should I just grab the first country and store that as a string? I'm kinda inspired here by the various utility plugins like signalk-autostate and derived-data that provide useful data that other plugins and code like node-red can use. It it worth pushing a little bit more complexity on to the user when 99% of the time it will be an array of 1 or nothing?
The second question is what path to use? I was thinking navigation.country and navigation.countryISO if I go the single route, or if I go the data route, just put the json array in navigation.country eg. [{"iso":"VCT","name":"Saint Vincent and the Grenadines"}]
After this simple one, I want to expand into different things like maritime regions and place names from this site: https://www.marineregions.org/downloads.php That will be a bit more work though and I want to see how this works first.
Beta Was this translation helpful? Give feedback.
All reactions