Add initial between point adding prototype
--- /dev/null
+++ b/OpenStreetMap.js
@@ -1,1 +1,165 @@
+/**
+ * Namespace: Util.OSM
+ */
+OpenLayers.Util.OSM = {};
+/**
+ * Constant: MISSING_TILE_URL
+ * {String} URL of image to display for missing tiles
+ */
+OpenLayers.Util.OSM.MISSING_TILE_URL = "/404.php";
+
+/**
+ * Property: originalOnImageLoadError
+ * {Function} Original onImageLoadError function.
+ */
+OpenLayers.Util.OSM.originalOnImageLoadError = OpenLayers.Util.onImageLoadError;
+
+/**
+ * Function: onImageLoadError
+ */
+OpenLayers.Util.onImageLoadError = function() {
+ if (this.src.match(/^http:\/\/[abc]\.[a-z]+\.openstreetmap\.org\//)) {
+ this.src = OpenLayers.Util.OSM.MISSING_TILE_URL;
+ } else if (this.src.match(/^http:\/\/[def]\.tah\.openstreetmap\.org\//)) {
+ // do nothing - this layer is transparent
+ } else {
+ OpenLayers.Util.OSM.originalOnImageLoadError;
+ }
+};
+
+/**
+ * Class: OpenLayers.Layer.OSM.Mapnik
+ *
+ * Inherits from:
+ * - <OpenLayers.Layer.OSM>
+ */
+OpenLayers.Layer.OSM.Mapnik = OpenLayers.Class(OpenLayers.Layer.OSM, {
+ /**
+ * Constructor: OpenLayers.Layer.OSM.Mapnik
+ *
+ * Parameters:
+ * name - {String}
+ * options - {Object} Hashtable of extra options to tag onto the layer
+ */
+ initialize: function(name, options) {
+ var url = [
+ "http://a.tiles.bigtincan.com/${z}/${x}/${y}.png",
+ "http://b.tiles.bigtincan.com/${z}/${x}/${y}.png",
+ "http://c.tiles.bigtincan.com/${z}/${x}/${y}.png"
+ ];
+ options = OpenLayers.Util.extend({ numZoomLevels: 19 }, options);
+ var newArguments = [name, url, options];
+ OpenLayers.Layer.OSM.prototype.initialize.apply(this, newArguments);
+ },
+
+ CLASS_NAME: "OpenLayers.Layer.OSM.Mapnik"
+});
+
+OpenLayers.Layer.OSM.NearMap = OpenLayers.Class(OpenLayers.Layer.OSM, {
+ /**
+ * Constructor: OpenLayers.Layer.OSM.Mapnik
+ *
+ * Parameters:
+ * name - {String}
+ * options - {Object} Hashtable of extra options to tag onto the layer
+ */
+ initialize: function(name, options) {
+ var url = [
+ "http://nearmap:findreality@web0.nearmap.com/maps/hl=en&nml=Vert&x=${x}&y=${y}&z=${z}",
+ "http://nearmap:findreality@web1.nearmap.com/maps/hl=en&nml=Vert&x=${x}&y=${y}&z=${z}",
+ "http://nearmap:findreality@web2.nearmap.com/maps/hl=en&nml=Vert&x=${x}&y=${y}&z=${z}",
+ "http://nearmap:findreality@web3.nearmap.com/maps/hl=en&nml=Vert&x=${x}&y=${y}&z=${z}"
+ ];
+ options = OpenLayers.Util.extend({ numZoomLevels: 22 }, options);
+ var newArguments = [name, url, options];
+ OpenLayers.Layer.OSM.prototype.initialize.apply(this, newArguments);
+ },
+
+ CLASS_NAME: "OpenLayers.Layer.OSM.NearMap"
+});
+
+/**
+ * Class: OpenLayers.Layer.OSM.Osmarender
+ *
+ * Inherits from:
+ * - <OpenLayers.Layer.OSM>
+ */
+OpenLayers.Layer.OSM.Osmarender = OpenLayers.Class(OpenLayers.Layer.OSM, {
+ /**
+ * Constructor: OpenLayers.Layer.OSM.Osmarender
+ *
+ * Parameters:
+ * name - {String}
+ * options - {Object} Hashtable of extra options to tag onto the layer
+ */
+ initialize: function(name, options) {
+ var url = [
+ "http://a.tah.openstreetmap.org/Tiles/tile/${z}/${x}/${y}.png",
+ "http://b.tah.openstreetmap.org/Tiles/tile/${z}/${x}/${y}.png",
+ "http://c.tah.openstreetmap.org/Tiles/tile/${z}/${x}/${y}.png"
+ ];
+ options = OpenLayers.Util.extend({ numZoomLevels: 18 }, options);
+ var newArguments = [name, url, options];
+ OpenLayers.Layer.OSM.prototype.initialize.apply(this, newArguments);
+ },
+
+ CLASS_NAME: "OpenLayers.Layer.OSM.Osmarender"
+});
+
+/**
+ * Class: OpenLayers.Layer.OSM.CycleMap
+ *
+ * Inherits from:
+ * - <OpenLayers.Layer.OSM>
+ */
+OpenLayers.Layer.OSM.CycleMap = OpenLayers.Class(OpenLayers.Layer.OSM, {
+ /**
+ * Constructor: OpenLayers.Layer.OSM.CycleMap
+ *
+ * Parameters:
+ * name - {String}
+ * options - {Object} Hashtable of extra options to tag onto the layer
+ */
+ initialize: function(name, options) {
+ var url = [
+ "http://a.andy.sandbox.cloudmade.com/tiles/cycle/${z}/${x}/${y}.png",
+ "http://b.andy.sandbox.cloudmade.com/tiles/cycle/${z}/${x}/${y}.png",
+ "http://c.andy.sandbox.cloudmade.com/tiles/cycle/${z}/${x}/${y}.png"
+ ];
+ options = OpenLayers.Util.extend({ numZoomLevels: 19 }, options);
+ var newArguments = [name, url, options];
+ OpenLayers.Layer.OSM.prototype.initialize.apply(this, newArguments);
+ },
+
+ CLASS_NAME: "OpenLayers.Layer.OSM.CycleMap"
+});
+
+/**
+ * Class: OpenLayers.Layer.OSM.Maplint
+ *
+ * Inherits from:
+ * - <OpenLayers.Layer.OSM>
+ */
+OpenLayers.Layer.OSM.Maplint = OpenLayers.Class(OpenLayers.Layer.OSM, {
+ /**
+ * Constructor: OpenLayers.Layer.OSM.Maplint
+ *
+ * Parameters:
+ * name - {String}
+ * options - {Object} Hashtable of extra options to tag onto the layer
+ */
+ initialize: function(name, options) {
+ var url = [
+ "http://d.tah.openstreetmap.org/Tiles/maplint/${z}/${x}/${y}.png",
+ "http://e.tah.openstreetmap.org/Tiles/maplint/${z}/${x}/${y}.png",
+ "http://f.tah.openstreetmap.org/Tiles/maplint/${z}/${x}/${y}.png"
+ ];
+ options = OpenLayers.Util.extend({ numZoomLevels: 18, isBaseLayer: false, visibility: false }, options);
+ var newArguments = [name, url, options];
+ OpenLayers.Layer.OSM.prototype.initialize.apply(this, newArguments);
+ },
+
+ CLASS_NAME: "OpenLayers.Layer.OSM.Maplint"
+});
+
--- /dev/null
+++ b/betweenpoint.php
@@ -1,1 +1,189 @@
+<html xmlns="http://www.w3.org/1999/xhtml">
+ <head>
+ <script src="openlayers/OpenLayers.js"></script>
+ <SCRIPT TYPE="text/javascript" SRC="OpenStreetMap.js"></SCRIPT>
+<script type="text/javascript" src="jquery.1.3.2.min.js"></script>
+ <script type="text/javascript">
+function init()
+{
+ // create the ol map object
+ var map = new OpenLayers.Map('map');
+
+ var osmtiles = new OpenLayers.Layer.OSM("local", "http://127.0.0.1/Maps/OSM/${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");
+
+
+<?php
+$conn = pg_connect("dbname=bus user=postgres password=snmc");
+if (!$conn) {
+ echo "An error occured.\n";
+ exit;
+}
+$result_stops = pg_query($conn, "Select * FROM stops");
+
+while ($stop = pg_fetch_assoc($result_stops)) {
+echo 'marker = new OpenLayers.Marker(new OpenLayers.LonLat('.($stop['lng']/10000000).",".($stop['lat']/10000000).')
+ .transform(
+ new OpenLayers.Projection("EPSG:4326"), // transform from WGS 1984
+ new OpenLayers.Projection("EPSG:900913") // to Spherical Mercator Projection
+ ));';
+
+echo '
+ marker.id="'.$stop['geohash'].'";
+ markers.addMarker(marker);
+marker.events.register("mousedown", marker, function() {
+document.getElementById("between_points").innerHTML += this.id+";";
+});
+';
+}
+?>
+var timeicon = new OpenLayers.Icon("http://maps.google.com/mapfiles/kml/pushpin/grn-pushpin.png",new OpenLayers.Size(32,32));
+var timepoints = new OpenLayers.Layer.GeoRSS("Timing Points", "displaytimepoints.georss.php", { icon: timeicon });
+
+ map.addLayers([osmtiles, markers,timepoints]);
+ map.addControl(new OpenLayers.Control.LayerSwitcher());
+ map.zoomToExtent(markers.getDataExtent());
+ }
+
+ function submit(){
+ $.ajax({
+ type: "POST",
+ url: "betweenpoint.submit.php",
+ data: "reverse=" + document.getElementById("reverse").value +
+ "&from=" + document.getElementById("from").value +
+ "&to=" + document.getElementById("to").value +
+ "&routes=" + document.getElementById("routes").value +
+ "&between_points=" + document.getElementById("between_points").value,
+ success: function(html){
+ $("#response").html(html);
+ clearForms();
+ }
+ });
+
+ }
+<!--
+function OnChange(dropdown)
+{
+ var myindex = dropdown.selectedIndex
+ var selValue = dropdown.options[myindex].value
+alert(selValue);
+ return true;
+}
+//-->
+
+// function will clear input elements on each form
+function clearForms(){
+document.getElementById("between_points").innerHTML = "";
+ // declare element type
+ var type = null;
+ // loop through forms on HTML page
+ for (var x=0; x<document.forms.length; x++){
+ // loop through each element on form
+ for (var y=0; y<document.forms[x].elements.length; y++){
+ // define element type
+ type = document.forms[x].elements[y].type
+ // alert before erasing form element
+ //alert('form='+x+' element='+y+' type='+type);
+ // switch on element type
+ switch(type){
+ case "text":
+ case "textarea":
+ case "password":
+ //case "hidden":
+ document.forms[x].elements[y].value = "";
+ break;
+ case "radio":
+ case "checkbox":
+ document.forms[x].elements[y].checked = "";
+ break;
+ case "select-one":
+ document.forms[x].elements[y].options[0].selected = true;
+ break;
+ case "select-multiple":
+ for (z=0; z<document.forms[x].elements[y].options.length; z++){
+ document.forms[x].elements[y].options[z].selected = false;
+ }
+ break;
+ }
+ }
+ }
+}
+ </script>
+
+ </head>
+ <body onload="init()">
+ <div id="inputpane"><form id="inputform">
+<select name=selectPair onchange='OnChange(this.form.selectPair);'>
+<option>Select a from/to pair...</option>
+<?php
+include('spyc/spyc.php');
+//$timetable = Spyc::YAMLLoad('../spyc.yaml');
+$path = "maxious-canberra-transit-feed/output/";
+$dhandle = opendir("maxious-canberra-transit-feed/output/");
+// define an array to hold the files
+$files = array();
+$paths = array();
+
+if ($dhandle) {
+ // loop through all of the files
+ while (false !== ($fname = readdir($dhandle))) {
+ if (($fname != '.') && ($fname != '..')) {
+ $timetable = Spyc::YAMLLoad("maxious-canberra-transit-feed/output/".$fname);
+ for ($i = 0; $i < sizeof($timetable["time_points"]) -1 ; $i++)
+ {
+ @$paths[$timetable["time_points"][$i]."->".$timetable["time_points"][$i+1]] .= $timetable["short_name"].";";
+ }
+ }
+ }
+}
+$completedPaths = Array("Cameron Ave Bus Station->Lathlain St Bus Station",
+"Lathlain St Bus Station->Cohen St Bus Station",
+"Cohen St Bus Station->Lathlain St Bus Station",
+"Lathlain St Bus Station->Cameron Ave Bus Station",
+"Lathlain St Bus Station - Platform 1->Cameron Ave Bus Station - Platform 1",
+"Lathlain St Bus Station - Platform 2->Cameron Ave Bus Station - Platform 1",
+"Lathlain St Bus Station - Platform 2->Cameron Ave Bus Station - Platform 2",
+"Lathlain St Bus Station - Platform 3->Cameron Ave Bus Station - Platform 2",
+"Lathlain St Bus Station - Platform 3->Cameron Ave Bus Station - Platform 3",
+"Lathlain St Bus Station - Platform 4->Cohen St Bus Station - Platform 4",
+"Lathlain St Bus Station - Platform 4->Cohen St Bus Station - Platform 6",
+"Lathlain St Bus Station - Platform 5->Cohen St Bus Station - Platform 5",
+"Lathlain St Bus Station - Platform 6->Cohen St Bus Station - Platform 5",
+"Cohen St Bus Station - Platform 1->Lathlain St Bus Station - Platform 2",
+"Cohen St Bus Station - Platform 1->Lathlain St Bus Station - Platform 3",
+"Cohen St Bus Station - Platform 2->Lathlain St Bus Station - Platform 1",
+"Cohen St Bus Station - Platform 2->Lathlain St Bus Station - Platform 2",
+"Cohen St Bus Station - Platform 2->Lathlain St Bus Station - Platform 3",
+"Cohen St Bus Station - Platform 3->Lathlain St Bus Station - Platform 1",
+"Cameron Ave Bus Station - Platform 4->Lathlain St Bus Station - Platform 4",
+"Cameron Ave Bus Station - Platform 5->Lathlain St Bus Station - Platform 5",
+"Cameron Ave Bus Station - Platform 5->Lathlain St Bus Station - Platform 6"
+);
+ksort($paths);
+foreach ($paths as $path => $routes)
+{
+ if (!in_array($path,$completedPaths)) echo "<option value=\"$routes:$path\">".sizeof(explode(";",$routes))." $path</option>\n";
+}
+?>
+</select>
+ from <input type="text" id="from"/>
+ to <input type="text" id="to"/>
+<br>
+ on routes <input type="text" id="routes"/>
+Reverse? <input type="checkbox" name="reverse" id="reverse" value="true"/>
+<input type="button" onclick="javascript:submit()" name="mysubmit" value="Submit!">
+<input type="button" value="Clear" onclick="javascript:clearForms()" title="Start clearForms() JavaScript function">
+<br>
+<textarea id="between_points" rows="1" cols="120"></textarea>
+</form>
+<br><div id="response">
+ <!-- Our message will be echoed out here -->
+ </div>
+</div>
+ <div id="map" width="100%" height="100%"></div>
+ </body>
+</html>
+
+
--- /dev/null
+++ b/betweenpoint.submit.php
@@ -1,1 +1,76 @@
+<?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;
+}
+$xml = simplexml_load_file("04-locatebetweenpoints.osm");
+
+/* Access the <rating> nodes of the first movie.
+ * Output the rating scale, too. */
+foreach ($xml->node as $node) {
+ $geoPo = geopoEncode((float)$node['lat'],(float)$node['lon']);
+ $node['lat'] = (int) ((float)$node['lat']*10000000);
+ $node['lon'] = (int) ((float)$node['lon']*10000000);
+ echo($node['lat'].",".$node['lon']."=$geoPo<br>");
+ $sql = "INSERT INTO stops (geohash, lat, lng) VALUES('$geoPo','{$node['lat']}','{$node['lon']}')";
+ $result = pg_query($conn, $sql);
+ if (!$result) {
+ echo("Error in SQL query: " . pg_last_error() ."<br>\n");
+ }
+flush();
+
+}
+?>
--- /dev/null
+++ b/busui/common.inc.php
@@ -1,1 +1,17 @@
+<?php
+date_default_timezone_set('Australia/ACT');
+function service_period()
+{
+switch (date('w')){
+
+case 0:
+ return 'sunday';
+case 6:
+ return 'saturday';
+default:
+ return 'weekday';
+}
+}
+?>
+
--- /dev/null
+++ b/busui/index.php
@@ -1,1 +1,101 @@
+<!doctype html>
+<html>
+ <head>
+ <meta charset="UTF-8" />
+ <title>jQTouch β</title>
+ <style type="text/css" media="screen">@import "jqtouch/jqtouch.min.css";</style>
+ <style type="text/css" media="screen">@import "themes/jqt/theme.min.css";</style>
+ <script src="jqtouch/jquery.1.3.2.min.js" type="text/javascript" charset="utf-8"></script>
+ <script src="jqtouch/jqtouch.min.js" type="application/x-javascript" charset="utf-8"></script>
+ <script src="extensions/jqt.location.js" type="application/x-javascript" charset="utf-8"></script>
+
+ <script type="text/javascript" charset="utf-8">
+ var jQT = new $.jQTouch({
+ icon: 'jqtouch.png',
+ addGlossToIcon: false,
+ startupScreen: 'jqt_startup.png',
+ statusBar: 'black',
+ preloadImages: [
+ 'themes/jqt/img/back_button.png',
+ 'themes/jqt/img/back_button_clicked.png',
+ 'themes/jqt/img/button_clicked.png',
+ 'themes/jqt/img/grayButton.png',
+ 'themes/jqt/img/whiteButton.png',
+ 'themes/jqt/img/loading.gif'
+ ]
+ });
+ $(function(){
+ function setDisplay(text) {
+ $('.info').empty().append(text)
+ }
+
+ // We pass "updateLocation" a callback function,
+ // to run once we have the coordinates.
+ // We also set it to a variable, so we can know
+ // right away if it's working or not
+ var lookup = jQT.updateLocation(function(coords){
+ if (coords) {
+ setDisplay('Latitude: ' + coords.latitude + '<br />Longitude: ' + coords.longitude);
+ $('.nearby').empty().append('<a href="list.php?lat=' + coords.latitude + '&lng=' + coords.longitude + '">Nearby List</a>');
+ } else {
+ setDisplay('Device not capable of geo-location.');
+ }
+ });
+
+ if (lookup) {
+ setDisplay('Looking up location…');
+ }
+ });
+ // Some sample Javascript functions:
+ $(function(){
+ $('a[target="_blank"]').click(function() {
+ if (confirm('This link opens in a new window.')) {
+ return true;
+ } else {
+ $(this).removeClass('active');
+ return false;
+ }
+ });
+ // Page animation callback events
+ $('#pageevents').
+ bind('pageAnimationStart', function(e, info){
+ $(this).find('.info').append('Started animating ' + info.direction + '… ');
+ }).
+ bind('pageAnimationEnd', function(e, info){
+ $(this).find('.info').append(' finished animating ' + info.direction + '.<br /><br />');
+ });
+ // Page animations end with AJAX callback event, example 1 (load remote HTML only first time)
+ $('#callback').bind('pageAnimationEnd', function(e, info){
+ if (!$(this).data('loaded')) { // Make sure the data hasn't already been loaded (we'll set 'loaded' to true a couple lines further down)
+ $(this).append($('<div>Loading</div>'). // Append a placeholder in case the remote HTML takes its sweet time making it back
+ load('ajax.html .info', function() { // Overwrite the "Loading" placeholder text with the remote HTML
+ $(this).parent().data('loaded', true); // Set the 'loaded' var to true so we know not to re-load the HTML next time the #callback div animation ends
+ }));
+ }
+ });
+ // Orientation callback event
+ $('body').bind('turn', function(e, data){
+ $('#orient').html('Orientation: ' + data.orientation);
+ });
+ });
+ </script>
+ </head>
+ <body>
+ <div id="home" class="current">
+ <div class="toolbar">
+ <h1>jQTouch</h1>
+ <a class="button slideup" id="infoButton" href="#about">About</a>
+ </div>
+ <ul class="rounded">
+ <li class="arrow"><a href="#ui">User Interface</a> <small class="counter">4</small></li>
+ <li class="arrow"><a href="list.php">All stops List</a></li>
+ <li class="arrow nearby">Nearby List</li>
+ <li class="arrow"><a href="list.php">Favourites List</a></li>
+ </ul>
+ <div class="info">
+ <p>Add this page to your home screen to view the custom icon, startup screen, and full screen mode.</p>
+ </div>
+ </div>
+ </body>
+</html>
--- /dev/null
+++ b/busui/list.php
@@ -1,1 +1,22 @@
-
+<div id="get">
+ <div class="toolbar">
+ <h1>GET Example</h1>
+ <a class="back" href="#">AJAX</a>
+ </div>
+ <div class="info">
+ This page was loaded via AJAX.
+ </div>
+ <ul class="rounded">
+ <li><a href="#livetest">Test live events</a></li>
+ </ul>
+</div>
+<div id="livetest">
+ <div class="toolbar">
+ <h1>Events test</h1>
+ <a class="back" href="#">AJAX</a>
+ <a class="button goback" href="#home">Home</a>
+ </div>
+ <div class="info">
+ This is a test of live events.
+ </div>
+</div>
--- /dev/null
+++ b/busui/readme.txt
@@ -1,1 +1,2 @@
+TODO
--- /dev/null
+++ b/busui/route.php
--- /dev/null
+++ b/busui/routeList.php
--- /dev/null
+++ b/busui/stop.php
--- /dev/null
+++ b/busui/stopList.php
@@ -1,1 +1,23 @@
+<div id="get">
+ <div class="toolbar">
+ <h1>GET Example</h1>
+ <a class="back" href="#">AJAX</a>
+ </div>
+ <div class="info">
+ This page was loaded via AJAX.
+ </div>
+ <ul class="rounded">
+ <li><a href="#livetest">Test live events</a></li>
+ </ul>
+</div>
+<div id="livetest">
+ <div class="toolbar">
+ <h1>Events test</h1>
+ <a class="back" href="#">AJAX</a>
+ <a class="button goback" href="#home">Home</a>
+ </div>
+ <div class="info">
+ This is a test of live events.
+ </div>
+</div>
--- a/display.php
+++ b/display.php
@@ -1,29 +1,50 @@
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
-<script type="text/javascript" src="http://loki.com/plugin/files/loki.js"></script>
<script src="openlayers/OpenLayers.js"></script>
+ <SCRIPT TYPE="text/javascript" SRC="OpenStreetMap.js"></SCRIPT>
<script type="text/javascript">
-var map, layer;
-
-function aaa(a)
-{
- var lonLat = new OpenLayers.LonLat(a.coords.longitude, a.coords.latitude).transform(new OpenLayers.Projection("EPSG:4326"),
-map.getProjectionObject());
- map.setCenter(lonLat, 13);
-
-}
-
-function handleError(a)
-{
- alert("error in geoloc");
-}
function init()
{
var extent = new OpenLayers.Bounds(148.98, -35.48, 149.25, -35.15);
- map = new OpenLayers.Map('map');
- layer = new OpenLayers.Layer.OSM("local", "http://10.0.1.153/tiles/${z}/${x}/${y}.png");
- map.addLayer(layer);
+
+ // set up the map options
+ var options =
+ {
+ maxExtent: extent,
+ numZoomLevels: 20,
+ };
+
+ // create the ol map object
+ var map = new OpenLayers.Map('map', options);
+
+var osmtiles = new OpenLayers.Layer.OSM("local", "http://10.0.1.153/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',
+ 'weekday_bus_map.png',
+ new OpenLayers.Bounds(149.0, -35.47, 149.16, -35.16),
+ new OpenLayers.Size(1191, 2268),
+ {baseLayer: false}
+ );
+
+var nearmap = new OpenLayers.Layer.OSM.NearMap("NearMap");
+
+ var routes = new OpenLayers.Layer.GML("Routes", "displayroutes.kml.php", {
+ format: OpenLayers.Format.KML,
+ formatOptions: {
+ extractStyles: true,
+ extractAttributes: true,
+ maxDepth: 2
+ }
+ });
+var stopicon = new OpenLayers.Icon("http://maps.google.com/mapfiles/kml/pushpin/ylw-pushpin.png",new OpenLayers.Size(32,32));
+ var stops = new OpenLayers.Layer.GeoRSS("Stops", "displaystops.georss.php", { icon: stopicon });
+var timeicon = new OpenLayers.Icon("http://maps.google.com/mapfiles/kml/pushpin/grn-pushpin.png",new OpenLayers.Size(32,32));
+ var timepoints = new OpenLayers.Layer.GeoRSS("Timing Points", "displaytimepoints.georss.php", { icon: timeicon });
+
+ map.addLayers([osmtiles,stops,routes,timepoints,nearmap]);
+
var lonLat = new OpenLayers.LonLat(149.11, -35.28).transform(new OpenLayers.Projection("EPSG:4326"), map.getProjectionObject());
map.setCenter(lonLat, 13);
map.addControl( new OpenLayers.Control.LayerSwitcher({'ascending':false}));
@@ -36,47 +57,9 @@
{
displayProjection: new OpenLayers.Projection("EPSG:900913")
}));
- if (navigator.geolocation)
- {
- navigator.geolocation.getCurrentPosition(this.aaa, this.handleError);
- }
- else
- {
- var loki = LokiAPI();
- loki.onSuccess = function (location)
- {
- var lonLat = new OpenLayers.LonLat(location.longitude, location.latitude).transform(new OpenLayers.Projection("EPSG:4326"), map.getProjectionObject());
- map.setCenter(lonLat, 13);
- }
- loki.onFailure = function (error)
- {
- loki.requestIPLocation(true, loki.NO_STREET_ADDRESS_LOOKUP)
- }
- loki.setKey('maxious.lambdacomplex.org');
- loki.requestLocation(true, loki.NO_STREET_ADDRESS_LOOKUP);
- }
- map.addLayer(new OpenLayers.Layer.GML("KML", "displayroutes.kml.php", {
- format: OpenLayers.Format.KML,
- formatOptions: {
- extractStyles: true,
- extractAttributes: true,
- maxDepth: 2
- }
- }));
- map.addLayer(new OpenLayers.Layer.Vector("KML", {
- projection: map.displayProjection,
- strategies: [new OpenLayers.Strategy.Fixed()],
- protocol: new OpenLayers.Protocol.HTTP(
- {
- url: "displaystops.kml.php",
- format: new OpenLayers.Format.KML(
- {
- extractStyles: true,
- extractAttributes: true
- })
- })
- }));
+
}
+
</script>
</head>
--- /dev/null
+++ b/displaystops.georss.php
@@ -1,1 +1,29 @@
+<?php
+header('Content-Type: application/xml');
+echo '<?xml version="1.0" enc