Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Assume we have GPS coordinates, simplified as coordinate triples ( 7 , 5 , 1 9 ) , each Write functions as follows distanceVertical (
Assume we have GPS coordinates, simplified as coordinate triples each Write functions as follows
distanceVerticalgpstrack function
Statistics of tests passing
Function distance Horizontal gps track Statistics of tests passing
Should calculate and return the horizontal distance traveled in meters
Function Plan GPSTrack
Statistics of tests passing
The function should return the predicted walking time in minutes; it does not need to be rounded see above for calculation basis
function calcspeed gpstrack
Statistics of tests passing
Function breakTimegpstrack maxdelta
Statistics of tests passing
Function numberBreaksgpstrack maxdelta, minseconds
Statistics of tests passing
This function should count all pauses that are at least minseconds long and return this number.
Function smoothgpstrack weights
Statistics of tests passing
Should return a new gps track that is calculated from what was passed by smoothing with the weights passed.
weights do not have to be passed and should be by default.
Only filters with length are used ie current point and one before and after
Function speedDifferencegpstrack weightsA, weightsB
Statistics of tests passing
AThe weights should have default values, namely unsmoothed ie weights for weightsA and averaging for weightsB.specifying the x y and z coordinates of a point. To simplify, we assume the earth is flat, xy indicate the location and z the height. The coordinates are absolute and are given in meters.
The GPS path describes that the path led m to the east.
Furthermore, the following assumptions apply:
A point is recorded every seconds.
Points ignore the curvature of the earth.
Point entries are in meters.
A point always has three coordinates xyz
A GPS track can contain zero, one or more points.
A GPS track only contains valid points so no check for is that a number" or similar necessary
Route calculation
When calculating horizontal movement, the Z coordinate is ignored; when calculating spatial movement, it is included. The vertical movement uses only the Z coordinate.
To calculate horizontal motion and spatial motion, use the direct path Pythagoras For this you need the square root. It is available in the math module import math:
math.sqrtx : Returns the square root of x
Break
A break is assumed when two points do not differ by more than delta in the spatial diagonal ie there is only a slight measurement wobble as movementDelta only applies between two neighboring points. So if points ABC represent a second pause remember one point is taken every two seconds then A differs from B by no more than delta and B differs from C as well. A and C can be more than delta apart!
Calculation of walking time for hikers
Use the following information to calculate walking times:
The following assumptions are made in DIN : A hiker covers in one hour:
meters in ascent.
meters in descent.
kilometers horizontal distance.
The actual walking time for a route can be calculated by halving the smaller of the times calculated for the horizontal and vertical distance and adding it to the larger one.
Example: Difference in altitude: m mm h Horizontal distance: km km km h How it's calculated: h x h h Result: The walking time is therefore hours.
Example : Like example but with a return path: m ascent h and descent ~h m h: h m km Horizontal: h Result: h times h m h m or h
Filter for smoothing
Measurements of GPS coordinates are naturally subject to measurement fluctuations. This fluctuation is included in the calculation as an extra distance. If we want to avoid this, we can smooth the GPS track by averaging three neighboring values moving average of current, previous and next point At the beginning and end of the track we are one point short, so these points are simply not filtered.
A slightly better version of this smoothing is to use weights, ie the points are not all worth
but for example g So the current point has the strongest weight and contributes the points before and after only contribute
Example:
gpstrack
g
gpstracksmooth
# unfiltered because there is no previous point
# x point
# y point
# z point
# unfiltered because there is no next point
Please note that the x y and z coordinates are processed and weighted independently of each other! So the new x coordinate is just a combination of x coordinates, etc.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started