When using the Epiphany browser in Linux with libwebkit2gtk (v2.28.3) and the geoclue2 library with a website like openstreetmap.org or maps.google.com the accuracy is very low at around 25km or "city" level. Geoclue ends up using only IP-based location, which is intended to give a city level of accuracy. According to the source code of Source/WebKit/UIProcess/geoclue/GeoclueGeolocationProvider.cpp geoclue will only be instructed to provide greater accuracy with cell phone tower location, wifi, bluetooth beacons and even GPS if the enableHighAccuracy position option is enabled.
Websites like Open Street Map or Google Maps do not use the enableHighAccuracy position options for simple location, which not very useful with only a city level of accuracy. They appear to assume that at least a street level of accuracy could be given without enabling a GPS on the device.
The MDN reference on the HTML Geolocation API points out GPS as a differentiating factor for using enableHighAccuracy: https://developer.mozilla.org/en-US/docs/Web/API/PositionOptions/enableHighAccuracy
In terms of geoclue, street level accuracy can be achieved without GPS using the presence of nearby cell phone towers, wifi endpoints and bluetooth low energy beacons. But, these require the street level setting. Otherwise, it's just the IP address based lookup.
Changing GeoclueGeoLocationProvider.cpp to use GeoclueAccuracySteetLevel (6) as the default could be a more reasonable tradeoff of accuracy for performance and might give a better experience for Linux users.
Created attachment 405266 [details]
Comment on attachment 405266 [details]
View in context: https://bugs.webkit.org/attachment.cgi?id=405266&action=review
> unsigned accuracy = m_isHighAccuracyEnabled ? 8 : 4;
You have only changed the comment, I guess this should be:
unsigned accuracy = m_isHighAccuracyEnabled ? 8 : 6;
(In reply to Carlos Garcia Campos from comment #2)
> Comment on attachment 405266 [details]
> View in context:
> > Source/WebKit/UIProcess/geoclue/GeoclueGeolocationProvider.cpp:244
> > unsigned accuracy = m_isHighAccuracyEnabled ? 8 : 4;
> You have only changed the comment, I guess this should be:
> unsigned accuracy = m_isHighAccuracyEnabled ? 8 : 6;
Indeed, I'll post an updated patch 🤦️
Created attachment 405268 [details]
Committed r264920: <https://trac.webkit.org/changeset/264920>
All reviewed patches have been landed. Closing bug and clearing flags on attachment 405268 [details].