-
Notifications
You must be signed in to change notification settings - Fork 542
Description
I would like to propose adding coarse GPS locations.
To make it least effort, I'd suggest the following:
In GPS settings add an option "coarse" and rename "on" to "exact".
Whenever the device is using the GPS location, it will calculate and round the lon/lat coordinate to a precision which will effectively cause a worldwide "grid" of approximately 5x5km cells (at equator), up to 5x8km cells (near poles).
I used ChatGPT to create such a calculation code:
#include <math.h>
#define GPS_COARSE_GRID_DEG 0.05
#define GPS_COARSE_MIN_FACTOR 0.7
static inline double lat_factor(double lat)
{
double f = 1.0 - 0.2 * (fabs(lat) / 90.0); // linear approximation
return (f < GPS_COARSE_MIN_FACTOR ) ? GPS_COARSE_MIN_FACTOR : f;
}
double snap_lat(double lat)
{
return round(lat / GPS_COARSE_GRID_DEG ) * GPS_COARSE_GRID_DEG ;
}
double snap_lon(double lon, double lat)
{
double step = GPS_COARSE_GRID_DEG / lat_factor(lat);
return round(lon / step) * step;
}
I made this simple on purpose. Of course, there is more and nicer options but I think we should stick to the basics and keep it simple.
//Edit: Maybe we should also add a hysteresis. The Location should only update, when the device has actually moved 500m (on the exact location) or more. This prevents jumping if it is physically at a cell border.