From f466ba81e08d702b4ff64f718f05ab9223d8546d Mon Sep 17 00:00:00 2001 From: typebrook Date: Wed, 19 Feb 2020 17:23:29 +0800 Subject: update --- scripts/gpx/check_gpx.py | 85 ------------------------------------------------ 1 file changed, 85 deletions(-) delete mode 100755 scripts/gpx/check_gpx.py (limited to 'scripts/gpx/check_gpx.py') diff --git a/scripts/gpx/check_gpx.py b/scripts/gpx/check_gpx.py deleted file mode 100755 index 10be97c..0000000 --- a/scripts/gpx/check_gpx.py +++ /dev/null @@ -1,85 +0,0 @@ -#!/usr/bin/env python3 - -import sys -import os -import argparse -import copy -import fileinput -from osgeo import ogr -import osr -import urllib.parse - -def rewrite_gpx(filename): - for line in fileinput.input(filename, inplace=True): - if fileinput.isfirstline() and "'" in line: - line = '' - if fileinput.filelineno() == 2 and "version" not in line: - line = line.replace('= threshold: - if not flag: - print(f'{filename} has problem, the following urls shows the points with distance far from {threshold}m:') - print() - flag = True - if add_prefix: - dir = os.path.dirname(filename) - if dir: - dir += '/' - os.rename(filename, f'{dir}invalid_{os.path.basename(filename)}') - - geojson = '{{"type": "LineString", "coordinates": [[{}, {}], [{}, {}]]}}'.format( - geom1.GetX(), geom1.GetY(), - geom2.GetX(), geom2.GetY() - ) - encoded = urllib.parse.quote(geojson) - print('http://geojson.io/#data=data:application/json,{}'.format(encoded)) - print() - else: - break - trkpt = nextTrkpt - -def main(argv): - parser = argparse.ArgumentParser() - parser.add_argument('file', help="you can add multiple gpx files at the same time", nargs='+') - parser.add_argument("-i", help="add prefix to invalid files", action="store_true") - parser.add_argument("-d", help="distance of tolerance(m), 100 by default", dest="distance", default=100) - args = parser.parse_args() - for file in args.file: - check_valid(file, float(args.distance), args.i) - -if __name__ == '__main__': - main(sys.argv) -- cgit v1.2.3-70-g09d2