Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Sven Greiner
gis-praxis-2
Commits
7ed7b69e
Commit
7ed7b69e
authored
Dec 04, 2014
by
Sven Greiner
Browse files
Fix wrong recalculation of slope and speed
Also use a copy for dp and recalculation
parent
7277a368
Changes
1
Hide whitespace changes
Inline
Side-by-side
simplify.py
View file @
7ed7b69e
...
...
@@ -4,6 +4,7 @@ from matplotlib.pyplot import plot, show
from
pylab
import
polyfit
,
polyval
from
tkFileDialog
import
askopenfilename
from
math
import
pi
,
sin
,
sqrt
,
cos
,
atan
,
fabs
import
copy
#-------------------------------------------------------------------------------
...
...
@@ -38,7 +39,8 @@ class Point:
@
staticmethod
def
speed
(
p1
,
p2
):
return
p2
.
segmentlength
/
(
p2
.
time
-
p1
.
time
)
# don't use segmentlength, it might be outdated. distance is accumulated during loading of the track
return
(
p2
.
distance
-
p1
.
distance
)
/
(
p2
.
time
-
p1
.
time
)
@
staticmethod
def
vspeed
(
p1
,
p2
):
...
...
@@ -46,7 +48,8 @@ class Point:
@
staticmethod
def
slope
(
p1
,
p2
):
return
(
p2
.
elevation
-
p1
.
elevation
)
/
p2
.
segmentlength
# don't use segmentlength, it might be outdated. distance is accumulated during loading of the track
return
(
p2
.
elevation
-
p1
.
elevation
)
/
(
p2
.
distance
-
p1
.
distance
)
def
distanceTo
(
self
,
point
):
return
Point
.
distance
(
self
,
point
)
...
...
@@ -169,7 +172,7 @@ if __name__ == "__main__":
shapename
=
"result.shp"
track
=
parseTrack
(
xml
.
dom
.
minidom
.
parse
(
gpxname
))
simplified
=
dp
(
track
,
"distance"
,
"elevation"
,
5
)
simplified
=
dp
(
copy
.
deepcopy
(
track
)
,
"distance"
,
"elevation"
,
5
)
recalculateTrack
(
simplified
)
printTrack
(
simplified
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment