Display which routes are modified when a stop is moved or deleted
--- /dev/null
+++ b/betweenpoint.add.php
@@ -1,1 +1,50 @@
+<?php
+ /*
+ * GeoPo Encode in PHP
+ * @author : Shintaro Inagaki
+ * @param $location (Array)
+ * @return $geopo (String)
+ */
+ function geopoEncode($lat, $lng)
+ {
+ // 64characters (number + big and small letter + hyphen + underscore)
+ $chars = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-_";
+
+ $geopo = "";
+ $scale = 7;
+
+ // Change a degree measure to a decimal number
+ $lat = ($lat + 90) / 180 * pow(8, 10);
+ $lng = ($lng + 180) / 360 * pow(8, 10);
+ // Compute a GeoPo code from head and concatenate
+ for ($i = 0; $i < $scale; $i++) {
+ $geopo .= substr($chars, floor($lat / pow(8, 9 - $i) % 8) + floor($lng / pow(8, 9 - $i) % 8) * 8, 1);
+ }
+ return $geopo;
+ }
+
+ $conn = pg_connect("dbname=bus user=postgres password=snmc");
+ if (!$conn) {
+ echo "An error occured.\n";
+ exit;
+ }
+ if ($_REQUEST['newlatlng']) {
+ $latlng = explode(";", $_REQUEST['newlatlng']);
+ $lat = (float)$latlng[0];
+ $lng = (float)$latlng[1];
+
+ $geoPo = geopoEncode($lat, $lng);
+ $nodelat = (int)($lat * 10000000);
+ $nodelon = (int)($lng * 10000000);
+ echo($nodelat . "," . $nodelon . "=$geoPo<br>");
+ $sql = "INSERT INTO stops (geohash,lat,lng) VALUES ('$geoPo', '$nodelat', '$nodelon')";
+ $result = pg_query($conn, $sql);
+ if (!$result) {
+ echo("Error in SQL query: " . pg_last_error() . "<br>\n");
+ } else {
+ echo "Inserted new point at $geoPo <br>";
+ }
+ }
+ flush();
+?>
--- /dev/null
+++ b/betweenpoint.delete.php
@@ -1,1 +1,33 @@
-
+<?php
+
+ $conn = pg_connect("dbname=bus user=postgres password=snmc");
+ if (!$conn) {
+ echo "An error occured.\n";
+ exit;
+ }
+ if ($_REQUEST['oldgeopo']) {
+
+ $sql = " DELETE from stops WHERE geohash = '{$_REQUEST['oldgeopo']}'";
+ $result = pg_query($conn, $sql);
+ if (!$result) {
+ echo("Error in SQL query: " . pg_last_error() . "<br>\n");
+ } else {
+ echo "Deleted {$_REQUEST['oldgeopo']}<br>";
+ $updatedroutes = 0;
+ $result_outdatedroutes = pg_query($conn, "Select * FROM between_stops where points LIKE '%" . $_REQUEST['oldgeopo'] . ";%'");
+ while ($outdatedroute = pg_fetch_assoc($result_outdatedroutes)) {
+ $newpoints = str_replace($_REQUEST['oldgeopo'].';', '', $outdatedroute['points']);
+ $sql = "UPDATE between_stops set points='$newpoints' where fromlocation = '{$outdatedroute['fromlocation']}' AND tolocation = '{$outdatedroute['tolocation']}' ";
+ $result = pg_query($conn, $sql);
+ if (!$result) {
+ echo("Error in SQL query: " . pg_last_error() . "<br>\n");
+ }
+ echo "updated ".$outdatedroute['fromlocation']."->".$outdatedroute['tolocation']."<br>";
+
+ $updatedroutes++;
+ }
+ echo "updated $updatedroutes routes<br>";
+ }
+ }
+ flush();
+?>
--- /dev/null
+++ b/betweenpoint.move.php
@@ -1,1 +1,95 @@
-
+<?php
+ /*
+ * GeoPo Encode in PHP
+ * @author : Shintaro Inagaki
+ * @param $location (Array)
+ * @return $geopo (String)
+ */
+ function geopoEncode($lat, $lng)
+ {
+ // 64characters (number + big and small letter + hyphen + underscore)
+ $chars = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-_";
+
+ $geopo = "";
+ $scale = 7;
+
+ // Change a degree measure to a decimal number
+ $lat = ($lat + 90) / 180 * pow(8, 10);
+ $lng = ($lng + 180) / 360 * pow(8, 10);
+ // Compute a GeoPo code from head and concatenate
+ for ($i = 0; $i < $scale; $i++) {
+ $geopo .= substr($chars, floor($lat / pow(8, 9 - $i) % 8) + floor($lng / pow(8, 9 - $i) % 8) * 8, 1);
+ }
+ return $geopo;
+ }
+
+ /*
+ * GeoPo Decode in PHP
+ * @author : Shintaro Inagaki
+ * @param $geopo (String)
+ * @return $location (Array)
+ */
+ function geopoDecode($geopo)
+ {
+ // 64characters (number + big and small letter + hyphen + underscore)
+ $chars = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-_";
+ // Array for geolocation
+ $location = array();
+
+ for ($i = 0; $i < strlen($geopo); $i++) {
+ // What number of character that equal to a GeoPo code (0-63)
+ $order = strpos($chars, substr($geopo, $i, 1));
+ // Lat/Lng plus geolocation value of scale
+ $location['lat'] = $location['lat'] + floor($order % 8) * pow(8, 9 - $i);
+ $location['lng'] = $location['lng'] + floor($order / 8) * pow(8, 9 - $i);
+ }
+
+ // Change a decimal number to a degree measure, and plus revised value that shift center of area
+ $location['lat'] = $location['lat'] * 180 / pow(8, 10) + 180 / pow(8, strlen($geopo)) / 2 - 90;
+ $location['lng'] = $location['lng'] * 360 / pow(8, 10) + 360 / pow(8, strlen($geopo)) / 2 - 180;
+ $location['scale'] = strlen($geopo);
+
+ return $location;
+ }
+
+ $conn = pg_connect("dbname=bus user=postgres password=snmc");
+ if (!$conn) {
+ echo "An error occured.\n";
+ exit;
+ }
+ if ($_REQUEST['newlatlng']) {
+ $latlng = explode(";", $_REQUEST['newlatlng']);
+ $lat = (float)$latlng[0];
+ $lng = (float)$latlng[1];
+
+ $geoPo = geopoEncode($lat, $lng);
+ $nodelat = (int)($lat * 10000000);
+ $nodelon = (int)($lng * 10000000);
+ echo($nodelat . "," . $nodelon . "=$geoPo<br>");
+ $sql = "UPDATE stops SET geohash='$geoPo', lat='$nodelat', lng='$nodelon', name=null, suburb=null WHERE geohash = '{$_REQUEST['oldgeopo']}'";
+ $result = pg_query($conn, $sql);
+ if (!$result) {
+ echo("Error in SQL query: " . pg_last_error() . "<br>\n");
+ } else if (pg_affected_rows($result) == 0) {
+ echo ("Error 0 points moved, please refresh page and try again");
+ } else {
+ echo $_REQUEST['oldgeopo'] . " replaced with $geoPo <br>";
+ $updatedroutes = 0;
+ $result_outdatedroutes = pg_query($conn, "Select * FROM between_stops where points LIKE '%" . $_REQUEST['oldgeopo'] . ";%'");
+ while ($outdatedroute = pg_fetch_assoc($result_outdatedroutes)) {
+ $newpoints = str_replace($_REQUEST['oldgeopo'], $geoPo, $outdatedroute['points']);
+ $sql = "UPDATE between_stops set points='$newpoints' where
+ fromlocation = '".pg_escape_string($outdatedroute['fromlocation']).
+ "' AND tolocation = '".pg_escape_string($outdatedroute['tolocation'])."' ";
+ $result = pg_query($conn, $sql);
+ if (!$result) {
+ echo("Error in SQL query: " . pg_last_error() . "<br>\n");
+ }
+ echo "updated ".$outdatedroute['fromlocation']."->".$outdatedroute['tolocation']."<br>";
+ $updatedroutes++;
+ }
+ echo "updated $updatedroutes routes<br>";
+ }
+ }
+ flush();
+?>
--- a/betweenpoint.php
+++ b/betweenpoint.php
@@ -10,11 +10,46 @@
// create the ol map object
var map = new OpenLayers.Map('map');
- var osmtiles = new OpenLayers.Layer.OSM("local", "http://127.0.0.1/tiles/${z}/${x}/${y}.png")
+ var osmtiles = new OpenLayers.Layer.OSM("local", "http://10.0.1.154/tiles/${z}/${x}/${y}.png")
// use http://open.atlas.free.fr/GMapsTransparenciesImgOver.php and http://code.google.com/p/googletilecutter/ to make tiles
markers = new OpenLayers.Layer.Markers("Between Stop Markers");
-
+ //hanlde mousedown on regions that are not points by reporting latlng
+OpenLayers.Control.Click = OpenLayers.Class(OpenLayers.Control, {
+ defaultHandlerOptions: {
+ 'single': true,
+ 'double': false,
+ 'pixelTolerance': 0,
+ 'stopSingle': false,
+ 'stopDouble': false
+ },
+
+ initialize: function(options) {
+ this.handlerOptions = OpenLayers.Util.extend(
+ {}, this.defaultHandlerOptions
+ );
+ OpenLayers.Control.prototype.initialize.apply(
+ this, arguments
+ );
+ this.handler = new OpenLayers.Handler.Click(
+ this, {
+ 'click': this.trigger
+ }, this.handlerOptions
+ );
+ },
+
+ trigger: function(e) {
+ var lonlat = map.getLonLatFromViewPortPx(e.xy).transform(
+ new OpenLayers.Projection("EPSG:900913"),
+ new OpenLayers.Projection("EPSG:4326")
+ );
+ $('form input[name="newlatlng"]').val(lonlat.lat + ";" + lonlat.lon );
+ }
+
+ });
+ var click = new OpenLayers.Control.Click();
+ map.addControl(click);
+ click.activate();
<?php
$conn = pg_connect("dbname=bus user=postgres password=snmc");
if (!$conn) {
@@ -34,7 +69,9 @@
marker.id="' . $stop['geohash'] . '";
markers.addMarker(marker);
marker.events.register("mousedown", marker, function() {
+
document.getElementById("between_points").innerHTML += this.id+";";
+$(\'form input[name="oldgeopo"]\').val(this.id);
});
';
}
@@ -51,11 +88,31 @@
function submitBetween () {
$.post("betweenpoint.submit.php", $("#inputform").serialize(), function(html){
$("#response").html(html);
- //clearForms();
- return false;
- });
-};
-
+ clearForms();
+ return false;
+ });
+};
+function submitMove () {
+ $.post("betweenpoint.move.php", $("#moveform").serialize(), function(html){
+ $("#response").html(html);
+ clearForms();
+ return false;
+ });
+};
+function submitDelete () {
+ $.post("betweenpoint.delete.php", $("#moveform").serialize(), function(html){
+ $("#response").html(html);
+ clearForms();
+ return false;
+ });
+};
+function submitAdd () {
+ $.post("betweenpoint.add.php", $("#moveform").serialize(), function(html){
+ $("#response").html(html);
+ clearForms();
+ return false;
+ });
+};
function OnChange(dropdown)
{
var myindex = dropdown.selectedIndex
@@ -146,10 +203,11 @@
}
-
+ $processed = 0;
foreach ($paths as $path => $routes) {
if (!in_array($path, array_keys($completedPaths))) {
- echo "<option value=\"$routes:$path\">" . sizeof(explode(";", $routes)) . " $path</option>\n";
+ echo "<option value=\"$routes:$path\"> $path ($routes) </option>\n";
+ $processed++;
} else {
$completedRoutes = explode(";", $completedPaths[$path]);
$incompleteRoutes = "";
@@ -161,13 +219,14 @@
}
if ($incompleteRoutes != "") {
- echo "<option value=\"$incompleteRoutes:$path\">" . sizeof(explode(";", $incompleteRoutes)) . " $path</option>\n";
+ echo "<option value=\"$incompleteRoutes:$path\"> $path ($incompleteRoutes) </option>\n";
+ $processed++;
}
}
}
+ echo "</select>$processed";
?>
-</select>
from <input type="text" name="from" id="from"/>
to <input type="text" name="to" id="to"/>
<br>
@@ -178,6 +237,13 @@
<br>
<textarea name="between_points" id="between_points" rows="1" cols="120"></textarea>
</form>
+ <form id="moveform">
+oldgeopo <input type="text" name="oldgeopo" id="oldgeopo"/>
+newlatlng <input type="text" name="newlatlng" id="newlatlng" size="60"/>
+ <input type="button" onclick="javascript:submitMove()" value="Move!">
+ <input type="button" onclick="javascript:submitAdd()" value="Add!">
+ <input type="button" onclick="javascript:submitDelete()" value="Delete!">
+</form>
<div id="response">
<!-- Our message will be echoed out here -->
</div>
--- a/betweenpoint.submit.php
+++ b/betweenpoint.submit.php
@@ -5,7 +5,7 @@
exit;
}
print_r($_REQUEST);
-$reverse=$_REQUEST["reverse"];
+$reverse=(isset($_REQUEST["reverse"]) ? $_REQUEST["reverse"] : "off");
$from=pg_escape_string($_REQUEST["from"]);
$to=pg_escape_string($_REQUEST["to"]);
$routes=$_REQUEST["routes"] ;
--- a/busui/about.php
+++ b/busui/about.php
@@ -2,7 +2,22 @@
include('common.inc.php');
?>
<p>
+ Busness Time - An ACT bus timetable webapp
+Based on the maxious-canberra-transit-feed
+Uses jQuery Mobile, PHP, Ruby, Python, Google Transit Feed Specification tools, OpenTripPlanner, OpenLayers, OpenStreetMap, Cloudmade Geocoder and Tile Service
+
+Feedback encouraged; contact maxious@lambdacomplex.org
+
Some icons by Joseph Wain / glyphish.com
+
+
+Disclaimer: The content of this website is of a general and informative nature. Please check with printed timetables or those available on http://action.act.gov.au before your trip.
+Whilst every effort has been made to ensure the high quality and accuracy of the Site, the Author makes no warranty,
+express or implied concerning the topicality, correctness, completeness or quality of the information, which is provided
+"as is". The Author expressly disclaims all warranties, including but not limited to warranties of fitness for a particular purpose and warranties of merchantability.
+All offers are not binding and without obligation. The Author expressly reserves the right, in his discretion, to suspend,
+change, modify, add or remove portions of the Site and to restrict or terminate the use and accessibility of the Site
+without prior notice.
<?
include_footer();
?>
--- a/busui/common.inc.php
+++ b/busui/common.inc.php
@@ -27,7 +27,7 @@
<!DOCTYPE html>
<html>
<head>
- <title>bus.lambdacomplex.org - '.$pageTitle.'</title>
+ <title>busness time - '.$pageTitle.'</title>
';
if (isDebug()) echo '<link rel="stylesheet" href="jquery-mobile-1.0a2.css" />
<script type="text/javascript" src="jquery-mobile-1.0a2.js"></script>';
--- a/busui/index.php
+++ b/busui/index.php
@@ -7,13 +7,13 @@
session_destroy();
if (isset($_REQUEST['service_period'])) $_SESSION['service_period'] = $_REQUEST['service_period'];
if (isset($_REQUEST['time'])) $_SESSION['time'] = $_REQUEST['time'];
-
+ // todo take in cellids and crossreference with http://realtimeblog.free.fr/latest/cellular/processed/sqlite/505_sqlite_zones.zip to estimate location
include_header("bus.lambdacomplex.org",false, true)
?>
<div data-role="page" data-theme="b" id="jqm-home" class="ui-page ui-body-b ui-page-active">
<div id="jqm-homeheader">
- <center><h1 id="jqm-logo"><img src="apple-touch-icon.png" alt="logo" width="64" height="64" /><br>
- bus.lambdacomplex.org</h1></center>
+ <center><h3 id="jqm-logo"><img src="apple-touch-icon.png" alt="logo" width="64" height="64" /><br>
+ busness time</h3></center>
</div>
<div data-role="content">
<a href="tripPlanner.php" data-role="button">Launch Trip Planner...</a>
--- a/busui/tripPlanner.php
+++ b/busui/tripPlanner.php
@@ -95,7 +95,7 @@
$errorMessage .= urlencode($_REQUEST['from']) . " not found.<br>\n";
tripPlanForm($errorMessage);
} else {
- $url = "http://localhost:8080/opentripplanner-api-webapp/ws/plan?_dc=1290254798856&arriveBy=false&date=" . urlencode($_REQUEST['date']) . "&time=" . urlencode($_REQUEST['time']) . "&mode=TRANSIT%2CWALK&optimize=QUICK&maxWalkDistance=840&wheelchair=false&toPlace=$toPlace&fromPlace=$fromPlace&intermediatePlaces=";
+ $url = "http://10.1.0.243:5080/opentripplanner-api-webapp/ws/plan?_dc=1290254798856&arriveBy=false&date=" . urlencode($_REQUEST['date']) . "&time=" . urlencode($_REQUEST['time']) . "&mode=TRANSIT%2CWALK&optimize=QUICK&maxWalkDistance=840&wheelchair=false&toPlace=$toPlace&fromPlace=$fromPlace&intermediatePlaces=";
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HEADER, 0);
@@ -123,3 +123,4 @@
}
include_footer();
?>
+
--- a/display.php
+++ b/display.php
@@ -18,7 +18,7 @@
// create the ol map object
var map = new OpenLayers.Map('map', options);
-var osmtiles = new OpenLayers.Layer.OSM("local", "http://localhost/tiles/${z}/${x}/${y}.png");
+var osmtiles = new OpenLayers.Layer.OSM("local", "http://10.0.1.154/tiles/${z}/${x}/${y}.png");
// use http://open.atlas.free.fr/GMapsTransparenciesImgOver.php and http://code.google.com/p/googletilecutter/ to make tiles
var graphic = new OpenLayers.Layer.Image(
'Weekday Bus Map',
--- a/displaytimepoints.georss.php
+++ b/displaytimepoints.georss.php
@@ -17,7 +17,7 @@
echo "<entry>";
echo "<summary>".htmlspecialchars ($timepoint['name'])."</summary>";
echo "<title>".htmlspecialchars($timepoint['name'])."</title>";
-echo "<georss:point> ".($timepoint['lat']/10000000)." ".($timepoint['lng']/10000000)."</georss:point>";
+echo "<georss:point> ".($timepoint['lat']/10000001)." ".($timepoint['lng']/10000000)."</georss:point>";
echo "</entry>\n";
}
--- a/maxious-canberra-transit-feed/02-tidytimepoints.rb
+++ b/maxious-canberra-transit-feed/02-tidytimepoints.rb
@@ -32,9 +32,9 @@
"Bridbabella GardensNursing Home"=> "Brindabella Gardens Nursing Home",
"BrindabellaBusiness Park"=> "Brindabella Business Park",
"NarrabundahTerminus"=>"Narrabundah Terminus",
+ "Narrabundah"=>"Narrabundah Terminus",
"Railway StationKingston"=>"Railway Station Kingston",
"Saint AndrewsVillage Hughes"=>"Saint Andrews Village Hughes",
- "DicksonAntill Street"=>"Dickson",
"Cohen St Bus Station (Platform 3)" => "Cohen Street Bus Station (Platform 3)",
"Cohen St Bus Station (Platform 6)" => "Cohen Street Bus Station (Platform 6)",
"Newcastle Streetafter Isa Street" => "Newcastle Street after Isa Street",
@@ -53,6 +53,7 @@
"Flemington Road / Sandford St"=>"Flemington Rd / Sandford St",
"Heagney Cres Clift Cres Richardson"=> "Heagney / Clift Richardson",
"Charnwood (Tillyard Drive)"=> "Charnwood",
+ "Charnwood Tillyard Dr"=> "Charnwood",
"charnwood"=> "Charnwood",
"Black Moutain- Telstra Tower"=>"Black Mountain Telstra Tower",
"Bonython Primary"=> "Bonython Primary School",
@@ -64,8 +65,8 @@
"Calwell shops"=> "Calwell",
"Chuculba / William Slim Drive"=>"Chuculba / William Slim Dr",
"Fyshwick direct Factory Outlet"=>"Fyshwick Direct Factory Outlet",
- "Kaleen Village / Maibrynong"=>"Kaleen Village / Marybrynong",
- "Kaleen Village / Marybrynong Ave"=>"Kaleen Village / Marybrynong",
+ "Kaleen Village / Maibrynong"=>"Kaleen Village / Maribrynong",
+ "Kaleen Village / Marybrynong Ave"=>"Kaleen Village / Maribrynong",
"National Aquarium"=>"National Zoo and Aquarium",
"chisholm"=>"Chisholm",
"O'connor"=>"O'Connor",
@@ -84,9 +85,11 @@
"ANU Burton and Garran Hall Daley Rd" => "Burton and Garran Hall Daley Road",
"Farrer Primary"=>"Farrer Primary School",
"St Thomas More Campbell"=>"St Thomas More's Campbell",
+ "Lyneham"=>"Lyneham / Wattle St",
"Lyneham Wattle Street"=>"Lyneham / Wattle St",
- "Dickson" => "Dickson / Antill St",
+ "Dickson" => "Dickson / Cowper St",
'Dickson Antill Street' => 'Dickson / Antill St',
+ "DicksonAntill Street"=> 'Dickson / Antill St',
"Livingston / Kambah" => "Kambah / Livingston St",
'Melba shops' => 'Melba',
'St Clare of Assisi' => 'St Clare of Assisi Primary',
--- a/maxious-canberra-transit-feed/04-locatebetweenpoints.osm.xml.php
+++ b/maxious-canberra-transit-feed/04-locatebetweenpoints.osm.xml.php
@@ -2,7 +2,7 @@
header('Content-Type: application/xml');
echo "<?xml version='1.0' encoding='UTF-8'?>
<osm version='0.6' generator='xapi: OSM Extended API 2.0' xmlns:xapi='http://www.informationfreeway.org/xapi/0.6'
-xapi:uri='/api/0.6/*[bbox=148.98,-35.48,149.25,-35.15]' xapi:planetDate='20100630' xapi:copyright='2010 OpenStreetMap contributors'
+xapi:uri='/api/0.6/*[bbox=148.98,-35.48,149.21,-35.15]' xapi:planetDate='20100630' xapi:copyright='2010 OpenStreetMap contributors'
xapi:license='Creative commons CC-BY-SA 2.0' xapi:bugs='For assistance or to report bugs contact 80n80n@gmail.com' xapi:instance='zappyHyper'>
";
$conn = pg_connect("dbname=openstreetmap user=postgres password=snmc");
--- a/maxious-canberra-transit-feed/04-locatebetweenpoints.reversegeocode.php
+++ b/maxious-canberra-transit-feed/04-locatebetweenpoints.reversegeocode.php
@@ -21,18 +21,35 @@
echo("Error in SQL query: " . pg_last_error() ."<br>\n");
}
while ($stop = pg_fetch_assoc($result_stops)) {
- echo "Processing ".$stop['geohash'] . " ... ";
+ if ($stop['name'] == "") {
+ echo "Processing ".$stop['geohash'] . " streetname ... ";
$url = "http://geocoding.cloudmade.com/daa03470bb8740298d4b10e3f03d63e6/geocoding/v2/find.js?around=".($stop['lat']/10000000).",".($stop['lng']/10000000)."&distance=closest&object_type=road";
$contents = json_decode(getPage($url));
- print_r($contents);
+ //print_r($contents);
$name = $contents->features[0]->properties->name;
- //todo suburb/locality select * from suburbs where the_geom @> 'POINT(149.075704592122 -35.21751569325)'::geometry
echo "Saving $name ! <br>" ;
$result_save = pg_query($conn, "UPDATE stops set name = '".pg_escape_string($name)."' where geohash = '{$stop['geohash']}' ");
if (!$result_save) {
echo("Error in SQL query: " . pg_last_error() ."<br>\n");
+ }
+ }
+ if ($stop['suburb'] == "") {
+ echo "Processing ".$stop['geohash'] . " suburb ... ";
+ $sql = "select * from suburbs where the_geom @> 'POINT(".($stop['lng']/10000000)." ".($stop['lat']/10000000).")'::geometry";
+ $result_suburbs = pg_query($conn, $sql);
+ if (!$result_suburbs) {
+ echo("Error in SQL query: " . pg_last_error() ."<br>\n");
}
- die();
+ $suburbs = "";
+ while ($suburb = pg_fetch_assoc($result_suburbs)) {
+ $suburbs .= $suburb['name_2006'].";";
+ }
+ echo "Saving $suburbs ! <br>" ;
+ $result_save = pg_query($conn, "UPDATE stops set suburb = '".pg_escape_string($suburbs)."' where geohash = '{$stop['geohash']}' ");
+ if (!$result_save) {
+ echo("Error in SQL query: " . pg_last_error() ."<br>\n");
+ }
+ }
flush();
}
--- a/maxious-canberra-transit-feed/cbrtable.yml
+++ b/maxious-canberra-transit-feed/cbrtable.yml
@@ -17,14 +17,14 @@
- { name: Aranda,stop_code: Aranda, lat: -35.257534, lng: 149.0762963}
- { name: Athllon / Sulwood Kambah,stop_code: Athllon / Sulwood Kambah, lat: -35.38442, lng: 149.09328}
- { name: Australian Institute of Sport,stop_code: Australian Institute of Sport, lat: -35.246351, lng: 149.101478}
- - { name: Belconnen Community Bus Station,stop_code: Belconnen Community Bus Station, lat: -35.23987, lng: 149.0619}
+ - { name: Belconnen Community Bus Station,stop_code: Belconnen Community Bus Station, lat: -35.2398858, lng: 149.0690795}
- { name: Belconnen Community Bus Station (Platform 1),stop_code: Belconnen Community Bus Station (Platform 1), lat: -35.23982, lng: 149.06978}
- { name: Belconnen Community Bus Station (Platform 2),stop_code: Belconnen Community Bus Station (Platform 2), lat: -35.23982, lng: 149.06926}
- { name: Belconnen Community Bus Station (Platform 3),stop_code: Belconnen Community Bus Station (Platform 3), lat: -35.23986, lng: 149.06847}
- { name: Belconnen Community Bus Station (Platform 4),stop_code: Belconnen Community Bus Station (Platform 4), lat: -35.23994, lng: 149.06887}
- { name: Belconnen Community Bus Station (Platform 5),stop_code: Belconnen Community Bus Station (Platform 5), lat: -35.23994, lng: 149.06928}
- { name: Belconnen Community Bus Station (Platform 6),stop_code: Belconnen Community Bus Station (Platform 6), lat: -35.23994, lng: 149.0698}
- - { name: Belconnen Way,stop_code: Belconnen Way, lat: -35.24809, lng: 149.06765}
+ - { name: Belconnen Way,stop_code: Belconnen Way, lat: -35.2410162, lng: 149.0409512}
- { name: Bimberi Centre,stop_code: Bimberi Centre, lat: -35.2219941, lng: 149.1546928}
- { name: Black Mountain Telstra Tower,stop_code: Black Mountain Telstra Tower, lat: -35.2748058, lng: 149.0972461}
- { name: Bonython,stop_code: Bonython, lat: -35.4297416, lng: 149.0814517}
@@ -32,16 +32,10 @@
- { name: Botanic Gardens,stop_code: Botanic Gardens, lat: -35.278643, lng: 149.1093237}
- { name: Brindabella Business Park,stop_code: Brindabella Business Park, lat: -35.314496, lng: 149.189145}
- { name: Brindabella Gardens Nursing Home,stop_code: Brindabella Gardens Nursing Home, lat: -35.3294459, lng: 149.0806116}
- - { name: Bugden Sternberg,stop_code: Bugden Sternberg, lat: -35.4017223, lng: 149.0992172}
+ - { name: Bugden Sternberg,stop_code: Bugden Sternberg, lat: -35.403233, lng: 149.1073117}
- { name: Burton and Garran Hall Daley Road,stop_code: Burton and Garran Hall Daley Road, lat: -35.2753671, lng: 149.1172822}
- { name: Calvary Hospital,stop_code: Calvary Hospital, lat: -35.25212, lng: 149.09088}
- { name: Calwell,stop_code: Calwell, lat: -35.43524, lng: 149.113942}
- - { name: Cameron Ave Bus Station,stop_code: Cameron Ave Bus Station, lat: -35.2410195, lng: 149.0722506}
- - { name: Cameron Ave Bus Station (Platform 1),stop_code: Cameron Ave Bus Station (Platform 1), lat: -35.2410195, lng: 149.0722506}
- - { name: Cameron Ave Bus Station (Platform 2),stop_code: Cameron Ave Bus Station (Platform 2), lat: -35.2410108, lng: 149.0717142}
- - { name: Cameron Ave Bus Station (Platform 3),stop_code: Cameron Ave Bus Station (Platform 3), lat: -35.2410064, lng: 149.0710758}
- - { name: Cameron Ave Bus Station (Platform 4),stop_code: Cameron Ave Bus Station (Platform 4), lat: -35.2411773, lng: 149.0709793}
- - { name: Cameron Ave Bus Station (Platform 5),stop_code: Cameron Ave Bus Station (Platform 5), lat: -35.241186, lng: 149.0720789}
- { name: Campbell Park Offices,stop_code: Campbell Park Offices, lat: -35.28368, lng: 149.17045}
- { name: Canberra College Weston Campus,stop_code: Canberra College Weston Campus, lat: -35.3490278, lng: 149.0486277}
- { name: Canberra Hospital,stop_code: Canberra Hospital, lat: -35.3459462, lng: 149.1012001}
@@ -53,7 +47,7 @@
- { name: Charnwood,stop_code: Charnwood, lat: -35.2052138, lng: 149.0337266}
- { name: Charnwood Tillyard Dr,stop_code: Charnwood Tillyard Dr, lat: -35.20295, lng: 149.04027}
- { name: Chifley,stop_code: Chifley, lat: -35.350985, lng: 149.077319}
- - { name: Chisholm,stop_code: Chisholm, lat: -35.41341, lng: 149.12833}
+ - { name: Chisholm,stop_code: Chisholm, lat: -35.41341, lng: 149.1308079}
- { name: Chuculba / William Slim Dr,stop_code: Chuculba / William Slim Dr, lat: -35.208931, lng: 149.088499}
- { name: CIT Weston,stop_code: CIT Weston, lat: -35.330234, lng: 149.058632}
- { name: City Bus Station,stop_code: City Bus Station, lat: -35.2794346, lng: 149.1305879}
@@ -68,8 +62,6 @@
- { name: City Bus Station (Platform 8),stop_code: City Bus Station (Platform 8), lat: -35.2778798, lng: 149.1305995}
- { name: City Bus Station (Platform 9),stop_code: City Bus Station (Platform 9), lat: -35.2783224, lng: 149.130726}
- { name: City West,stop_code: City West, lat: -35.2788605, lng: 149.1257969}
- - { name: Cnr Kerrigan/Lhotsky,stop_code: Cnr Kerrigan/Lhotsky, lat: -35.1995716, lng: 149.0285277}
- - { name: Cnr Tillyard Dr & Spalding St,stop_code: Cnr Tillyard Dr & Spalding St, lat: -35.2040477, lng: 149.0393052}
- { name: Cohen Street Bus Station,stop_code: Cohen Street Bus Station, lat: -35.2394775, lng: 149.0602031}
- { name: Cohen Street Bus Station (Platform 1),stop_code: Cohen Street Bus Station (Platform 1), lat: -35.2394775, lng: 149.0602031}
- { name: Cohen Street Bus Station (Platform 2),stop_code: Cohen Street Bus Station (Platform 2), lat: -35.2396467, lng: 149.0602152}
@@ -83,16 +75,16 @@
- { name: Copland College,stop_code: Copland College, lat: -35.2127018, lng: 149.0596387}
- { name: Curtin,stop_code: Curtin, lat: -35.3248779, lng: 149.081441}
- { name: Deakin,stop_code: Deakin, lat: -35.3158608, lng: 149.1084563}
- - { name: Deamer / Clift Richardson,stop_code: Deamer / Clift Richardson, lat: -35.4319597, lng: 149.1187876}
+ - { name: Deamer / Clift Richardson,stop_code: Deamer / Clift Richardson, lat: -35.4294463, lng: 149.12}
- { name: Dickson / Antill St,stop_code: Dickson / Antill St, lat: -35.2489, lng: 149.14012}
- { name: Dickson College,stop_code: Dickson College, lat: -35.24923, lng: 149.15315}
- { name: Dickson / Cowper St,stop_code: Dickson / Cowper St, lat: -35.250297, lng: 149.141336}
- { name: Duffy,stop_code: Duffy, lat: -35.3366908, lng: 149.0324311}
- { name: Duffy Primary,stop_code: Duffy Primary, lat: -35.334219, lng: 149.033656}
- - { name: Dunlop,stop_code: Dunlop, lat: -35.1942693, lng: 149.0206702}
+ - { name: Dunlop,stop_code: Dunlop, lat: -35.1981771, lng: 149.0207837}
- { name: Erindale Centre,stop_code: Erindale Centre, lat: -35.4038881, lng: 149.0992283}
- { name: Erindale Dr / Charleston St Monash,stop_code: Erindale Dr / Charleston St Monash, lat: -35.414616, lng: 149.07888}
- - { name: Erindale / Sternberg Cres,stop_code: Erindale / Sternberg Cres, lat: -35.4014472, lng: 149.0956545}
+ - { name: Erindale / Sternberg Cres,stop_code: Erindale / Sternberg Cres, lat: -35.4028919, lng: 149.1060672}
- { name: Evatt,stop_code: Evatt, lat: -35.2091093, lng: 149.0735343}
- { name: Eye Hospital,stop_code: Eye Hospital, lat: -35.3341884, lng: 149.1656213}
- { name: Fairbairn Park,stop_code: Fairbairn Park, lat: -35.3001773, lng: 149.2041185}
@@ -105,8 +97,8 @@
- { name: Flemington Rd / Sandford St,stop_code: Flemington Rd / Sandford St, lat: -35.221231, lng: 149.144645}
- { name: Florey,stop_code: Florey, lat: -35.2258544, lng: 149.0546214}
- { name: Flynn,stop_code: Flynn, lat: -35.2019283, lng: 149.0478356}
- - { name: Fraser,stop_code: Fraser, lat: -35.1896539, lng: 149.0435012}
- - { name: Fraser East Terminus,stop_code: Fr