Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Server Side Preprocessing for Heatmap Using PHP

Tags:

php

heatmap

I want to generate a heatmap from GPS log data. The process is like this:

  1. I store the log data in MySQL using the Geospatial Indexing. A record consists of the latitude/longitude data and a timestamp.
  2. In the admin panel there is a Google Map, and the admin can pan and zoom the map.
  3. Every time the map is zoomed or panned, the panel will send an AJAX request containing the map boundary points (the northeast and the southwest latitude/longitude)
  4. Using the MySQL geospatial feature I can query all of the record inside that boundary.
  5. I send back the records data to be rendered by the heatmap rendering library. (Right now I'm using the Heatmap.js, somewhat it's a little bit buggy for the Google Map. Does anyone have better suggestion?)

The problem is, my data are growing too big so that the data sending to the client and the heatmap rendering right now becomes too slow. I think it might be good to have a preprocessing script to aggregate the data therefore reducing the payload before sending it to the client browser and lightening up the rendering. I'm still new with this heatmap thing, so is there an existing PHP library that can do this?

like image 263
Petra Barus Avatar asked Mar 30 '12 02:03

Petra Barus


1 Answers

Yes it will be way faster in PHP.

I find this one: http://blog.gmapify.fr/create-beautiful-tiled-heat-maps-with-php-and-gd

The tricky part is to combine this with Google Maps to be able to zoom, i don't see how you can achieve this in a simple way.

like image 123
Jerome Ansia Avatar answered Oct 30 '22 01:10

Jerome Ansia