ryangriggs / GoogleTimelineMapper

Map and Browse Google Timeline Semantic Location History data
Apache License 2.0
13 stars 1 forks source link

#Enhancement Trace road in between the points #5

Open MueJosh opened 1 month ago

MueJosh commented 1 month ago

I have something like this in mind, but the problem for that is - it can’t be done locally…

To trace tracks/roads/whatever between points there needs to be a API for routing. One great option would be OSRM, it works on a raspberry pi or inside a docker container or whatever server that’s not running windows.

Before I even attempt something like this, the program needs a function to add tracks (e.g. from “connect sequentially”) and export them in the kml and/or gpx file.

That was my initial idea (visualisation of routes without tracks and just some waypoints) and that’s why I’m pushing my features here ;) // My mothers phone didn’t track all routes (see first issue I’ve written here)

I know- The idea of this repo is to run it locally, I prefer this too(!) but my idea above can’t be done in a different way, or maybe it does? (Any ideas to do this locally are appreciated!)

while wringing my code (/editing code from THIS repo) and researching functions etc., I found some sites that do just that (paid or with datalogging or both at the same time..) but considering how good this code is working I can’t stop now. Even when this feature won’t come here I’ll try to get it running on a Pi (though I won’t open the Pi / OSRM api to the world because of safety and my ISP wouldn’t approve any more traffic)

ryangriggs commented 1 month ago

Hi @MueJosh, my first thought is that we don't have data to indicate the route which was actually taken between two waypoints, thus we would only be guessing if we chose, for example, the shortest route. This wouldn't necessarily represent the traveller's actual movements. It may be more helpful to number the waypoints in some way, or possibly give the user the ability to traverse them sequentially (i.e. an animation that moves the map view from one waypoint to the next)... You can already do this when sorting the waypoints by date, then clicking them in order.

Keeping the data local (basically serverless) is an important feature of the app, for privacy, and also for the ability to freely publish the app without paying for costly cloud servers to do the processing. I wonder if this processing may be able to run locally in the browser instead of offloading to a Pi or other linux machine. The user's computer in many cases would have equivalent or better processing power than a Pi, and we even have browser support for Python nowadays. (although it may not be very performant.) I suppose the other hang-up is the user needing to download a large chunk of road network data in order to process the waypoint connections, but again this could likely be accomplished in the browser without a need to upload to a server.

Your thoughts appreciated!

MueJosh commented 4 days ago

Hey @ryangriggs ,

We are definitely just guessing, but for points that are relatively close to each other, there is a high probability that the shortest route is the correct one.

Ive got osrm running (docker on windows) and it definitely works great! For points that are hundreds kilometers away (e.g. airplane) it's definitely wrong. But it looks great (lol)

Understandable! It's definitely NOT possible (at least not with osrm and the whole map of europe; and/or my knowledge of programming) to run all of it in a browser. Getting osrm to work took multiple hours of computing (assigned 20 cpu cores, 64gb ram + 120gb swap; yes- on my local machine but not everyone has the time and compute power ...) and now the container + data occupies ~80gb of storage. (South America + Europe) I gave up to get it running on a pi ;) (Pi5; 8gb ram and 500gb nvme)

Now everything works, I've changed html.index to sent a request for connecting points to localhost.5000 (container with osrm running). It takes around 1second to calculate 600 routes (thousands of kilometers!) and map them as polylines on the map (still inside the browser). I've added a function so it export the routes as a single track via kml and GPX. Someone could make some money by this but thats nothing for me- I have what i wanted... (knowledge and wisdom lol; mostly knowing whats possible and the ability to brag about it xD- don't take this seriously)

I've just realised that they are also doing this: geofabrik routing service

The map of europe (45gb) and each country: geofabrik Europe

A server is not needed but a powerful PC... and time.

I'll upload the code as soon as i have time for it (and it still needs some touchups here and there), though probably no one will use it that way.