Esempio n. 1
0
    logger("Lat: " . $lat . " - Equation -- " . substr($lat, 0, strpos($lat, ".")) . " - " . $lat_minutes_decimal . " - " . $lat_seconds_decimal);
    $lat = substr($lat, 0, strpos($lat, ".")) + $lat_minutes_decimal + $lat_seconds_decimal;
    logger("Formatted Lat: " . $lat);
    $lon = substr($lon, 0, strpos($lon, ".")) + $lon_minutes_decimal + $lon_seconds_decimal;
    //Set whether lat or lon is positive or negative
    if ($row['NS'] == "S") {
        $lat = $lat * -1;
    }
    if ($row['EW'] == "W") {
        $lon = $lon * -1;
    }
    //Offset the UTC time to user's local time
    $dt = new DateTime($row['eventdate']);
    //$dt = $dt->add(new DateInterval("P".$timezone_offset."H"));
    //$dt = $dt->add(new DateInterval('PT4H'));
    $gps->addPoint($lat, $lon, $dt->format(DateTime::ISO8601));
}
mysqli_close($con);
try {
    $gps->CreateGPXFile();
} catch (Exception $e) {
    logger("Failed to export GPX file: CreateGPXFile() - " . $e->getMessage());
}
logger("Generated GPX file for APIKey:" . $apikey);
//Output HTML page w/ link to file
?>

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
        <title>Download page</title>
Esempio n. 2
0
<?
require('phpGPX.php');

// a.) create instance of phpGoogleKML class
$my = new phpGPX();

// b.) Change these properties only in case when you'd like to change default values (see documentation for default values).
$my->filename = "test.gpx";
//$my->outputDirectory = "./export/";

// c.1) add Point(s) to your GPX file
$my->addPoint("name2","cmrwe","swym","teype","des",42.000421,21.057541);
$my->addPoint("name1","cmrdf","sywem","type","dewer2s",42.78777,21.052521);
$my->addPoint("name4","cmry","symtr","tewrype","des",42.11251,21.744521);

// or c.2) to add Line to GPX file
// $my->addLinePlacemark();

// d.1) create GPX file
$my->CreateGPXfile();

// d.2) or display GPX file
//$my->DownloadGPXfile("TXT");

// d.3) or display GPX file
//$my->DisplayGPXfile();

// HOWTO display phpGPX properties ?
//echo $my->KML_name;
//echo $my->KML_description;
//echo $my->outputDirectory;