-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathgpxfill
executable file
·47 lines (37 loc) · 1.05 KB
/
gpxfill
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/usr/bin/env python
import argparse
import logging
import sys
import traceback
import gpxlib
def main():
parser = argparse.ArgumentParser(description="Interpolate outlier points")
parser.add_argument(
"-d",
"--distance",
help="Distance where a point is considered an outlier",
type=int,
default=gpxlib.DEFAULT_MAXDIST,
)
parser.add_argument(
"-f",
"--filldist",
help="Distance between fake points",
type=int,
default=gpxlib.DEFAULT_FILLDIST,
)
parser.add_argument("file", nargs="?")
args, pass_args = parser.parse_known_args()
logging.basicConfig(level=1, format="%(asctime)s -- %(message)s")
gpx_in, points = gpxlib.read(args.file)
gpx_out, segment = gpxlib.create(gpx_in)
try:
segment.points = gpxlib.gpxfill(
points, maxdist=args.distance, filldist=args.filldist
)
except Exception:
sys.exit(traceback.format_exc())
s = gpx_out.to_xml()
print(s)
if __name__ == "__main__":
main()