Update busstopdensity tile generator for labs and PDO postgres
--- a/include/common-template.inc.php
+++ b/include/common-template.inc.php
@@ -34,6 +34,8 @@
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>' . $pageTitle . '</title>
<meta name="google-site-verification" content="-53T5Qn4TB_de1NyfR_ZZkEVdUNcNFSaYKSFkWKx-sY" />
+<link rel="dns-prefetch" href="//code.jquery.com">
+<link rel="dns-prefetch" href="//ajax.googleapis.com">
<link rel="stylesheet" href="' . $labsPath . 'css/jquery-ui-1.8.12.custom.css" />';
if (isDebugServer()) {
$jqmcss = $labsPath . 'css/jquery.mobile-1.0b1.css';
@@ -41,9 +43,9 @@
$jqmjs = $labsPath . 'js/jquery.mobile-1.0b1.js';
}
else {
- $jqmcss = "http://code.jquery.com/mobile/1.0b1/jquery.mobile-1.0b1.min.css";
- $jqjs = "http://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js";
- $jqmjs = "http://code.jquery.com/mobile/1.0b1/jquery.mobile-1.0b1.min.js";
+ $jqmcss = "//code.jquery.com/mobile/1.0b1/jquery.mobile-1.0b1.min.css";
+ $jqjs = "//ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js";
+ $jqmjs = "//code.jquery.com/mobile/1.0b1/jquery.mobile-1.0b1.min.js";
}
echo '<link rel="stylesheet" href="' . $jqmcss . '" />
<script src="'.$jqjs.'"></script>
--- a/labs/busstopdensity.tile.php
+++ b/labs/busstopdensity.tile.php
@@ -15,8 +15,8 @@
set_time_limit(120);//2mn
ini_set('memory_limit', '256M');
error_reporting(E_ALL ^ E_DEPRECATED);
- require_once ('lib/GoogleMapUtility.php');
- require_once ('lib/HeatMap.php');
+ require_once ($labsPath . 'lib/GoogleMapUtility.php');
+ require_once ($labsPath . 'lib/HeatMap.php');
//Root folder to store generated tiles
define('TILE_DIR', 'tiles/');
@@ -103,13 +103,14 @@
global $conn;
$nbPOIInsideTile = 0;
- $result = pg_query($conn, $query);
$spots = Array();
- if (!$result) {
- databaseError(pg_result_error($result));
+ $query = $conn->prepare($query);
+ $query->execute();
+ if (!$query) {
+ databaseError($conn->errorInfo());
return Array();
}
- foreach( pg_fetch_all($result) as $row){
+ foreach( $query->fetchAll() as $row){
$point = GoogleMapUtility::getOffsetPixelCoords($row['stop_lat'], $row['stop_lon'], $zoom, $X, $Y);
//Count result only in the tile
if( ($point->x > -$offset) && ($point->x < (GoogleMapUtility::TILE_SIZE+$offset)) && ($point->y > -$offset) && ($point->y < (GoogleMapUtility::TILE_SIZE+$offset))){