I have a point file extracted from an AIS network. 1 year is about 900 million points. Each point has a timestamp.

I want to make a heatmap for a longer period of time, but I want the heatmap to take the timestamp into account. I only want the heatmap to show me hotspots if the points are within a certain distance within a limited timeframe.

Edit 20190815:

I'll try to explain my needs further with a hypothetical example: Imagine a school with a centre hallway and 2 classrooms on either side of the hallway (4 classrooms in total).

Situation 1:

At 1500 the bell rings, all the children jump out of their seat, run to the door into the central hallway, and run to the main door that leads to the playground.

Situation 2:

At 1500 the bell rings, and one by one, the children get up from their seat, walk to the door into central hallway, 1st classroom 1, then 2, then 3, then 4. Forming a nice neat line to the main door.

Situation 3:

At 1500 the bell rings, the two classrooms on the left side of the centre hallway behave as in Situation 1, and on the right side of the central hallway behave as in Situation 2.

 In a normal heatmap, that doesn't take a timefactor into account, you 
 will see similar results on all three situations.

What I am trying to accomplish is show congestion. I think that: If I am able to get the timestamp of every datapoint into the mix the heatmap will reveal in:

  • Situation 1: Hotspots in front of all the doors that lead to the central hallway and a hotspot in front of the main door to the playground.
  • Situation 2: No hotspots.
  • Situation 3: Hotspots in front of the doors on the left side of the central hallway and a smaller hotpot in front of the main door (because the chaotic behavior of the left classrooms, influences the behavior of the right classrooms)

Is there a workflow, methodology or algorithm available that can build a heatmap with a timefactor?


The closest solution I can think of all requires you to divide your data into specific time periods, rather than computing the time range separately for each hotspot.

If that's acceptable, it's actually quite simple to do.

  1. Decide on some time periods, Eg [Jan-Feb 1999, Mar-Apr 1999, May-Jun 1999, ...]
  2. Add a new "time_period" field to the layer, using the field calculator and an expression like:

    CASE WHEN "date" >= to_date(1999-01-01) AND "date" < to_date(1999-03-01) THEN 1
     WHEN "date" >= to_date(1999-03-01) AND "date" < to_date(1999-05-01) THEN 2
     WHEN "date" >= to_date(1999-05-01) AND "date" < to_date(1999-07-01) THEN 3
     ELSE null
  3. Use split vector layer to split the point layer based on its "time_period" field.
  4. Apply the heatmap style to each of the separate time period layers.

Computing the time range separately for each possible hotspot requires much more complicated logic, and I don't see any built-in tools that would work for that. Here's a rough outline that might help you get started. You could do this (tediously) by hand, or put these steps into a custom script, or maybe create several models.

  1. Create point clusters based on distance.
  2. Test the range of dates within each cluster.
  3. For point clusters with too wide a date range, remove points at the upper end of the date range until the date range is within the limits.
  4. Test the density of the new point clusters.
  5. For any new point cluster that's not dense enough, return to step 3-4, except remove points from the lower end of the date range.
  6. Filter the points that aren't in clusters, and generate a heatmap for the filtered layer.
  • Thank you CSK for this response. My goal has changed a bit due to your comment giving me a different understanding and ideas. What I would like to accomplish is to identify congestion in a system. My desired product would be a point layer with points where congestion did occur. A congestion would be where ships behave erratic as opposed to the mean movements of the total. – CaptainAhab Aug 20 '19 at 11:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.