Giter Club home page Giter Club logo

php-gpx-ingest's Introduction

PHP-GPX-Ingest

PHP GPX-Ingest is a simple PHP class designed to ingest a basic Global Position eXchange (GPX) file and extract data/stats from the tracks within. It's been tested with the GPX files output by the Android app SpeedView.

Documentation and example usage can be found in the class documentation on my website.

Features

The class has the following features

  • Import basic GPX files
  • Generate stats for each track, and maintain global stats
  • 'SmartTrack' functionality - if an excessive delay is detected between trackpoints a new track will be started (can be disabled/threshold adjusted)
  • Ability to suppress data - Can prevent speed, location, dates and/or elevation from being included in the resulting Journey object.
  • Auto calculation of distance travelled based on lat/lon changes. See GPXIN-6
  • Auto calculation of speed based on distance travelled, if speed not defined within the GPX file. See GPXIN-13
  • Support for waypoints GPXIN-24
  • Support for Routes GPXIN-27

Issue Tracking

Issue and feature tracking is within a private JIRA instance, a HTML mirror can be viewed at http://projects.bentasker.co.uk/jira_projects/browse/GPXIN.html

If you think you've found a bug, or want to ask a question, send an email to gpxingest AT bentasker.co.uk

Copyright

PHP GPX-Ingest is Copyright (C) 2013 B Tasker. All Rights Reserved. Released under the GNU GPL V2 License, see LICENSE.

php-gpx-ingest's People

Contributors

bentasker avatar fbonzon avatar sibyx avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

php-gpx-ingest's Issues

Smart Segments

Some GPS systems don't automatically create a new segment, so there might be an 8 hour gap between trackpoints.

Create an option to detect these and automatically start a new segment. Will need to make sure the break point triggers the segment/track/total stats update as well.

where stat fields?

i dont see these fields in stat

[maxSpeed] => 78
[minSpeed] => 0
[modalSpeed] => 68
[avgspeed] => 55.83

min speed - zero?

I think zero as the minimum rate does not make sense. better to exclude zeros from counting

add package to packagist.org

Since there is composer.json, please add this package to packagist.org so we will be able to install it via Composer.

warnings

Warning: max() [function.max]: Array must contain at least one element in \GPXIngest.php on line 947

Warning: max() [function.max]: Array must contain at least one element in \GPXIngest.php on line 948

Warning: min() [function.min]: Array must contain at least one element in \GPXIngest.php on line 949

Warning: min() [function.min]: Array must contain at least one element in \GPXIngest.php on line 950

Warning: Division by zero in \GPXIngest.php on line 952

Warning: Division by zero in \GPXIngest.php on line 953

gpx file with many TRK?

i have file with many trk in one gpx-file...

but your script work only with LAST trk-section in xml...

you could introduce support for these files?

thanks

20130518.gpx.zip

Consecutive points with same timestamp → div by zero

Consider a GPX file with these four points:

<trkpt lat="46.585705" lon="6.604863"><ele>603.2</ele><time>2016-02-15T06:34:26Z</time></trkpt>
<trkpt lat="46.585689" lon="6.604812"><ele>603.2</ele><time>2016-02-15T06:34:27Z</time></trkpt>
<trkpt lat="46.585658" lon="6.604792"><ele>603.2</ele><time>2016-02-15T06:34:27Z</time></trkpt>
<trkpt lat="46.585623" lon="6.604806"><ele>603.2</ele><time>2016-02-15T06:34:28Z</time></trkpt>

Lines 2 and 3 have the same timestamp. Different positions though.

PHP-GPX-Ingest currently fails on such input with:

Warning: Division by zero in GPXIngest->calculateAcceleration() (line 597 of … GPXIngest.class.php).

Before possibly fixing GPXIngest code, I'd like to know: Do you know if it is valid according to the GPX spec to have 2 points with same timestamp?

Extension Support

<hdop>3.0</hdop> <extensions> <speed>3.980314016342163</speed> </extensions>

Object properties don't need the second $ - line 304 - cause error : Undefined variable: suppresscalcdistance

check line 304

// If speed is not available (and we're not calculating anything which can be used) suppress speed
// Will need updating in GPXIN-20
if (!$trkpt->desc && $this->$suppresscalcdistance){
      $this->suppress('speed'); // Prevent warnings if speed is not available - See GPXIN-16
}

and with:

// If speed is not available (and we're not calculating anything which can be used) suppress speed
// Will need updating in GPXIN-20
if (!$trkpt->desc && $this->suppresscalcdistance){
      $this->suppress('speed'); // Prevent warnings if speed is not available - See GPXIN-16
}

all are ok!

Route import generates error

Hi,

Route import generates error. Adding this line fix the problem:
$this->journey->related->routes = new \stdClass();

	/** Standard constructor
	*
	*/
	function __construct(){
		$this->journey = new \stdClass();
		$this->journey->related = new \stdClass();
		$this->journey->related->waypoints = new \stdClass();
		$this->journey->related->waypoints->points = array();
		$this->journey->related->routes = new \stdClass();
	}

See attached file.

Moreover, in order to make this file work, I had to add thoses lines before ingesting the file:

        $gpx->suppress('speed');
        $gpx->suppress('elevation');
        $gpx->suppress('location');
        $gpx->suppress('date');

gpx-ingest-pb.zip

Thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.