diff --git a/scripts/gpx_extensions1.xsd b/scripts/gpx_extensions1.xsd new file mode 100644 index 0000000..d3f6e11 --- /dev/null +++ b/scripts/gpx_extensions1.xsd @@ -0,0 +1,35 @@ + + + + + + Estimated horizontal accuracy of the location, radial, in meters (radius of 68% confidence). + + + + + Speed in meters per second over ground. + + + + + Horizontal direction of travel of the device, in degrees. + + + + + Name of the provider that generated this fix. + + + + + + + + + + + diff --git a/utils/import.php b/utils/import.php index 2543f92..75a895c 100755 --- a/utils/import.php +++ b/utils/import.php @@ -98,11 +98,23 @@ foreach ($gpx->trk as $trk) { $position = new uPosition(); foreach($trk->trkseg as $segment) { foreach($segment->trkpt as $point) { + $time = isset($point->time) ? strtotime($point->time) : NULL; + $altitude = isset($point->ele) ? $point->ele : NULL; + $speed = NULL; + $bearing = NULL; + $accuracy = NULL; + $provider = "gps"; + if (!empty($point->extensions)) { + // parse ulogger extensions + $ext = $point->extensions->children('ulogger', TRUE); + if (isset($ext->speed)) { $speed = $ext->speed; } + if (isset($ext->bearing)) { $bearing = $ext->bearing; } + if (isset($ext->accuracy)) { $accuracy = $ext->accuracy; } + if (isset($ext->provider)) { $provider = $ext->provider; } + } $ret = $position->add($user->id, $trackId, - (($point->time) ? strtotime($point->time) : NULL), - $point["lat"], $point["lon"], - (($point->ele) ? $point->ele : NULL), - NULL, NULL, NULL, "gps", NULL, NULL); + $time, $point["lat"], $point["lon"], $altitude, + $speed, $bearing, $accuracy, $provider, NULL, NULL); if ($ret === false) { uUtils::exitWithError($lang["servererror"]); }