Raruto / leaflet-elevation

Leaflet plugin that allows to add elevation profiles using d3js
GNU General Public License v3.0
255 stars 85 forks source link

Add speed and acceleration graph #80

Closed velocat closed 4 years ago

Raruto commented 4 years ago

Hi velocat,

I updated your code a bit to make it work (eg. when the slope graph is disabled). Let me know if anything is missing.

Have a nice day, Raruto

velocat commented 4 years ago

It looks great :)

Although I consider Range to be redundant, since the speed cannot be negative. But maybe you are right, someone may need speed in a certain interval. ))

I would also add average speed in motion, in addition to average speed, since it is often that it is important. To do this, you need to set the initial value, from which it is considered that there was a movement)))

To this you can additionally get the time of movement / stops.

This is how I see it: (but there is an error with time formatting) https://github.com/velocat/leaflet-elevation/commits/Movie-Speed%26-Time/src

Raruto commented 4 years ago

I would also add average speed in motion, in addition to average speed, since it is often that it is important. To do this, you need to set the initial value, from which it is considered that there was a movement)))

I'm not sure this can be the most reliable strategy (what could happen in such a situation? https://stackoverflow.com/questions/9994128/strategies-to-detect-and-delete-cluttering-aggregations-of-gps-points)

velocat commented 4 years ago

I'm not sure this can be the most reliable strategy

I read in one place that they tried to build an algorithm using logic: This filtering algorithm is based on taking into account linear accelerations and angular velocities. Simply put, no vehicle has an acceleration greater than 1G at 0 km/h. The higher the speed, the lower the possible acceleration.

The same principle applies for angular speeds - nothing can turn 90 degrees in 1 second at 100 km/h.

Raruto commented 4 years ago

there is an error with time formatting https://github.com/velocat/leaflet-elevation/commits/Movie-Speed%26-Time/src

This happens due to the Date.toLocaleDateString function.

But what you need would be more like the Intl.DurationFormat object (unfortunately only the Intl.RelativeTimeFormat is implemented)

I read in one place that they tried to build an algorithm using logic: This filtering algorithm is based on taking into account linear accelerations and angular velocities.

Perhaps i think it would be better to directly rely on a specific third-party (server-side?) library to calculate theese advanced kind of statistics, after that you can easily build your custom summary.

The leaflet-gpx library allows you to set the max_point_interval parameter for "motion" detection (even if I don't fully understand why...)