Changeset 2d2eb0d in OpenWorkouts-current for ow/views/workout.py
- Timestamp:
- Jan 23, 2019, 2:07:26 PM (5 years ago)
- Branches:
- current, feature/docs, master
- Children:
- 4dcf28d
- Parents:
- 5cbc4a0 (diff), c6219ed (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
ow/views/workout.py
r5cbc4a0 r2d2eb0d 214 214 content_disposition='attachment; filename="%s"' % gpx_slug, 215 215 body_file=context.tracking_file.open()) 216 217 218 @view_config( 219 context=Workout, 220 name='map', 221 renderer='ow:templates/workout-map.pt') 222 def workout_map(context, request): 223 """ 224 Render a page that has only a map with tracking info 225 """ 226 start_point = {} 227 if context.has_gpx: 228 with context.tracking_file.open() as gpx_file: 229 gpx_contents = gpx_file.read() 230 gpx_contents = gpx_contents.decode('utf-8') 231 gpx = gpxpy.parse(gpx_contents) 232 if gpx.tracks: 233 track = gpx.tracks[0] 234 center_point = track.get_center() 235 start_point = {'latitude': center_point.latitude, 236 'longitude': center_point.longitude, 237 'elevation': center_point.elevation} 238 return {'start_point': start_point}
Note: See TracChangeset
for help on using the changeset viewer.