Closed hupe13 closed 1 year ago
Maybe I found a solution. Change https://github.com/Raruto/leaflet-elevation/blob/3ee745d71ed172979b7bfe0ff52f7c63214d3c04/src/utils.js#L135-L136 to
export const iMin = (iVal, min = +Infinity, idx = 1) => (idx > 1) ? (iVal < min ? iVal : min) : min;
export const iAvg = (iVal, avg = 0, idx = 1) => (iVal && idx > 1) ? (( iVal + avg * (idx - 1))) / idx : avg * (idx - 1) / idx;
I will made a pull request, when I'm ready.
Hi hupe, could you explain in detail the reason for this bug? (I don't have much time to understand this code..)
Even better, if you can write some tests that show the correctness of what you say:
You can see this in your example for the 2016 Santa Rosa Marathon. When you run you don't pause, you always move. But the minimum speed is 0. I have to recap my tests, please be patient. (It may be that the runner took a break during the marathon, but I have another gpx file for a run, there was definitely no break.)
When you run you don't pause, you always move. But the minimum speed is 0. I have to recap my tests, please be patient.
You should check the instant t = 0
-> speed = dx / dt = 0
Patch released in version 2.2.8
Hi Raruto,
I have found that the minimum speed is always 0. The cause seems to be here: https://github.com/Raruto/leaflet-elevation/blob/3ee745d71ed172979b7bfe0ff52f7c63214d3c04/src/handlers/speed.js#L18-L22
See your example.
I tried different things, but I can't solve the problem. Can you help me please?
Thank you very much.