? and latest_confirmed_latitude between ? and ? and latest_confirmed_longitude between ? and ?"; $parameters = [time() - (3*60*60), $minLat - $latMarginal, $maxLat + $latMarginal, $minLng - $lngMarginal, $maxLng + $lngMarginal]; $pdo = PDOConnection::getInstance(); $stmt = $pdo->prepareAndExec($sql, $parameters); $rows = $stmt->fetchAll(PDO::FETCH_ASSOC); $data = []; foreach($rows as $row) { $x = getLngPixelCoordinate($row["longitude"], $zoom, $tilePixelSize) - $minLngPixel - ($dotRadius / 2); $y = getLatPixelCoordinate($row["latitude"], $zoom, $tilePixelSize) - $maxLatPixel - ($dotRadius / 2); $data[] = [$x, $y, 2]; } $config = array( 'debug' => FALSE, 'width' => 256, 'height' => 256, 'noc' =>16, 'r' => $dotRadius, 'dither' => FALSE, 'format' => 'png', 'fill_with_smallest' => FALSE, ); $heatmap = new gd_heatmap($data, $config); if (is_writable(dirname($filename))) { $heatmap->output($filename); readfile($filename); } else { $heatmap->output(); }