Menu
Home Track and Port Handling Use Cases Track ship to destination with via points

Track ship to destination with via points

In cases where more routes can be used to reach a destination, one or more via points can be added when a track is created, to influence the ETA calculation.

Lets say that MAJESTIC MAERSK (MMSI: 219018501) is heading for danish waters from the Baltic Sea. Entering danish waters a pilot will board the ship on a geographical position south of Bornholm. The pilot will assist the captain navigating through danish waters and finally disembark on a fixed location north of Skagen.

Tracking the ship to a destination north of Skagen and adding a via point south of Bornholm, we can get two ETA’s – One defining the estimated pilot boarding time south of Bornholm and one defining the estimated arrival time in Skagen where the pilot will disembark.

Fist step will be to define the destination location in case this does not already exist.

Requesting a location list to examine the existence of the location north of Skagen:

Request:

GET /location/list

Response:

{}

As the location list is empty we need to created the location with we intend to use for all future tracking tasks.

When a location i created two parameters must be specified:

  • A geographical position defined by a geoJSON object
  • One of
    • A polygon surrounding the position defined by a geoJSON object
    • A radius defined in meters – Automatically converted to a shape surrounding the position during creation

The shape surrounding the position is used to decide when a ship has reached the location.

Using 3rd party (see Useful Tools) a position an a shape in geoJSON format is fairly easy created and the location can be created.

Request:

POST /location

Payload:

{
   "name":"Skagen",
   "position":{
      "coordinates":[
         10.7017135620,
         57.7979438849
      ],
      "type":"Point"
   },
   "radius": 500
}

Response:

{
   "id": 1458628098819780
}

We now have everything needed to create the track that will start the ETA calculation and thereby supply us with ETA’s for arrivals to respectively Bornholm and Skagen.

Request:

POST /ship/track

Payload:

{
   "source":{
      "ship":{
         "mmsi":219018501,
         "name":"MAJESTIC MAERSK"
      }
   },
   "destination":{
      "location":{
        "name": "Skagen"
      }
   },
   "erp":{
      "waypoints":[
         {
            "position":{
               "type": "Point",
               "coordinates":[
                  15.065002441406248,
                  54.74602783389614
               ]
            }
         }
      ]
   }
}

Response:

{
  "id": 1458632635179017
}

Using the track ID from the response we can request the track data:

Request:

GET /ship/track/1458632635179017

Response:

{
   "code":1,
   "destination":{
      "location":{
         "id":1238506487039649,
         "name":"skagen"
      }
   },
   "erp":{
      "waypoints":[
         {
            "position":{
               "coordinates":[
                  15.06500244140625,
                  54.74602783389614
               ],
               "type":"Point"
            }
         }
      ]
   },
   "eta":"2018-11-17T00:30:00Z",
   "id":1458632635179017,
   "position":{
      "coordinates":[
         16.2081,
         54.9473,
         "2018-11-15T09:53:57Z",
         271,
         8
      ],
      "extensions":[
         "time",
         "cog",
         "sog"
      ],
      "type":"Point"
   },
   "source":{
      "ship":{
         "callsign":"OWJD2",
         "destination":"NLROT>EGSUC",
         "draught":16.7,
         "imo":9619919,
         "length":399,
         "mmsi":219018501,
         "name":"MAJESTIC MAERSK",
         "shiptype":"Cargo",
         "width":60
      }
   },
   "waypoints":[
      {
         "eta":"2018-11-16T03:00:00Z"
      }
   ]
}

When “code” becomes 1 (see Tracking Codes) the eta has been calculated and can be found in the root of the json object (“eta”: “2018-11-17T00:30:00Z”).
Additional information about the current position of the ship can be found in the root parameter “position” which presents a GeoJSON-X object. Besides the last known position of the ship a timestamp is telling when the last position is registered, together with COG and SOG.

To get a visual representation of the position of the ship one of the 3rd party tools can again be recommend.

"position": {
   "coordinates": [
      16.2081,
      54.9473,
      "2018-11-15T09:53:57Z",
      271,
      8
   ],
   "extensions": [
      "time",
      "cog",
      "sog" 
   ],
   "type": "Point" 
},

To past the position data into 3rd party tool, normally it will be necessary to strip the extra data from the GeoJSON-X object:

{
   "coordinates": [
      16.2081,
      54.9473
   ],
   "type": "Point" 
}

When a destination has been reached (see Tracking Codes) or tracking of a ship is no longer needed delete the tracking by calling:

DELETE /api/portserver/ship/track/1458632635179017
Updated on 14 November, 2018