Skip to content

Commit 6b0f24a

Browse files
committed
approximation for gpxelevations
1 parent 892f95d commit 6b0f24a

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

gpxelevations

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ parser = mod_argparse.ArgumentParser(
1414

1515
parser.add_argument('-o', '--overwrite', action='store_true', default=False,
1616
help='Overwrite existing elevations (otherwise will add elevations only where not yet presetn)')
17+
parser.add_argument('-p', '--approximate', action='store_true', default=False,
18+
help='Overwrite existing elevations (otherwise will add elevations only where not yet presetn)')
1719
parser.add_argument('-c', '--calculate', action='store_true', default=False,
1820
help='Calculate elevations (but don\'t change the GPX file')
1921
parser.add_argument('-f', '--file', default=None, type=str,
@@ -32,12 +34,12 @@ geo_elevation_data = mod_srtm.get_data()
3234

3335
def update_point(point, args):
3436
if args.calculate:
35-
calculated = geo_elevation_data.get_elevation(point.latitude, point.longitude)
37+
calculated = geo_elevation_data.get_elevation(point.latitude, point.longitude, approximate=args.approximate)
3638
print '(%s, %s) currently: %s, calculated: %s' % (point.latitude, point.longitude, point.elevation, calculated)
3739
elif args.overwrite or point.elevation == None:
38-
calculated = geo_elevation_data.get_elevation(point.latitude, point.longitude)
40+
calculated = geo_elevation_data.get_elevation(point.latitude, point.longitude, approximate=args.approximate)
41+
print '(%s, %s) was %s changed to %s' % (point.latitude, point.longitude, point.elevation, calculated)
3942
point.elevation = calculated
40-
print '(%s, %s) -> %s' % (point.latitude, point.longitude, calculated)
4143
else:
4244
print '(%s, %s) left with %s' % (point.latitude, point.longitude, point.elevation)
4345

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy