Closed heikkilevanto closed 1 year ago
Yay, I have the first geolocation guess working. Done in the UI, so I can redo it at intervals, when I move.
My home computer gets its location somewhat wrong, so if it looks at a phone-generated location, it concludes I am at Fermentoren. Will need to use multiple data points, at least for home.
Seems to work, after I had coded since coords for home. Would be nice if it could show the distance to the guessed location after the name. Just have to filter out out before saving in the file.
Calculating the distance in meters. Not using the location if over 1 km away. Let's see how precise this thing is. Need more locations in the database , but they will come.
Still need to get some reasonable event to see if I have moved since the latest position update.
Added a simple timer to check the location once a minute. Could not get the watchLocation to work with long enough intervals, it always updated within a few seconds. I trust my phone will throttle the timer when the display is off, or I am looking at some other page.
I think this is basically done.
Once we have geolocation data (#236) in the database, we need to figure out when and how to use it for guessing the location. Here is one possible way:
Prefill the location field with a leading space, as in issue #59. If that space is there when posting a new record, check geolocation, and fill in the new location if we have moved. If the space is missing, it is a location I have entered by hand (or by clicking on a bars list), and then we trust that location, and save the geolocation for it. Of course, if the location is completely empty, we guess first from geolocation, and then from the most recent location.