Use Heatmap (Google Maps Javascript API) to Visualize Low Speed Road Regions

low speed regions.PNG

I got data files that store hours of GPS position and speed data of Campus Buses operating in NTU, one problem I encountered is to identifying low speed regions. The first thing to do in my mind was to mark those positions (low speed) on the map, the heatmap does a great job on that, I found a sample code in Google Maps Javascript API website that teaches people how to use heatmap. It was quite simple to understand, I copied some codes and used them in my html file, a text box was designed to let user paste GPS positions in it, then generate and display low speed regions (heatmap) on Google Maps.

I made a python script to extract GPS positions with speed less than 5 km/h to a text file (see picture below).

gps position file.PNG

Then copy all positions from this file to my html webpage and generate the heatmap (see picture below).

labeled regions.PNG

The highlighted regions are quite reasonable, most of the places are pedestrian crossings, intersections, bus stops, car parks. (See street view below)

(1) Bus Stop

1-bus stop.PNG

(2) Gate

2-gate.PNG

(3) Pedestrian Crossing

3-pedestrian crossing.PNG

(4) T-Intersection

4-T intersection

(5) Car Park

5-car park entrance.PNG

Thanks for reading.

Leave a comment