-
Notifications
You must be signed in to change notification settings - Fork 57
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Get Country Code #131
Comments
Hey @mnaranjo, which country code are you referring to? As far as I know, there are two types of "country codes" in AIS messages:
Neither is currently implemented in pyais. Support for the MID could easily be added. The latter is a rather rare type of message that is very specific and almost never occurs in real world scenarios. Therefore, I am a bit hesitant to add support for this subtype. |
Hi @M0r13n , |
@mnaranjo This can only be achieved by examining the first digits of the MMSI. These two articles explain how this works: As of right now, pyais does not provide the functionality to extract the country/flag from the MMSI. However, I believe that I will add this feature in the near future |
Thank you very much for your help. |
Hey @mnaranjo, with the newest version of pyais you can get the country code and name: from pyais.util import get_country
# The first 3 digits of any MMSI number are indicative of the vessel's flag
country_code, country_name = get_country(249110000)
assert country_code, country_name == ('MT', 'Malta') |
Hello,
What would I have to do to obtain the 'country code' of a vessel?
Thank you in advance
The text was updated successfully, but these errors were encountered: