mikalhart / TinyGPSPlus

A new, customizable Arduino NMEA parsing library
http://arduiniana.org
1.1k stars 494 forks source link

Location average functionality added #32

Closed dan-leo closed 7 years ago

dan-leo commented 7 years ago

First off, it doesn't have to be version 0.96.

Secondly, please let me know if you'd like to change anything.

In the spirit of this library, the location average methods are very similar to the location methods except for the dynamic resize ability.

Accessing the latitude is as simple as gps.location.average.lat()

Resizing (default 10) is as simple as: gps.location.average.resize(300)

This is the output of the LocationAverage.ino example:

` LocationAverage.ino
Basic demonstration of TinyGPS++ and average location (no device needed)
Testing TinyGPS++ library v. 0.96
by Mikal Hart, Average Location added by Daniel Robinson

Location: 30.236640000,-97.821453333 Date/Time: 9/3/2013 04:51:03.00 Location: 30.236641667,-97.821455000 Date/Time: 9/3/2013 04:51:04.00 Average Location: 30.236640833,-97.821454166

Location: 30.239700000,-97.815856667 Date/Time: 9/3/2013 04:52:00.00
Location: 30.239773333,-97.815685000 Date/Time: 9/3/2013 04:52:01.00
Location: 30.240458333,-97.817710000 Date/Time: 9/3/2013 04:52:51.00
Location: 30.240455000,-97.817713333 Date/Time: 9/3/2013 04:52:52.00
Average Location: 30.240096666,-97.816741250 `

mikalhart commented 7 years ago

Thanks for the contribution, but as TinyGPS++ is primarily an NMEA parser, I think I'd rather not overload it with geo-related calculations (courseTo and distanceBetween notwithstanding. :))