Answered step by step
Verified Expert Solution
Link Copied!

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 (7,5,19), each Write functions as follows
distanceVertical(gpstrack) function
Statistics 1 of 1 tests passing
Function distance Horizontal (gps track) Statistics 1 of 1 tests passing
Should calculate and return the horizontal distance traveled (in meters).
Function Plan (GPSTrack)
Statistics 1 of 1 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 1 of 1 tests passing
Function breakTime(gpstrack, maxdelta)
Statistics 1 of 1 tests passing
Function numberBreaks(gpstrack, maxdelta, minseconds)
Statistics of 1 tests passing
This function should count all pauses that are at least minseconds long and return this number.
Function smooth(gpstrack, weights)
Statistics 1 of 1 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 0.33 by default.
Only filters with length 3 are used (i.e. current point and one before and after).
Function speedDifference(gpstrack, weightsA, weightsB)
Statistics 1 of 1 tests passing
AThe weights should have default values, namely unsmoothed (i.e. weights ,1,0) for weightsA and averaging (.33,...) for weightsB.specifying the x, y, and z coordinates of a point. To simplify, we assume the earth is flat, x,y indicate the location and z the height. The coordinates are absolute and are given in meters.
The GPS path [(0,0,0),(5,0,0,),(10,0,0)] describes that the path led 10m to the east.
Furthermore, the following assumptions apply:
A point is recorded every 2 seconds.
Points ignore the curvature of the earth.
Point entries are in meters.
A point always has three coordinates (x,y,z).
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.sqrt(x) : 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 (i.e. there is only a slight measurement wobble as movement).Delta only applies between two neighboring points. So if points A-B-C represent a 4 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 33466: A hiker covers in one hour:
300 meters in ascent.
500 meters in descent.
4 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: 900m 900m/300m ->3 h Horizontal distance: 8 km 8 km/4 km ->2 h How it's calculated: 2.0 h x 0.5+3.0 h =4.0 h Result: The walking time is therefore 4 hours.
Example 2: Like example 1 but with a return path: 900m ascent (3h) and descent (~1h 45m (1.8h)): 4h 45m 16km Horizontal: 4h Result: 4h \times 0.5+4h 45m =6h 45m (or 6.8h)
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, i.e. the points are not all worth
1
3
3
1
but for example g =[0.2,0.6,0.2]. So the current point has the strongest weight and contributes 60%(0.6), the points before and after only contribute 20%(0.2).
Example:
gpstrack =[[1,1,1],[4,2,1],[10,0,2]]
g =[0.2,0.6,0.2]
gpstracksmooth =[
[1,1,1], # unfiltered because there is no previous point
[0.2*1+0.6*4+0.2*10, # x point 2
0.2*1+0.6*2+0.2*0, # y point 2
0.2*1+0.6*1+0.2*2],# z point 2
[10,0,2] # 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.
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Professional Microsoft SQL Server 2014 Administration

Authors: Adam Jorgensen, Bradley Ball

1st Edition

111885926X, 9781118859261

More Books

Students also viewed these Databases questions

Question

How were the HR functions affected by Hurricane Rita?

Answered: 1 week ago

Question

What information might lead you to choose working for the company?

Answered: 1 week ago

Question

Which environment factor(s) did Hurricane Rita affect? Discuss.

Answered: 1 week ago