Warning: The magic method SFML_Singleton::__wakeup() must have public visibility in /home/public/wp-content/plugins/sf-move-login/inc/classes/class-sfml-singleton.php on line 72

Warning: Cannot modify header information - headers already sent by (output started at /home/public/wp-content/plugins/sf-move-login/inc/classes/class-sfml-singleton.php:72) in /home/public/wp-includes/feed-rss2.php on line 8
library\ – Thoughts, etc. https://www.munderwood.ca Tracking the occasional random walk Wed, 12 Feb 2020 03:53:41 +0000 en-CA hourly 1 https://wordpress.org/?v=5.7.2 https://www.munderwood.ca/wp-content/uploads/2016/03/photo-150x150.jpg library\ – Thoughts, etc. https://www.munderwood.ca 32 32 MMSI parsing library: mmsi.js https://www.munderwood.ca/index.php/2020/02/11/mmsi-parsing-library-mmsi-js/ https://www.munderwood.ca/index.php/2020/02/11/mmsi-parsing-library-mmsi-js/#respond Wed, 12 Feb 2020 03:53:40 +0000 http://www.munderwood.ca/?p=289 [Read more...]]]> A Maritime Mobile Service Identity is a nine-digit number that can be broadcast by a ship or other vessel to provide some information about itself and its current location, to anyone within radio range. I recently published on NPM a small JavaScript library for validating MMSIs and parsing them to extract details about the country or jurisdiction to which they are assigned.

In the initial version, the primary usefulness of the library lies in two parts. First is its knowledge of which three digits of a given MMSI represent a MID code, since the location of the Marine Identification Digits is not the same in every MMSI. Second is its ability to provide the ISO 3166 code for the jurisdiction,1 along with its name and (if different) full name.

For example, given the MMSI “316123456”, with mmsi.js you can find out that the MID code is “316”, which corresponds to a code of “CA” and a country of “Canada”. With a different format, “986681234” has a MID code of “668”, corresponding to São Tomé and Príncipe, with a code of “ST” and a full name of “São Tomé and Príncipe (Democratic Republic of)”.

Additional information encoded in MMSIs includes details about the type of transceiver to which the code is assigned, such as vessel, search-and-rescue aircraft, or shore station. I plan to add more functionality to extract these sorts of details, as well as to improve the detection of valid values beyond simply checking for nine numeric digits.

  1. There are a very small number of jurisdictions assigned MID codes by the ITU that do not have ISO codes, such as the Crozet Archipelago, Kerguelen Islands, and Saint Paul and Amsterdam Islands, all part of the French Southern Territories. In these few cases, reasonable adaptations have been assigned.
]]>
https://www.munderwood.ca/index.php/2020/02/11/mmsi-parsing-library-mmsi-js/feed/ 0