I have a heat map which I use to visualize large scale GPS data with XAMPP-PHP-PostgreSQL back-end.
However, trying to visualize the GPS data of a big time interval - such as 24 hour data of 14 months - 2.4 million rows of latitude and longitude values, that is - causes my html page to crash.
I can visualize about 900.000 rows worth of data but I always get a crash for data bigger than that.
I used ini_set('memory_limit', '-1')
and set_time_limit (60)
to bypass the time limit and memory warnings by PHP but now I run into this Chrome browser crash problem.
What could be causing this? My PHP code that retrieves the latitude and longitude values are as following:
function getPoints($dateTimeBeg,$dateTimeEnd) //getting the points
//from the database after providing the start and end date objects
{
global $con, $coords, $coords_array; //$coords and $coords_array are declared
//at the beginning of the php script
$query = "SELECT lat, lon FROM mytable WHERE calltime >= '$dateTimeBeg'
and calltime <= '$dateTimeEnd'";
$res = pg_query($con, $query) or die (pg_last_error($con));
if($res)//if a result exists
{
$num_of_rows = pg_num_rows($res);
if($num_of_rows > 0)
{
while($row = pg_fetch_row($res)) //fetch results row by row
{
array_push($coords,array($row[0],$row[1]));
//push them to the $coords array
}
array_push($coords_array,$coords);
unset($coords);
//push array $coords array to $coords_array ARRAY
}
}
}
$coords_json = json_encode($coords_array); //encode the results as json
echo $coords_json; //print out the data, heatmap takes the
//coordinates and takes care of the rest
unset($coords);
pg_close($con);