Skip to content

Commit

Permalink
Introduce resampling filter and nvectors. (GPSBabel#763)
Browse files Browse the repository at this point in the history
* Introduce resampling filter and nvectors.

* use ellipsoid model with nvectors.

the code had been forcing a spherical earth model to match the
existing grtcirc.cc calculations.
  • Loading branch information
tsteven4 authored Nov 21, 2021
1 parent 1a422a6 commit fa20976
Show file tree
Hide file tree
Showing 20 changed files with 1,406 additions and 2 deletions.
6 changes: 5 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ set(FILTERS
position.cc radius.cc duplicate.cc arcdist.cc polygon.cc smplrout.cc
reverse_route.cc sort.cc stackfilter.cc trackfilter.cc discard.cc
nukedata.cc interpolate.cc transform.cc height.cc swapdata.cc bend.cc
validate.cc
validate.cc resample.cc
)

set(SHAPE
Expand Down Expand Up @@ -96,8 +96,10 @@ set(SUPPORT
formspec.cc xmltag.cc cet.cc cet_util.cc fatal.cc rgbcolors.cc
inifile.cc garmin_fs.cc units.cc gbser.cc
gbfile.cc parse.cc session.cc main.cc globals.cc
src/core/nvector.cc
src/core/textstream.cc
src/core/usasciicodec.cc
src/core/vector3d.cc
src/core/xmlstreamwriter.cc
)
if(${QT_VERSION_MAJOR} EQUAL "6")
Expand Down Expand Up @@ -187,8 +189,10 @@ set(HEADERS
src/core/datetime.h
src/core/file.h
src/core/logging.h
src/core/nvector.h
src/core/textstream.h
src/core/usasciicodec.h
src/core/vector3d.h
src/core/xmlstreamwriter.h
src/core/xmltag.h
)
Expand Down
6 changes: 5 additions & 1 deletion GPSBabel.pro
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ DEPRECATED_SHAPE=pdbfile.cc
FILTERS=position.cc radius.cc duplicate.cc arcdist.cc polygon.cc smplrout.cc \
reverse_route.cc sort.cc stackfilter.cc trackfilter.cc discard.cc \
nukedata.cc interpolate.cc transform.cc height.cc swapdata.cc bend.cc \
validate.cc
validate.cc resample.cc
FILTER_HEADERS = $$FILTERS
FILTER_HEADERS ~= s/\\.cc/.h/g

Expand All @@ -107,8 +107,10 @@ SUPPORT = route.cc waypt.cc filter_vecs.cc util.cc vecs.cc mkshort.cc \
formspec.cc xmltag.cc cet.cc cet_util.cc fatal.cc rgbcolors.cc \
inifile.cc garmin_fs.cc units.cc gbser.cc \
gbfile.cc parse.cc session.cc main.cc globals.cc \
src/core/nvector.cc \
src/core/textstream.cc \
src/core/usasciicodec.cc \
src/core/vector3d.cc \
src/core/xmlstreamwriter.cc

versionAtLeast(QT_VERSION, 6.0): SUPPORT += src/core/codecdevice.cc
Expand Down Expand Up @@ -184,8 +186,10 @@ HEADERS = \
src/core/datetime.h \
src/core/file.h \
src/core/logging.h \
src/core/nvector.h \
src/core/textstream.h \
src/core/usasciicodec.h \
src/core/vector3d.h \
src/core/xmlstreamwriter.h \
src/core/xmltag.h

Expand Down
7 changes: 7 additions & 0 deletions filter_vecs.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
#include "polygon.h" // for PolygonFilter
#include "position.h" // for PositionFilter
#include "radius.h" // for RadiusFilter
#include "resample.h" // for ResampleFilter
#include "reverse_route.h" // for ReverseRouteFilter
#include "smplrout.h" // for SimplifyRouteFilter
#include "sort.h" // for SortFilter
Expand Down Expand Up @@ -97,6 +98,7 @@ static bool validate_filter_vec(const fl_vecs_t& vec);
PolygonFilter polygon;
PositionFilter position;
RadiusFilter radius;
ResampleFilter resample;
ReverseRouteFilter reverse_route;
SimplifyRouteFilter routesimple;
SortFilter sort;
Expand Down Expand Up @@ -153,6 +155,11 @@ static bool validate_filter_vec(const fl_vecs_t& vec);
"radius",
"Include Only Points Within Radius",
},
{
&resample,
"resample",
"Resample Track",
},
{
&routesimple,
"simplify",
Expand Down
1 change: 1 addition & 0 deletions reference/filter0.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ nuketypes Remove all waypoints, tracks, or routes
duplicate Remove Duplicates
position Remove Points Within Distance
discard Remove unreliable points with high hdop or vdop
resample Resample Track
reverse Reverse stops within routes
stack Save and restore waypoint lists
simplify Simplify routes
Expand Down
4 changes: 4 additions & 0 deletions reference/filter1.txt
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,10 @@ option discard matchname Suppress points where name matches given name string
option discard matchdesc Suppress points where description matches given name string https://www.gpsbabel.org/WEB_DOC_DIR/filter_discard.html#fmt_discard_o_matchdesc
option discard matchcmt Suppress points where comment matches given name string https://www.gpsbabel.org/WEB_DOC_DIR/filter_discard.html#fmt_discard_o_matchcmt
option discard matchicon Suppress points where type matches given name string https://www.gpsbabel.org/WEB_DOC_DIR/filter_discard.html#fmt_discard_o_matchicon
resample Resample Track https://www.gpsbabel.org/WEB_DOC_DIR/filter_resample.html
option resample decimate Decimate, decrease sample rate by a factor of n integer 2 https://www.gpsbabel.org/WEB_DOC_DIR/filter_resample.html#fmt_resample_o_decimate
option resample interpolate Interpolate, increase sample rate by a factor of n integer 2 https://www.gpsbabel.org/WEB_DOC_DIR/filter_resample.html#fmt_resample_o_interpolate
option resample average Running average of n points integer 2 https://www.gpsbabel.org/WEB_DOC_DIR/filter_resample.html#fmt_resample_o_average
reverse Reverse stops within routes https://www.gpsbabel.org/WEB_DOC_DIR/filter_reverse.html
stack Save and restore waypoint lists https://www.gpsbabel.org/WEB_DOC_DIR/filter_stack.html
option stack push Push waypoint list onto stack boolean https://www.gpsbabel.org/WEB_DOC_DIR/filter_stack.html#fmt_stack_o_push
Expand Down
4 changes: 4 additions & 0 deletions reference/help.txt
Original file line number Diff line number Diff line change
Expand Up @@ -742,6 +742,10 @@ Supported data filters:
nosort Inhibit sort by distance to center
maxcount Output no more than this number of points
asroute Put resulting waypoints in route of this name
resample Resample Track
decimate Decimate, decrease sample rate by a factor of n
interpolate Interpolate, increase sample rate by a factor of n
average Running average of n points
simplify Simplify routes
count Maximum number of points in route
error Maximum error
Expand Down
49 changes: 49 additions & 0 deletions reference/track/sim.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
utc_d,utc_t,lat,lon
2021/11/10,11:00:00 AM,66.000103228632,-179.97904
2021/11/10,11:00:01 AM,66.0001884601077,-179.97903
2021/11/10,11:00:02 AM,66.0000230237331,-179.97947
2021/11/10,11:00:03 AM,66.000045323685,-179.98008
2021/11/10,11:00:04 AM,66.0001767900345,-179.98048
2021/11/10,11:00:05 AM,66.0001092928285,-179.98067
2021/11/10,11:00:06 AM,66.0001668298279,-179.98197
2021/11/10,11:00:07 AM,66.0000748518391,-179.98320
2021/11/10,11:00:08 AM,66.0001341555094,-179.98429
2021/11/10,11:00:09 AM,66.0001213660596,-179.98519
2021/11/10,11:00:10 AM,66.0001967593428,-179.98558
2021/11/10,11:00:11 AM,66.0001580625671,-179.98671
2021/11/10,11:00:12 AM,66.0001378472268,-179.98805
2021/11/10,11:00:13 AM,66.0001709596168,-179.98906
2021/11/10,11:00:14 AM,66.0000502908297,-179.98970
2021/11/10,11:00:15 AM,66.000066383696,-179.99130
2021/11/10,11:00:16 AM,66.0000462879889,-179.99183
2021/11/10,11:00:17 AM,66.0001312399228,-179.99340
2021/11/10,11:00:18 AM,66.0000883525882,-179.99384
2021/11/10,11:00:19 AM,66.0001647357197,-179.99504
2021/11/10,11:00:20 AM,66.0001959985441,-179.99596
2021/11/10,11:00:21 AM,66.0001581122524,-179.99737
2021/11/10,11:00:22 AM,66.0001028337378,-179.99798
2021/11/10,11:00:23 AM,66.000105956278,-179.99903
2021/11/10,11:00:24 AM,66.0000574941283,-179.99956
2021/11/10,11:00:25 AM,66.0000416369344,179.99915
2021/11/10,11:00:26 AM,66.0001504925119,179.99831
2021/11/10,11:00:27 AM,66.0001927654035,179.99675
2021/11/10,11:00:28 AM,66.0001282065146,179.99621
2021/11/10,11:00:29 AM,66.0000911889429,179.99493
2021/11/10,11:00:30 AM,66.0001909788552,179.99362
2021/11/10,11:00:31 AM,66.0000568057737,179.99293
2021/11/10,11:00:32 AM,66.0000978383165,179.99211
2021/11/10,11:00:33 AM,66.0000403599515,179.99138
2021/11/10,11:00:34 AM,66.0001144849062,179.99045
2021/11/10,11:00:35 AM,66.0000769781374,179.98854
2021/11/10,11:00:36 AM,66.0000133158984,179.98783
2021/11/10,11:00:37 AM,66.0001758676388,179.98699
2021/11/10,11:00:38 AM,66.0000207460354,179.98606
2021/11/10,11:00:39 AM,66.0000931231469,179.98538
2021/11/10,11:00:40 AM,66.0001991309548,179.98429
2021/11/10,11:00:41 AM,66.0001841979519,179.98311
2021/11/10,11:00:42 AM,66.0001217081583,179.98251
2021/11/10,11:00:43 AM,66.0001017396611,179.98182
2021/11/10,11:00:44 AM,66.0001469324212,179.98183
2021/11/10,11:00:45 AM,66.0000706021879,179.98175
2021/11/10,11:00:46 AM,66.0000732617344,179.98178
2021/11/10,11:00:47 AM,66.0001673249007,179.98162
25 changes: 25 additions & 0 deletions reference/track/simdec.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
No,Latitude,Longitude,Date,Time
1,66.000106,-179.979157,2021/11/10,11:00:00
2,66.000098,-179.979623,2021/11/10,11:00:02
3,66.000113,-179.980580,2021/11/10,11:00:04
4,66.000126,-179.982144,2021/11/10,11:00:06
5,66.000132,-179.984051,2021/11/10,11:00:08
6,66.000151,-179.985935,2021/11/10,11:00:10
7,66.000139,-179.987910,2021/11/10,11:00:12
8,66.000098,-179.989984,2021/11/10,11:00:14
9,66.000087,-179.992037,2021/11/10,11:00:16
10,66.000122,-179.994058,2021/11/10,11:00:18
11,66.000148,-179.996071,2021/11/10,11:00:20
12,66.000120,-179.998003,2021/11/10,11:00:22
13,66.000096,-179.999865,2021/11/10,11:00:24
14,66.000117,179.998134,2021/11/10,11:00:26
15,66.000134,179.995989,2021/11/10,11:00:28
16,66.000118,179.993927,2021/11/10,11:00:30
17,66.000091,179.992061,2021/11/10,11:00:32
18,66.000079,179.990085,2021/11/10,11:00:34
19,66.000076,179.987981,2021/11/10,11:00:36
20,66.000099,179.986078,2021/11/10,11:00:38
21,66.000137,179.984286,2021/11/10,11:00:40
22,66.000138,179.982762,2021/11/10,11:00:42
23,66.000115,179.981959,2021/11/10,11:00:44
24,66.000110,179.981758,2021/11/10,11:00:46
96 changes: 96 additions & 0 deletions reference/track/simint.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
No,Latitude,Longitude,Date,Time
1,66.000103,-179.979040,2021/11/10,11:00:00
2,66.000146,-179.979035,2021/11/10,11:00:00.500
3,66.000188,-179.979030,2021/11/10,11:00:01
4,66.000106,-179.979250,2021/11/10,11:00:01.500
5,66.000023,-179.979470,2021/11/10,11:00:02
6,66.000034,-179.979775,2021/11/10,11:00:02.500
7,66.000045,-179.980080,2021/11/10,11:00:03
8,66.000111,-179.980280,2021/11/10,11:00:03.500
9,66.000177,-179.980480,2021/11/10,11:00:04
10,66.000143,-179.980575,2021/11/10,11:00:04.500
11,66.000109,-179.980670,2021/11/10,11:00:05
12,66.000138,-179.981320,2021/11/10,11:00:05.500
13,66.000167,-179.981970,2021/11/10,11:00:06
14,66.000121,-179.982585,2021/11/10,11:00:06.500
15,66.000075,-179.983200,2021/11/10,11:00:07
16,66.000105,-179.983745,2021/11/10,11:00:07.500
17,66.000134,-179.984290,2021/11/10,11:00:08
18,66.000128,-179.984740,2021/11/10,11:00:08.500
19,66.000121,-179.985190,2021/11/10,11:00:09
20,66.000159,-179.985385,2021/11/10,11:00:09.500
21,66.000197,-179.985580,2021/11/10,11:00:10
22,66.000177,-179.986145,2021/11/10,11:00:10.500
23,66.000158,-179.986710,2021/11/10,11:00:11
24,66.000148,-179.987380,2021/11/10,11:00:11.500
25,66.000138,-179.988050,2021/11/10,11:00:12
26,66.000154,-179.988555,2021/11/10,11:00:12.500
27,66.000171,-179.989060,2021/11/10,11:00:13
28,66.000111,-179.989380,2021/11/10,11:00:13.500
29,66.000050,-179.989700,2021/11/10,11:00:14
30,66.000058,-179.990500,2021/11/10,11:00:14.500
31,66.000066,-179.991300,2021/11/10,11:00:15
32,66.000056,-179.991565,2021/11/10,11:00:15.500
33,66.000046,-179.991830,2021/11/10,11:00:16
34,66.000089,-179.992615,2021/11/10,11:00:16.500
35,66.000131,-179.993400,2021/11/10,11:00:17
36,66.000110,-179.993620,2021/11/10,11:00:17.500
37,66.000088,-179.993840,2021/11/10,11:00:18
38,66.000127,-179.994440,2021/11/10,11:00:18.500
39,66.000165,-179.995040,2021/11/10,11:00:19
40,66.000180,-179.995500,2021/11/10,11:00:19.500
41,66.000196,-179.995960,2021/11/10,11:00:20
42,66.000177,-179.996665,2021/11/10,11:00:20.500
43,66.000158,-179.997370,2021/11/10,11:00:21
44,66.000130,-179.997675,2021/11/10,11:00:21.500
45,66.000103,-179.997980,2021/11/10,11:00:22
46,66.000104,-179.998505,2021/11/10,11:00:22.500
47,66.000106,-179.999030,2021/11/10,11:00:23
48,66.000082,-179.999295,2021/11/10,11:00:23.500
49,66.000057,-179.999560,2021/11/10,11:00:24
50,66.000050,179.999795,2021/11/10,11:00:24.500
51,66.000042,179.999150,2021/11/10,11:00:25
52,66.000096,179.998730,2021/11/10,11:00:25.500
53,66.000150,179.998310,2021/11/10,11:00:26
54,66.000172,179.997530,2021/11/10,11:00:26.500
55,66.000193,179.996750,2021/11/10,11:00:27
56,66.000160,179.996480,2021/11/10,11:00:27.500
57,66.000128,179.996210,2021/11/10,11:00:28
58,66.000110,179.995570,2021/11/10,11:00:28.500
59,66.000091,179.994930,2021/11/10,11:00:29
60,66.000141,179.994275,2021/11/10,11:00:29.500
61,66.000191,179.993620,2021/11/10,11:00:30
62,66.000124,179.993275,2021/11/10,11:00:30.500
63,66.000057,179.992930,2021/11/10,11:00:31
64,66.000077,179.992520,2021/11/10,11:00:31.500
65,66.000098,179.992110,2021/11/10,11:00:32
66,66.000069,179.991745,2021/11/10,11:00:32.500
67,66.000040,179.991380,2021/11/10,11:00:33
68,66.000077,179.990915,2021/11/10,11:00:33.500
69,66.000114,179.990450,2021/11/10,11:00:34
70,66.000096,179.989495,2021/11/10,11:00:34.500
71,66.000077,179.988540,2021/11/10,11:00:35
72,66.000045,179.988185,2021/11/10,11:00:35.500
73,66.000013,179.987830,2021/11/10,11:00:36
74,66.000095,179.987410,2021/11/10,11:00:36.500
75,66.000176,179.986990,2021/11/10,11:00:37
76,66.000098,179.986525,2021/11/10,11:00:37.500
77,66.000021,179.986060,2021/11/10,11:00:38
78,66.000057,179.985720,2021/11/10,11:00:38.500
79,66.000093,179.985380,2021/11/10,11:00:39
80,66.000146,179.984835,2021/11/10,11:00:39.500
81,66.000199,179.984290,2021/11/10,11:00:40
82,66.000192,179.983700,2021/11/10,11:00:40.500
83,66.000184,179.983110,2021/11/10,11:00:41
84,66.000153,179.982810,2021/11/10,11:00:41.500
85,66.000122,179.982510,2021/11/10,11:00:42
86,66.000112,179.982165,2021/11/10,11:00:42.500
87,66.000102,179.981820,2021/11/10,11:00:43
88,66.000124,179.981825,2021/11/10,11:00:43.500
89,66.000147,179.981830,2021/11/10,11:00:44
90,66.000109,179.981790,2021/11/10,11:00:44.500
91,66.000071,179.981750,2021/11/10,11:00:45
92,66.000072,179.981765,2021/11/10,11:00:45.500
93,66.000073,179.981780,2021/11/10,11:00:46
94,66.000120,179.981700,2021/11/10,11:00:46.500
95,66.000167,179.981620,2021/11/10,11:00:47
Loading

0 comments on commit fa20976

Please sign in to comment.