From: maxious Date: Mon, 10 Jan 2011 12:14:17 +0000 Subject: Minor bus stop moving UI X-Git-Url: http://maxious.lambdacomplex.org/git/?p=bus.git&a=commitdiff&h=26816d099ef20e6375066ad068fe92d33423a88b --- Minor bus stop moving UI --- --- /dev/null +++ b/betweenpoint.move.php @@ -1,1 +1,90 @@ - +"); + $sql = "UPDATE stops SET geohash='$geoPo', lat='$nodelat', lng='$nodelon' WHERE geohash = '{$_REQUEST['oldgeopo']}'"; + $result = pg_query($conn, $sql); + if (!$result) { + echo("Error in SQL query: " . pg_last_error() . "
\n"); + } else { + echo $_REQUEST['oldgeopo'] . " replaced with $geoPo
"; + $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 = '{$outdatedroute['fromlocation']}' AND tolocation = '{$outdatedroute['tolocation']}' "; + $result = pg_query($conn, $sql); + if (!$result) { + echo("Error in SQL query: " . pg_last_error() . "
\n"); + } + $updatedroutes++; + } + echo "updated $updatedroutes routes
"; + } + } + 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(); +
+oldgeopo +newlatlng + + +
--- a/busui/index.php +++ b/busui/index.php @@ -7,7 +7,7 @@ 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) ?>
--- a/maxious-canberra-transit-feed/04-locatebetweenpoints.reversegeocode.php +++ b/maxious-canberra-transit-feed/04-locatebetweenpoints.reversegeocode.php @@ -21,7 +21,8 @@ echo("Error in SQL query: " . pg_last_error() ."
\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); @@ -31,8 +32,25 @@ $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() ."
\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() ."
\n"); } - die(); + $suburbs = ""; + while ($suburb = pg_fetch_assoc($result_suburbs)) { + $suburbs .= $suburb['name_2006'].";"; + } + echo "Saving $suburbs !
" ; + $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() ."
\n"); + } + } flush(); } --- a/maxious-canberra-transit-feed/validate.sh +++ b/maxious-canberra-transit-feed/validate.sh @@ -1,2 +1,2 @@ -python ../origin-src/transitfeed-1.2.5/feedvalidator.py -l 9999 cbrfeed.zip +python ../origin-src/transitfeed-1.2.6/feedvalidator.py -l 9999 cbrfeed.zip --- a/maxious-canberra-transit-feed/validation-results.html +++ b/maxious-canberra-transit-feed/validation-results.html @@ -28,109 +28,127 @@

- - - + + + - +
Agencies:ACT Internal Omnibus Network (ACTION)
Routes:256
Stops:230
Trips:4133
Routes:263
Stops:381
Trips:4207
Shapes:0
Effective:May 25, 2009 to October 01, 2010
Effective:November 15, 2010 to December 31, 2011
- +
+During the upcoming service dates Mon Dec 27 to Thu Feb 24: + + + + +
Average trips per date:2169
Most trips on a date:2681, on 44 service dates (Mon Dec 27, Tue Dec 28, Wed Dec 29, ...)
Least trips on a date:614, on 8 service dates (Sun Jan 02, Sun Jan 09, Sun Jan 16, ...)

-A new version 1.2.6 of transitfeed is available. Please visit http://code.google.com/p/googletransitdatafeed and download.

Found these problems: +We failed to reach transitfeed server. Reason: [Errno -2] Name or service not known.

Found these problems: - +
70 warnings
85 warnings
- - - - +
1Expiration Date
57Invalid Values
4Other Problems
8Stops Too Closes
+ +
59Invalid Values
20Other Problems
6Stops Too Closes


-

Warnings:

Expiration Date

-

Invalid Value