--- a/displaystops.georss.php +++ b/displaystops.georss.php @@ -1,17 +1,14 @@ <?php header('Content-Type: application/xml'); -echo '<?xml version="1.0" encoding="utf-8"?> -<feed xmlns="http://www.w3.org/2005/Atom" +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=openstreetmap user=postgres password=snmc"); +$conn = pg_connect("dbname=bus 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%' "); +$result_stops = pg_query($conn, "Select * FROM stops "); if (!$result_stops) { echo "An stops retirieve error occured.\n"; exit; @@ -19,21 +16,10 @@ while ($stop = pg_fetch_assoc($result_stops)) { echo "\n<entry>\n"; - echo "<summary>"; -$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 "</summary>"; - echo "<title>$name</title>"; + echo "<summary> {$stop['geohash']}</summary>"; + echo "<title>{$stop['geohash']}</title>"; -echo "<georss:point> ";echo ($stop['latitude']/10000000)." ".($stop['longitude']/10000000); +echo "<georss:point> ";echo ($stop['lat']/10000000)." ".($stop['lng']/10000000); echo " </georss:point>"; echo '</entry>'; }