Code Monkey home page Code Monkey logo

Comments (5)

mnaranjo avatar mnaranjo commented on July 25, 2024 1

Thank you very much for your help.

from pyais.

M0r13n avatar M0r13n commented on July 25, 2024

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.

from pyais.

mnaranjo avatar mnaranjo commented on July 25, 2024

Hi @M0r13n ,
I was referring to the possibility to know the flag of the ship, i.e. to know which country each ship belongs to when data is collected.

from pyais.

M0r13n avatar M0r13n commented on July 25, 2024

@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

from pyais.

M0r13n avatar M0r13n commented on July 25, 2024

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')

from pyais.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.