Show two directions and stops on routes/trips KML
[busui.git] / geo / trip.kml.php
blob:a/geo/trip.kml.php -> blob:b/geo/trip.kml.php
<?php <?php
   
header('Content-Type: application/vnd.google-earth.kml+xml'); header('Content-Type: application/vnd.google-earth.kml+xml');
include ('../include/common.inc.php'); include ('../include/common.inc.php');
  header('Content-Disposition: attachment; filename="trip.' . urlencode($tripid) . '.kml"');
  $debugOkay = Array(); // disable debugging output even on dev server
echo '<?xml version="1.0" encoding="UTF-8"?> echo '<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2" xmlns:atom="http://www.w3.org/2005/Atom"><Document>'; <kml xmlns="http://www.opengis.net/kml/2.2" xmlns:atom="http://www.w3.org/2005/Atom"><Document>';
echo ' echo '
  <Style id="ylw-pushpin">
  <IconStyle>
  <Icon>
  <href>http://maps.google.com/mapfiles/kml/pushpin/ylw-pushpin.png</href>
   
  </Icon>
  </IconStyle>
   
  </Style>
  <Style id="blue-pushpin">
  <IconStyle>
  <Icon>
  <href>http://maps.google.com/mapfiles/kml/pushpin/blue-pushpin.png</href>
   
  </Icon>
  </IconStyle>
   
  </Style>
  <Style id="grn-pushpin">
  <IconStyle>
  <Icon>
  <href>http://maps.google.com/mapfiles/kml/pushpin/grn-pushpin.png</href>
   
  </Icon>
  </IconStyle>
  </Style>
<Style id="yellowLineGreenPoly"> <Style id="yellowLineGreenPoly">
<LineStyle> <LineStyle>
<color>7f00ff00</color> <color>7f00ff00</color>
<width>4</width> <width>4</width>
</LineStyle> </LineStyle>
<PolyStyle> <PolyStyle>
<color>7f00ffff</color> <color>7f00ffff</color>
</PolyStyle> </PolyStyle>
</Style>'; </Style>';
$trip = getTrip($tripid); $trip = getTrip($tripid);
echo "\n<Placemark>\n"; echo "\n<Placemark>\n";
$link = curPageURL() . "/../trip.php?tripid=" . htmlspecialchars($$tripid); $link = curPageURL() . "/../trip.php?tripid=" . htmlspecialchars($$tripid);
echo "<name>" . $tripid . "</name>"; echo "<name>" . $tripid . "</name>";
echo '<atom:link href="' . $link . '"/>'; echo '<atom:link rel="related" href="' . $link . '"/>';
echo '<description><![CDATA[ <a href="' . $link . '">' . $tripid . "</a>]]> </description>"; echo '<description><![CDATA[ <a href="' . $link . '">' . $tripid . "</a>]]> </description>";
echo "<styleUrl>#yellowLineGreenPoly</styleUrl>"; echo "<styleUrl>#yellowLineGreenPoly</styleUrl>";
   
   
echo getTripShape($tripid); echo getTripShape($tripid);
   
echo "</Placemark>\n</Document></kml>\n"; echo "</Placemark>\n";
  foreach (getTripStopTimes($tripid) as $stop) {
  echo "\n<Placemark>\n";
  $link = curPageURL() . '/../trip.php?tripid=' . htmlspecialchars($tripid);
  echo "<name>" . $stop['arrival_time'] . " @ " . htmlspecialchars($stop['stop_name']) . "</name>";
  echo '<atom:link rel="related" href="' . $link . '"/>';
  echo '<description><![CDATA[ <a href="' . $link . '">' . htmlspecialchars($stop['stop_name']) . "</a>]]> </description>";
  echo "<styleUrl>#blue-pushpin</styleUrl>";
  echo "<Point><coordinates>" . $stop['stop_lon'] . "," . $stop['stop_lat'] . "</coordinates></Point>";
   
  echo "</Placemark>\n";
  }
  echo "</Document></kml>\n";
?> ?>