smooth=True parameter in add_elevations() makes the code crash when dealing with a GPX file partially covering areas of the world without SRTM data.
E.g. in small attached example file of ferry route from Iceland to Denmark, part of the route is at latitude > 60° N, where there is no SRTM data available. SRTM data stops at 60° N.
To reproduce, simply use the gpxelevations script in the master branch:
$ gpxelevations --approximate srtmpy.gpx
Traceback (most recent call last):
File "/usr/local/bin/gpxelevations", line 43, in <module>
update_gpx(gpx)
File "/usr/local/bin/gpxelevations", line 38, in update_gpx
geo_elevation_data.add_elevations(gpx, only_missing=not args.overwrite, smooth=args.approximate)
File "/Library/Python/2.7/site-packages/srtm/data.py", line 230, in add_elevations
self._add_sampled_elevations(gpx)
File "/Library/Python/2.7/site-packages/srtm/data.py", line 267, in _add_sampled_elevations
self._add_interval_elevations(gpx, min_interval_length=35)
File "/Library/Python/2.7/site-packages/srtm/data.py", line 263, in _add_interval_elevations
gpx.add_missing_elevations()
File "/Library/Python/2.7/site-packages/gpxpy/gpx.py", line 2494, in add_missing_elevations
add_missing_function=_add)
File "/Library/Python/2.7/site-packages/gpxpy/gpx.py", line 2480, in add_missing_data
track.add_missing_data(get_data_function, add_missing_function)
File "/Library/Python/2.7/site-packages/gpxpy/gpx.py", line 1662, in add_missing_data
track_segment.add_missing_data(get_data_function, add_missing_function)
File "/Library/Python/2.7/site-packages/gpxpy/gpx.py", line 990, in add_missing_data
distances_ratios)
File "/Library/Python/2.7/site-packages/gpxpy/gpx.py", line 2486, in _add
assert start.elevation is not None
AssertionError
Without the --approximate flag, or with the --overwrite flag, script runs successfully, and will as expected include no elevation attributes for points at latitude > 60°.
smooth=True
parameter inadd_elevations()
makes the code crash when dealing with a GPX file partially covering areas of the world without SRTM data.E.g. in small attached example file of ferry route from Iceland to Denmark, part of the route is at latitude > 60° N, where there is no SRTM data available. SRTM data stops at 60° N.
To reproduce, simply use the
gpxelevations
script in the master branch:Without the
--approximate
flag, or with the--overwrite
flag, script runs successfully, and will as expected include no elevation attributes for points at latitude > 60°.srtmpy.gpx.txt