Skip to main content

🧪 AISLoader

From-v5.0Status: Experimental

AISLoader reads AIS reports from !AIVDM and !AIVDO sentences and returns one table row per supported message. Multipart reports produce one row when their final fragment arrives. Applications can join vessel positions with static and voyage data by mmsi. Type 19 can carry position and static fields in the same row.

🧪 AISLoader
File extension.ais, .nmea
Data formatApache Arrow Table or ObjectRowTable
Supported APIsload, parse, parseSync (bundled loader)

Usage​

import {load} from '@loaders.gl/core';
import {AISLoader} from '@loaders.gl/scientific/ais';

const table = await load('positions.ais', AISLoader, {
ais: {shape: 'object-row-table'}
});

For synchronous parsing, import AISLoader or AISLoaderWithParser from @loaders.gl/scientific/ais/bundled.

Options​

OptionDefaultDescription
ais.shape'arrow'Output shape. Use 'object-row-table' for a table of plain objects.
ais.validateChecksumtrueValidate the XOR checksum of each NMEA sentence and its tag blocks. Checksum mismatches are discarded.
ais.skipInvalidRecordstrueDiscard malformed records. Set to false to throw with the source line for malformed records and incomplete multipart groups.

Read the string-valued discard count from table.schema.metadata.get('invalidRecordCount') in Arrow or table.schema.metadata.invalidRecordCount in an object-row table. It counts rejected lines, malformed assembled messages, and incomplete fragment groups. Blank lines and unsupported message types are ignored without changing the count.

Output schema​

Every row has the columns below. Fields with unavailable values or fields absent from a message have a value of null.

ColumnTypeMeaning
timestampfloat64First available c: tag time in Unix seconds. Values at or above 100 billion are interpreted as Unix milliseconds and divided by 1,000.
mmsiint32Maritime Mobile Service Identity.
messageTypeint32AIS message type.
longitude, latitudefloat64Decimal degrees, east and north positive.
speedOverGroundfloat64Knots.
courseOverGroundfloat64Degrees clockwise from true north.
headingint32True heading in degrees.
rateOfTurnfloat64Signed degrees per minute. Direction-only turn codes yield null.
navigationStatusint32AIS navigational status code.
positionAccuracybooleantrue for the high-accuracy flag (10 m or better).
name, callSign, destinationstringVessel or aid name, radio call sign, and voyage destination, when present.
imo, shipTypeint32Reported IMO number and AIS ship and cargo type code.
draughtfloat64Metres.
dimensionToBow, dimensionToStern, dimensionToPort, dimensionToStarboardint32Distances in metres from the position reference point.
channelstringChannel field as received in the sentence.
baseStationTimestampfloat64UTC time broadcast by a type 4 base station, in Unix seconds.