this post was submitted on 25 Jun 2023
10 points (85.7% liked)

Selfhosted

39939 readers
578 users here now

A place to share alternatives to popular online services that can be self-hosted without giving up privacy or locking you into a service you don't control.

Rules:

  1. Be civil: we're here to support and learn from one another. Insults won't be tolerated. Flame wars are frowned upon.

  2. No spam posting.

  3. Posts have to be centered around self-hosting. There are other communities for discussing hardware or home computing. If it's not obvious why your post topic revolves around selfhosting, please include details to make it clear.

  4. Don't duplicate the full text of your blog or github here. Just post the link for folks to click.

  5. Submission headline should match the article title (don’t cherry-pick information from the title to fit your agenda).

  6. No trolling.

Resources:

Any issues on the community? Report it using the report flag.

Questions? DM the mods!

founded 1 year ago
MODERATORS
10
Selfhosting Location History (discuss.tchncs.de)
submitted 1 year ago* (last edited 1 year ago) by [email protected] to c/selfhosted
 

Hello, I'm looking for a good tool to selfhost some kind of location history similar to Google's one. To have some data I can test the tools with, I merged every of my bicylce and hiking tours to one GPX file containing 7000km worth of travel. Then I tried this tool, but it really lags with so much data and every move and every zoom takes some seconds to load. Next I tried the "Phonetrack" app on my nextcloud instance, but this as well lags and I have to activate every track manually and they are color coded. I really like the connection between the phonetrack app on my Android and the nextcloud app, but I am afraid that I'll eventually run into the same performance problem when I gathered enough data. I've seen that theres OwnTracks, but it seems you have to set up your own server and I don't want to pay extra next to my nextcloud subscription. Do you know of any kind of location history tool I can use that can handle big amounts of data?

EDIT: I now found a solution I'm very happy with: I still use the Phonetrack app with my Nextcloud and komoot to track my biking/hiking tours. I found a python program that downloads all my komoot tours (https://github.com/ThePBone/KomootGPX) in a folder on my Linux Desktop. I also mounted my nextcloud to my Linux filesystem, so I'd have access to the Phonetrack exports. I wrote a Java program that takes all the gpx files and converts them to a JSON file similar to the original Google Location History JSon file. That all happens automatically once in a week with an anacronjob. Finally I use this tool (https://github.com/theopolisme/location-history-visualizer) to visualize all the data. I've not run into performance issues with this unlike with the other apps I tried. I plan to change this program so I don't have to got through the steps with selecting the file, etc. but this is my current implementation that I'm very happy with. Just leave me a message if you need my Java file to achieve the same :)

top 14 comments
sorted by: hot top controversial new old
[–] [email protected] 4 points 1 year ago (1 children)

I'm using PhoneTrack with NextCloud for 24x7 tracking just like Google History.

You just start an activity and just leave it going. It syncs to NextCloud "live".

Battery drain is minimal (much like, say, WireGuard VPN).

[–] [email protected] 1 points 1 year ago (1 children)

The tracking part is great, but I think I'll eventually run into perfomance problems when the files get too big. How long has it been running now/how big is you gpx file? And do you just use one single session or eventually start a new one?

[–] [email protected] 2 points 1 year ago (1 children)

That's a good question. Mine's been running for about 5 months continuously and, as far as I can tell, it's not storing anything locally. You can export the data as a GPX file at any time.

I'm pretty sure it just syncs with NextCloud and the data is stored there.

The app info says it's taking around 35MB of data (not including the app size itself) and I performed an export to GPX and it looks like it exported at least a month's worth of data, if not more... and it was ~436KB.

[–] [email protected] 1 points 1 year ago

ok, thats really not that much. If I keep my settings at power saving mode, I'll be fine. The data I used to test were pretty accurate gpx files with data points every few meters including 100km+ bicycle tours, so no wonder I got performance issues. But still my past Google Location History takeout file is 90MB big (10MB bigger than my huge gpx file), so Google has some way to process that efficiently... But thanks, then I can leave the app on in the background for approximate tracking

[–] suth 3 points 1 year ago

Also interested. I’ve used Home Assistant a few times in the past when I needed to figure out what time I arrived somewhere, and while I was able to find what I needed there’s probably an integration for it that would make it work more like Google’s location history.

[–] sandros 3 points 1 year ago (1 children)

I am interested in this as well. Currently I have nextcloud with Phonetrack, but I would prefer something such simpler with 'less' features that works like G LH.

[–] [email protected] 1 points 1 year ago

Yeah, the problem with PhoneTrack is, that it is (at least I think it is) designed to be a location sharing tool and much less a location history tool.

[–] [email protected] 3 points 1 year ago* (last edited 1 year ago) (1 children)

Unfortunately there are no fantastic options. But it is a three part problem.

  1. Server to collect, store and serve the location data.

  2. App to send the data to the server

  3. ui to visualise the data.

There are some larger collection servers, but nothing that provided the data back in a way that i wanted. I currently use a custom script some created, whic provides a number of API endpoints. I will rustle up the link.

There are a number of apps, I use phonetrack. Defaults to next cloud formants but is easily editable.

The UI is where a lot of this fall down. I have phone always recording location, so tracks is no good for me, I wanted to use something like a heat map. The script I talked about includes a simple heatmap using leaflet and openstreetmaps. This fits my ise case much better, but is still not ideal.

I ultimately want to pre process the data to reduce the size of the data set that gets sent to client, to reduce the lag time. Good luck though, as it is a fun and challenging problem!

(I'll upload some screenshots when off mobile)

https://github.com/gue-ni/location_tracker

[–] [email protected] 2 points 1 year ago (1 children)

I agree, the first two problems are rather easy to solve with phonetrack or any other of the tracking apps like µlogger, Owntracks, Traccar, etc. and nextcloud or the backend you provided. What is the reason that the simple heatmap is not ideal? Does it also lag or are you looking for filters functionality, etc.? The data pre processing must be challenging cause thats the part really seperating the self hosted solutions to Google's one. If one could pre process the data on a nextcloud server and could render it on a map without significant lags, that would be really cool. Maybe I'll try to work on that in the future when I got more advanced in programming.

[–] [email protected] 1 points 1 year ago (1 children)

Yeah, i think my data set is around 14mb when i load it all (and it loads all points to the browser). that is a bit of a loading lag, but once loaded it is ok.

The other issues is when you zoom out, you cannot pan around. you have to do clever scrolling (zoom) in and out to get to where you want.

I think it should be reasonabley easy to do the server side updates, but i cannot javscript front end to save my life!

[–] [email protected] 2 points 1 year ago (1 children)

here is a JS one i tried to build

[–] [email protected] 1 points 1 year ago (1 children)

That looks nice. If you want to share it, I'd totally try it out!

[–] [email protected] 1 points 1 year ago

it is just a server-less javascript implementation (ie, a single html file, plus pre-packaged data).

Ultimately, it used leaflet.js and each square is a square-icon with different opacity. but i think you will find that heatmap plugin to leaflet will provide better performance with less complexity.

Still, i can upload it if you want.

[–] easeKItMAn 1 points 1 year ago

traccar
Nice interface, lot’s of possibilities. You can use cheap tracker, phone app etc.

load more comments
view more: next ›