AIS: Using Shipping Data in GIS

We’ve all been dazzled by those awesome maps that animate ships or aircraft using AIS, as they move in near real time, but how do they work? What magic sits beneath the hood?

As luck would have it, whilst working with the offshore wind farm industry I had to do a lot of vessel analysis, not only assessing areas of issue but predicting travel paths and growth. It all seems complicated until you know how it is done. Read on…

What is AIS?

AIS (Automatic Identification System) is a requirement of vessels across the globe. It is like a tracker that’s fitted to all vessels that meet certain requirements. This AIS is a VHF signal that is constantly sent out by the vessel and contains information about where the vessel is from, where it is going, what type of vessel, the current time, and position amongst a small part of what is sent (I will go into this further later on).

The signal that is sent out can be picked up within the line of sight of the VHF receiver (this is where your ZTV analysis comes in). In practice, when put high up, I got a range of about 30km. The data must then go through a transducer so that the NMEA (National Marine Electronics Association) data can be obtained from the VHF signal.

1302514295 !AIVDM,2,1,9,A,53aEOe4000010KGK7D0dtu0P4p@Dh0000000001?70>72t0Ht7kS1lUL,0*39
1302514295 !AIVDM,2,2,9,A,<<<dMLu<Lt<<tMh,2*64
1302514297 !AIVDM,1,1,,A,H3P8VGlpwwwwwwwj0001p5230,0*6B

Example of Raw NMEA data

This data is relatively easy to break down. Let’s look at the following line:

!AIVDM,1,1,,A,14eG;o@034o8sd<L9i:a;WF>062D,0*7D

!AIVDM:        The NMEA message type
1              Number of Sentences (some messages need more then one)
1              Sentence Number (1 unless it´s a multi-sentence message)
A              The AIS Channel (A or B)
14eG;…   The Encoded AIS Data
0*             End of Data
7D             NMEA Checksum

Using another software like Shipplotter or MarineTraffic, you can parse the AIS as a comma delimited textfile format and into a SQL database. All in, it cost less than £2000 for a receiver, the software, and everything else needed to collect the data at 1-second intervals. Using something like MarineTraffic, you can even obtain everything you need for free. But I’m not here to tell you how to set up the system; you can read this and do it yourself with relative ease. I’m here to discuss how to use that AIS data to create some cool maps.

Working with the different messages

Once you have the NMEA decoded, you will see that there are 24 message types that you can receive. It can be useful to record a few of them, but with experience you’ll learn to ignore most.

                           Ship Message Types

Now, you would think that messages 1 & 5 would be the perfect route for this, and it took me a day of data capture to realise that you are best to capture messages 1, 3 AND 5 as there is important information contained in each of them.

This is where having the data stored in a database comes in useful—you are recording information for multiple vessels for which information is being received with three messages, therefore having the ability to store each message type in its own table so that they can be related based on the vessel is a HUGE bonus.

                                                                                  Message Types

The one common field in all of the messages is the MMSI (Maritime Mobile Service Identity), an ID of 9 digits, similar to a registration number of the vessel. With this you can identify vessels. For example, if you do an online search for “MMSI 235006680” you will come up with the information for a British vessel called “Red Osprey”.

Messages 1 & 3 provide very useful information on the vessel travel and, more importantly, location but not other useful information which would require a Lloyds register lookup table (or other vessel lookup table), but why would you? You have the data! As long as you append message 5 to all the message 1 & 3 messages, you can get everything you need.

Pulling it all together

So, if you’re keeping up with all this and have fully read the message types, you will realise that there will be further joins to perform on the tables, as information like “Ship type” (message 5) and “Position fix” (message 5) are related to further tables that can be easily found on the internet on pages such as this (table 11) and (table 10). It all sounds rather complicated but, if you have ever used MS Access, QGIS, PostGres, or ArcGIS to join some tables, it really is that easy! What you need is a way to visualise those joins, which I have thoughtfully put together here:

How the tables are joined

Now that you have the data structured, you just need to use it! This is the easy bit. If you put in the work you will have a nice structured data which, depending on your storage format, you can snapshot and put into your GIS.

The reason I say snapshot is that the data is coming in every second; within a day you have a crazy amount of data; in a month it is almost unusable. Futhermore, these systems aren’t the most reliable, so I would highly recommend a daily backup as I have been let down a few times with “glitches” due to weather or power shortages.

Screenshot of some data captured

Making Maps

Now that you have coordinates and time, you can create a map! There are many different ways to display the data:

  • Density by vessel type – For analysing trends in data, or for looking at those heavy polluting tankers
  • Time based – Useful for seeing how vessels are moving and their patterns
  • Heat analysis – Similar to density but useful for identifying busy areas
  • Planning – If you put an oil rig on a shipping lane, where are the vessels going to go?
  • Predictive analysis – Using destination and other vessels’ routes to that destination, what is the best possible route?
  • Least-cost analysis – Use weighted to add input into cable route analysis

My personal favourite is the time-based analysis, as it gives a visual representation of the daily/weekly/monthly movements. Furthermore, you can single-out a single MMSI and watch a vessel plod around. Sometimes you find that they have identified themselves as the wrong type of vessel; other times you realise you are looking at a diving club vessel as it travels out and circles a wreck. It can be fun sometimes.

It’s about time

Let’s have a look at how to do the time-based analysis in QGIS. First of all, make sure you have QGIS 2.18 if you want to follow along.

Open QGIS and add the Time Manager plugin. This can be obtained from the “plugin” tab at the top of the screen

                                                                      Time Manager Plugin

Once the plugin is installed, you can activate it under the “plugin” tab. You will see the time manager dropdown as one of the options, but don’t activate it straight away as we need to add the data first.

Add the data, and then I find it best to categorise the data by the vessel type. You can try to categorise by the vessel name or MMSI, but in a single day you could have up to 200 vessels, which would make for one hell of a lot of vessels to symbolise. You can find the option to categorise by right-clicking on the data and selecting “properties”. If you then choose the “style” option on the left and then select “categorised” in the drop-down at the top of the screen, you can then select which field and colours you wish to use.

Symbolising by Vessel Type

Next, open the time manager window (you should have this in the bottom of your map frame; if not, activate using method mentioned earlier). Populate the required fields (ensuring that you read the time format), and select the time field that corresponds (if using the data straight from ShipPlotter you will be fine). 

Choose how you wish the data to be drawn. If you want to see the the vessel ONLY at its current position, then leave the “end time” box empty; if you wish to see the previous positions stay on the screen, then choose the “show accumulatively” for the time.

Show it off!

It really is that simple! Sit back and enjoy!

My recommendation is that you save your map before playing. I’ve found if you have large data, the map can crash. Also, ensure all your fields in time manager are set correctly as I’ve not found a way to change specific fields but instead find myself deleting the layer (in time manager) and then re-applying. 

Cumulative vessels exported from the time manager with time (bottom right)

 

For bonus points and to see how to create some stunning time-based visualisations with the QGIS Time Manager (created by xyHt’s friend, Anita Graser), see her blog here.

Leave a Reply

Your email address will not be published. Required fields are marked *