Closed hupe13 closed 1 year ago
Found, for example: paceRange: [0, 15],
But the scale isn't right.
I understand that it is to ignore extreme values. But how do I specify? Found, for example: paceRange: [0, 15],
Exactly, to be passed as an option to the L.Control.Elevation
object, in case you should find all the options inside each src/handlers file.
For instance:
But the scale isn't right. (leaflet-elevation-2.2.7j = min-speed-0)
Maybe it works better that way: https://github.com/Raruto/leaflet-elevation/pull/219/commits/b290536b4470548b4ccd76fab411ab363a26a528
No, it don't work. I think that (for my application) it is not so important. It must work with every track. And if it depends on it, e.g. with a run, it is correct. Thank you very much.
But you should change avgspeed and avgpace to consider track.time and track.distance. Then the measurement errors do not have such a large effect. For example:
value: (track, unit) => _.formatTime( Math.abs((track.time / track.distance) / opts.paceFactor) *60) + ' ' + unit,
value: (track, unit) => Math.round(track.distance / track.time * opts.timeFactor * opts.speedFactor * 1000 * 100) / 100 + ' ' + unit,
No, it don't work. I think that (for my application) it is not so important. It must work with every track. And if it depends on it, e.g. with a run, it is correct. Thank you very much.
Forgive me @hupe13, but I don't think I understood, https://github.com/Raruto/leaflet-elevation/commit/b290536b4470548b4ccd76fab411ab363a26a528 it doesn't fix that or it works correctly but did you realize those are options you don't need?
But you should change
avgspeed
andavgpace
to consider track.time and track.distance. Then the measurement errors do not have such a large effect.
Well, the ideal would still be to share with friends the cleanest tracks possible 😄 (as general rule, this should only be intended as a visualization library, for specific fixes it is best to lean on an external software or library that can help fix them before sharing the track with everyone).
Anyway, as a first step, I advise you to experiment by coding a custom handler, you can also override the default ones, eg: Altitude
, Speed
, Pace
, ...
See the example below to get an idea:
Doing so you should be able to check the quality of your changes in detail on your plugin at first, and possibly later see them integrated into the main library (keep in mind that for my current use of this library length
, altitude
and time
are more than sufficient information, everything else has been nothing more than experiments that have added up over the years ...)
As usual thanks for your patient and cooperation, Raruto
Well, the ideal would still be to share with friends the cleanest tracks possible
That's what I mean by:
It must work with every track.
Therefore nothing needs to be changed because of this, except perhaps the calculation of the average values.
Therefore nothing needs to be changed because of this, except perhaps the calculation of the average values.
value: (track, unit) => _.formatTime( Math.abs((track.time / track.distance) / opts.paceFactor) *60) + ' ' + unit,
value: (track, unit) => Math.round(track.distance / track.time * opts.timeFactor * opts.speedFactor * 1000 * 100) / 100 + ' ' + unit,
@hupe13 as regards the changes relating to this library, it's not so nice that average values (or any other computed value) are modified within the summary instead of correctly calculated in a previous step. Anyway, here too I suggest you proceed first with a monkey patch, so you can test your plugin sooner and faster than me.
To figure out how to do it take a look to https://github.com/Raruto/leaflet-elevation/pull/216#issuecomment-1296356245, and proceed as usual, more or less it should be something like this:
// Save a reference of default "L.Control.Elevation" (for later use)
const elevationProto = L.extend({}, L.Control.Elevation.prototype);
// Override default "_registerHandler" behaviour.
L.Control.Elevation.include({
// ref: https://github.com/Raruto/leaflet-elevation/blob/c58250e7c20d52490aa3a50b611dbb282ff00a57/src/control.js#L1063-L1128
_registerHandler: function(props) {
const _ = L.Control.Elevation.Utils;
let opts = this.options;
if (typeof props === 'object') {
switch(props.name) {
case 'speed':
props.summary.avgspeed.value = (track, unit) => Math.round(track.distance / track.time * opts.timeFactor * opts.speedFactor * 1000 * 100) / 100 + ' ' + unit,
break;
case 'pace':
props.summary.avgpace.value = (track, unit) => _.formatTime( Math.abs((track.time / track.distance) / opts.paceFactor) *60) + ' ' + unit,
// case 'acceleration':
// ...
// case 'altitude':
// ...
// case 'slope':
// ...
// ...
}
}
elevationProto._registerHandler.apply(this, [props]);
}
});
// Proceed as usual
var controlElevation = L.control.elevation(opts.elevationControl.options);
controlElevation.load(opts.elevationControl.url);
Have a nice day, Raruto
I have done so. Thank you very much.
Hi Raruto,
it is not a issue, it is a question. How should I use options like
clampRange
ordeltaMax
?https://github.com/Raruto/leaflet-elevation/blob/b59171879df04f853f32c859cb93f9a86c16ab52/src/control.js#L1045-L1048
https://github.com/Raruto/leaflet-elevation/blob/b59171879df04f853f32c859cb93f9a86c16ab52/src/control.js#L1040-L1043
I understand that it is to ignore extreme values. But how do I specify? For example, here is a big extreme pace over 18000 min/km! (leaflet-elevation-2.2.7j = min-speed-0)
Thank you very much.