# Vessel traffic card

> Canonical HTML: https://screenrig.ai/docs/cards/vessel-traffic/

Vessels arriving at and leaving a port: the next arrival's countdown, its approach to the berth, and the arrivals and departures that follow.

Category: Public information. Tags: Transit and travel, Schedules.

## Previews

![Vessel traffic](/cards/vessel-traffic/v1/screenshots/canvas-bloom.webp?sha=86d0c2772c8f7b265b2ec558c86410742541c8e72ab3871a85f6832392e1bfb2)

Canvas

![Vessel traffic](/cards/vessel-traffic/v1/screenshots/corner-bloom.webp?sha=d05c64a45477e157dca6df014e5b458fc4415027747298ad58e02d257cada24b)

Corner

![Vessel traffic](/cards/vessel-traffic/v1/screenshots/chip-bloom.webp?sha=3e05d47f4288a58df690176421042fbabb48438aeb4e62beb0c903ade0b753ba)

Chip

## Views and forms

Views: canvas, corner, chip. Canvas forms: landscape, portrait, square, strip.

[Card views, themes and publishing](/docs/cards/). [Browse the gallery](/apps/#cards).

## Data and privacy

Feed: `screenrig.vessels/v1`.

Feed documents carry source attribution. The Player supplies the feed to the card.

## Properties

For theme, background, accent and position, see [Common properties](/docs/cards/#common-properties).

Set static properties in `params`. Bind `data` to a project card data key for live values; that document holds only dynamic properties. Without a data key, put the complete configuration in `params`. Nested rows describe the contents of their parent property.

### Static properties

| Name | Type | Default | Values and limits | Description |
| --- | --- | --- | --- | --- |
| `title` | string | `"Vessel traffic"` | maxLength: `40` |  |
| `port` | string | `""` | maxLength: `40` | The port's name, when the feed carries none. |
| `windowHours` | integer | `12` | minimum: `1`; maximum: `48` | Vessels due later than this are left out. |
| `count` | integer | `5` | minimum: `2`; maximum: `8` | Most vessels in each of the arrivals and departures lists. |
| `maxDistanceKm` | integer | `50` | minimum: `5`; maximum: `500` | The length of the approach lane: the distance at which a vessel starts it. |
| `units` | string | `"nautical"` | `"nautical"`, `"metric"`, `"imperial"` | nautical: nm and kn. metric: km and km/h. imperial: mi and mph. |
| `staleMinutes` | integer | `15` | minimum: `1`; maximum: `1440` |  |
| `hour12` | boolean | `false` |  |  |

### Dynamic properties

| Name | Type | Default | Values and limits | Description |
| --- | --- | --- | --- | --- |
| `vessels` | array | `[]` | minItems: `0`; maxItems: `100` | Vessels due at or leaving the port. A feed (screenrig.vessels/v1) wins when present; the data store supplies the same rows otherwise. |
| `vessels[].id` | string |  | maxLength: `40` |  |
| `vessels[].name` | string |  | minLength: `1`; maxLength: `40`; Required |  |
| `vessels[].type` | string |  | maxLength: `30` | Vessel type, for example Container ship. |
| `vessels[].flag` | string |  | maxLength: `30` |  |
| `vessels[].lengthM` | number |  | minimum: `1`; maximum: `500` |  |
| `vessels[].from` | string |  | maxLength: `40` | Port of departure, for an arrival. |
| `vessels[].to` | string |  | maxLength: `40` | Next port, for a departure. |
| `vessels[].berth` | string |  | maxLength: `40` |  |
| `vessels[].eta` | string |  | maxLength: `32` | Arrival time, ISO 8601. |
| `vessels[].etd` | string |  | maxLength: `32` | Departure time, ISO 8601. |
| `vessels[].status` | string |  | `"underway"`, `"anchored"`, `"berthed"`, `"departing"` | A berthed or departing vessel with an etd is a departure. |
| `vessels[].distanceKm` | number |  | minimum: `0`; maximum: `5000` | Distance to the port. |
| `vessels[].speedKt` | number |  | minimum: `0`; maximum: `60` |  |
| `updated` | string | `""` | maxLength: `32` | When the positions were fetched, ISO 8601 (data store only; a feed carries fetchedAt). |

## Canvas example

Add this item to a playlist page’s `primitives`. [Publish the playlist and assign a screen](/docs/cards/#publish-a-card-canvas).

```json
{
  "id": "vessel-traffic",
  "primitive": "card",
  "card": "vessel-traffic",
  "major": 1,
  "params": {
    "theme": "neomustard"
  },
  "rect": {
    "x": 0,
    "y": 0,
    "width": 1920,
    "height": 1080
  },
  "layer": 0,
  "content_fit": "fill",
  "data": "vessel-traffic-main"
}
```

## Write live data

Create this document before showing the card, then replace it to update the screen without republishing. Use the same project as the playlist. Supply your API authorization through the environment; see [API authentication](/docs/authentication/).

```console
curl --request PUT "https://api.screenrig.ai/api/card-data/vessel-traffic-main" \
  --header "Authorization: Bearer $SCREENRIG_TOKEN" \
  --header "ScreenRig-Project: $SCREENRIG_PROJECT" \
  --header "Content-Type: application/json" \
  --data '{"document":{"vessels":[],"updated":""}}'
```
