Spire Maritime AIS
Spire Maritime AIS is an API-driven service that provides real-time data on maritime and shipping activity worldwide. The service leverages satellite and terrestrial sensor data to track the movements of ships in real-time—including but not limited to vessel locations, shipping routes, and cargo movement.
Meroxa supports connections to the Spire Maritime 2.0 GraphQL API as a resource. If legacy API support is required, please contact us.
Setup
API Token
An API token is required to successfully create a Spire Maritime AIS resource on the Meroxa Platform. These are manually generated by the Spire AIS team based on the subset of data/products purchased directly with Spire AIS.
Please contact your Spire AIS representative to provide a unique API token for use with Meroxa.
Resource Configuration
Use the meroxa resource create
command to configure your Spire Maritime AIS resource.
The following example depicts how this command is used to create a Spire Maritime AIS resource named my-spire-ais
on the Meroxa Platform.
$ meroxa resource create my-spire-ais \
--type spire_maritime_ais \
--token $SPIRE_MARITIME_AIS_API_TOKEN
Replace $SPIRE_MARITIME_AIS_API_TOKEN
with the API token provided by your Spire AIS representative.
Using Spire Maritime AIS as a Source with Turbine
- TurbineJs
- TurbineGo
- TurbinePy
- TurbineRb
This example shows how to call the Spire Maritime AIS resource called my-spire-ais
with TubrineJs. Spire Maritime AIS does not have collections. To retrieve records, please use an empty string with the records
function.
exports.App = class App {
async run(turbine) {
let source = await turbine.resources("my-spire-ais");
let records = await source.records("*");
}
};
This example shows how to call the Spire Maritime AIS resource called my-spire-ais
with TubrineGo. Spire Maritime AIS does not have collections. To retrieve records, please use an empty string with the records
function.
package main
func main() {
runner.Start(App{})
}
var _ turbine.App = (*App)(nil)
type App struct{}
func (a App) Run(v turbine.Turbine) error {
source, err := v.Resources("my-spire-ais")
if err != nil {
return err
}
rr, err := source.Records("*")
if err != nil {
return err
}
return nil
}
This example shows how to call the Spire Maritime AIS resource called my-spire-ais
with TubrinePy. Spire Maritime AIS does not have collections. To retrieve records, please use an empty string with the records
function.
class App:
@staticmethod
async def run(turbine: Turbine):
source = await turbine.resources("my-spire-ais")
records = await source.records("*")
This example shows how to call the Spire Maritime AIS resource called my-spire-ais
with TubrineRb. Spire Maritime AIS does not have collections. To retrieve records, please use an empty string with the records
function.
# frozen_string_literal: true
require "rubygems"
require "bundler/setup"
require "turbine_rb"
class MyApp
def call(app)
Sourcedb = app.reSource(name: "my-spire-ais")
records = sourcedb.records(collection: "*")
end
end
Configurations
The following Source connection configurations are supported:
Configuration | Required? | Example | Description |
---|---|---|---|
batchSize | Optional, default is 100 | 100 | Sets the maximum number of results to retrieve from the Spire Maritime AIS API for each request. |
query | Optional, see Data Record Format for default queried data | GraphQL query | Send a custom GraphQL query to the Spire Maritime 2.0 GraphQL API. |
Data Record Format
The default configuration for the Spire Maritime AIS source connection queries the Maritime v2.0 API for the following data. For more information on the data and definitions, see the Spire Maritime AIS Data Dictionary.
{
"schema": {
// ...
},
"payload": {
// ...
"after": {
"currentVoyage": {
"destination": "",
"draught": 0,
"eta": "",
"timestamp": "",
"updateTimestamp": ""
},
"id": "0065973f-e4b7-397d-8c95-26acbe8f9f4a",
"lastPositionUpdate": {
"accuracy": "",
"collectionType": "DYNAMIC",
"course": 0,
"heading": 0,
"latitude": 30.97134167,
"longitude": 125.80853833,
"maneuver": "NOT_AVAILABLE",
"navigationalStatus": "NOT_DEFINED_DEFAULT",
"rot": 0,
"speed": 0,
"timestamp": "2023-03-15T05:56:06.000Z",
"updateTimestamp": "2023-03-15T06:00:42.183Z"
},
"staticData": {
"aisClass": "B",
"callsign": "",
"dimensions": {
"a": 0,
"b": 0,
"c": 0,
"d": 0,
"length": 0,
"width": 0
},
"flag": "",
"imo": 0,
"mmsi": 920415224,
"name": "U0AI",
"shipSubType": "",
"shipType": "",
"timestamp": "2023-03-15T05:07:56.000Z",
"updateTimestamp": "2023-03-15T05:20:07.411Z"
},
"updateTimestamp": "2023-03-15T06:00:42.183Z"
},
// ...
}
}