bilde2910 / Hauk

Open-source realtime location sharing
Apache License 2.0
583 stars 58 forks source link

Feature request : Show the full track from the begining when a user connect afterwards #176

Closed 2Belette closed 3 years ago

2Belette commented 3 years ago

Hi,

I got almost 90% of my users who gave me the same feedback so I think it would be useful to share it.

Most of my users click to the link when they see it (sharing it to SMS / Element / Email) and they may connect a couple minutes/hours after my share link is active / me already walking/running for a couple of minutes/hours.

When you connect you start seeing the red line from the time you connect but you don't see the track from the beginning, it would be nice to have the option in preferences to keep the historical data to present to the user when they connect afterwards, or even when GPS/GSM connectivity is lost.

Thanks for the great software!

licaon-kter commented 3 years ago

You can set the number of past points in config

Make this bigger: https://github.com/bilde2910/Hauk/blob/master/backend-php/include/config-sample.php#L265 ;)

2Belette commented 3 years ago

@licaon-kter many thanks ! Argh I forgot to take a look on config... do you think about "max_shown_pts or maybe "max_cached_pts" I am still trying to understand the last one..

bilde2910 commented 3 years ago

max_cached_pts is the number of coordinate pairs that the server stores in memory. Whenever someone opens a Hauk link, the server sends that much location history to initialize the map. The default is 3, which means that only the last 3 points are stored, which in turn means that with a share interval of one second, only the last three seconds of data is usually stored before it's erased.

max_shown_pts is the number of points that are drawn on the map client-side. This number is equal to or greater than max_cached_pts. With the default config, when a user loads the map, the last three locations are displayed, and the "tail" of movement history will grow until it reaches 100 past locations, before the end of the tail starts getting erased. If the user then reloads the map, only the last three (max_cached_pts) will be drawn on the map again, and whichever other 97 points were on the map before the reload are now lost (well, until the tail builds back up).

You can ensure your users get more historical data initially by increasing max_cached_pts. You should also increase max_shown_pts to at least match it, because it doesn't make sense to send more data than the map is willing to display. Keep in mind that setting very high numbers may affect the map performance (sluggish map panning etc.) but I don't know exactly where a reasonable limit goes for most devices.

For example, if you set max_cached_pts to 5000, and you share your location with an interval of 3 seconds, the tail on the map will show your location for the past 15000 seconds = 4 hours and 10 minutes.

Hope this can help :-)

2Belette commented 3 years ago

@bilde2910 many thanks it is very clear! I will test with 5000 and increase it if I don't see any performance issue... very cool parameters I think it is exactly what I was missing