1

XAMPP-PHP-PostgreSQLバックエンドで大規模なGPSデータを視覚化するために使用するヒートマップがあります。

ただし、14か月の24時間データなどの大きな時間間隔のGPSデータを視覚化しようとすると、緯度と経度の値が240万行、つまりHTMLページがクラッシュします。

約900.000行に相当するデータを視覚化できますが、それよりも大きいデータでは常にクラッシュが発生します。

PHPによる制限時間とメモリの警告をバイパスするために使用ini_set('memory_limit', '-1')set_time_limit (60)ましたが、このChromeブラウザのクラッシュの問題が発生しました。

これを引き起こしている可能性がありますか?緯度と経度の値を取得する私のPHPコードは次のとおりです。

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);
4

1 に答える 1

2

jsonを介して900,000以上のデータポイントをブラウザに返し、ブラウザにマッピングの処理を要求しているようです... phpの問題はないかもしれませんが、ブラウザの過負荷の問題があります。

他のすべての結果をブラウザに送信して、それが終了するかどうかを確認することもできます(dbからすべてを選択しますが、json経由で半分のみを返します)...これにより、問題がphpまたはbrowser/JavaScriptにあるかどうかがわかります。

于 2012-10-11T03:09:09.843 に答える