8

At the command line, how do I get the current location that geoclue2 would report?

There's no man page or bin/ executable in my Arch package.

redshift (which uses geoclue2) is reporting my location as:

7.98 98.37

But google maps gives me:

9.749160, 99.975484

Is there any way to configure what sources geoclue2 uses to get better accuracy?

Most google geoclue2 searches bring up redshift which isn't too helpful :(

4
  • why geoclue2 only and for what use you need it? Nov 5, 2018 at 11:40
  • @RuiFRibeiro I currently use it for redshift. The geoclue doco implies that they should be accurate, so I'm trying to work out why it's not. Also geoclue is the only Linux choice for Mozilla Location Service if not using KDE
    – Tom Hale
    Nov 5, 2018 at 11:55
  • For applicational use, I prefer the MaxMind databases/geoIP command/APIs. The API itself seems to be fast enough, I have of people feeding the coordinates in the DB to redis. Nov 5, 2018 at 12:15
  • @RuiFRibeiro Thanks. I'm now using the Google Geolocation API (see my answer)
    – Tom Hale
    Nov 6, 2018 at 5:45

3 Answers 3

5

On Ubuntu 20.04 LTS

Installation:

$ sudo apt install geoclue-2-demo

Execution:

$ /usr/libexec/geoclue-2.0/demos/where-am-i

… and see the scary magic unfold.

A .desktop launcher file is also provided at /usr/share/applications/geoclue-where-am-i.desktop

Sources and allowed applications are configured in /etc/geoclue/geoclue.conf

2

To actually answer the question, the geoclue-2.0 Ubuntu package provides a binary at /usr/lib/geoclue-2.0/demos/where-am-i, which will print the location GeoClue reports, as well as the accuracy:

$ /usr/lib/geoclue-2.0/demos/where-am-i
Client object: /org/freedesktop/GeoClue2/Client/12

New location:
Latitude:    1.234000°
Longitude:   1.234000°
Accuracy:    25000.000000 meters
Timestamp:   Sun 21 Jun 2020 17:54:37 BST (1592758477 seconds since the Epoch)
0
1

On Arch, after installing geoclue the geoclue.service has to be started. For me, accessing the location on Google Maps from within qutebrowser worked. Nothing in the config had to be changed. I did have to wait several minutes, restart the browser, and reopen the page though.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.