Add initial between point adding prototype
--- /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,23 +1,8 @@
<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()
{
@@ -28,14 +13,38 @@
{
maxExtent: extent,
numZoomLevels: 20,
- };
+ };
// create the ol map object
var map = new OpenLayers.Map('map', options);
-layer = new OpenLayers.Layer.OSM("local", "http://10.0.1.153/tiles/${z}/${x}/${y}.png");
- map.addLayer(layer);
-map.addLayer(new OpenLayers.Layer.OSM.NearMap("NearMap"));
+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}));
@@ -48,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" encoding="utf-8"?>
+<feed xmlns="http://www.w3.org/2005/Atom"
+ xmlns:georss="http://www.georss.org/georss"><title>Bus Stops from OSM</title>';
+$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 ");
+if (!$result_stops) {
+ echo "An stops retirieve error occured.\n";
+ exit;
+}
+
+while ($stop = pg_fetch_assoc($result_stops)) {
+ echo "\n<entry>\n";
+ echo "<summary> {$stop['geohash']}</summary>";
+ echo "<title>{$stop['geohash']}</title>";
+
+echo "<georss:point> ";echo ($stop['lat']/10000000)." ".($stop['lng']/10000000);
+echo " </georss:point>";
+echo '</entry>';
+}
+
+echo "\n</feed>\n";
+?>
--- a/displaystops.kml.php
+++ /dev/null
@@ -1,58 +1,1 @@
-<?php
-header('Content-Type: application/vnd.google-earth.kml+xml');
-echo '<?xml version="1.0" encoding="UTF-8"?>
-<kml xmlns="http://www.opengis.net/kml/2.2"><Document>';
-echo '<Style id="target">
- <IconStyle>
- <Icon>
- <href>http://maps.google.com/mapfiles/kml/pushpin/ylw-pushpin.png</href>
- </Icon>
- </IconStyle>
- </Style>';
-echo '<Style id="player">
- <IconStyle>
- <Icon>
- <href>http://maps.google.com/mapfiles/kml/pushpin/grn-pushpin.png</href>
- </Icon>
- </IconStyle>
- </Style>';
-$conn = pg_connect("dbname=openstreetmap user=postgres password=snmc");
-if (!$conn) {
- echo "An error occured.\n";
- exit;
-}
-/*SELECT * from current_node_tags, (Select id FROM current_node_tags WHERE "v" LIKE '%bus%') as a
-where a.id = current_node_tags.id; */
-$result_stops = pg_query($conn, "Select * FROM current_node_tags INNER JOIN current_nodes ON
-current_node_tags.id=current_nodes.id WHERE v LIKE '%bus%' ");
-if (!$result_stops) {
- echo "An stops retirieve error occured.\n";
- exit;
-}
-
-while ($stop = pg_fetch_assoc($result_stops)) {
- echo "\n<Placemark>\n";
- echo "<description>";
-$result_stopkeys = pg_query($conn, "SELECT * from current_node_tags where id = {$stop['id']};");
-if (!$result_stopkeys) {
- echo "An stops keys retirieve error occured.\n";
- exit;
-}
-$name = "";
-while ($stopkeys = pg_fetch_assoc($result_stopkeys)) {
-echo htmlspecialchars(print_r($stopkeys,true));
-$name .= htmlspecialchars($stopkeys['v']);
-}
-echo "</description>";
- echo "<name>$name</name>";
-
-echo "<styleUrl>#target</styleUrl>";
-echo "\n <Point><coordinates> ";
- echo ($stop['longitude']/10000000).",".($stop['latitude']/10000000)."\n";
-echo " </coordinates> </Point>";
-echo '</Placemark>';
-}
-
-echo "\n</Document></kml>\n";
-?>
--- /dev/null
+++ b/displaytimepoints.georss.php
@@ -1,1 +1,26 @@
+<?php
+header('Content-Type: application/xml');
+echo '<?xml version="1.0" encoding="utf-8"?> <feed xmlns="http://www.w3.org/2005/Atom" xmlns:georss="http://www.georss.org/georss">';
+echo '<title> Points</title>';
+$conn = pg_connect("dbname=bus user=postgres password=snmc");
+if (!$conn) {
+ echo "An error occured.\n";
+ exit;
+}
+$result_timepoints = pg_query($conn, "Select * FROM timing_point where lat is not null and lng is not null ");
+if (!$result_timepoints) {
+ echo "An timepoints retirieve error occured.\n";
+ exit;
+}
+
+while ($timepoint = pg_fetch_assoc($result_timepoints)) {
+ 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 "</entry>\n";
+}
+
+echo "\n</feed>\n";
+?>
--- a/displaytimepoints.kml.php
+++ /dev/null
@@ -1,58 +1,1 @@
-<?php
-header('Content-Type: application/vnd.google-earth.kml+xml');
-echo '<?xml version="1.0" encoding="UTF-8"?>
-<kml xmlns="http://www.opengis.net/kml/2.2"><Document>';
-echo '<Style id="target">
- <IconStyle>
- <Icon>
- <href>http://maps.google.com/mapfiles/kml/pushpin/ylw-pushpin.png</href>
- </Icon>
- </IconStyle>
- </Style>';
-echo '<Style id="player">
- <IconStyle>
- <Icon>
- <href>http://maps.google.com/mapfiles/kml/pushpin/grn-pushpin.png</href>
- </Icon>
- </IconStyle>
- </Style>';
-$conn = pg_connect("dbname=openstreetmap user=postgres password=snmc");
-if (!$conn) {
- echo "An error occured.\n";
- exit;
-}
-/*SELECT * from current_node_tags, (Select id FROM current_node_tags WHERE "v" LIKE '%bus%') as a
-wh