Setting geolocation manually

Hello, I would like to set my geolocation manually and not from wifi network.

From what I understand, the location is managed by geoclue, but there is no option to set directly lat/lon coordinates. So I have to use gpsd, and more precisely gpsfake to read a false nmea frame. I can create an nmea frame, that’s easy. But I have difficulties to understand how gpsfake work and how to make geoclue use it ?

If I try a simple gpsfake -1 location.nmea, it seems ok, but if I open gnome-map for example, it still indicate my internet-based position.

Can you bring me some help ?

This might give you some ideas, like disabling sources in the config file:

I already found it. But as you see, the topic finish by « I am not having success with this. I am getting the error above. »

From my side I tried to edit the config file. Not sure about what should be the perfect configuration as my file doesn’t excatly look like the file in the link you posted.

The sudo systemctl enable --now geoclue line doesn’t work:

The unit files have no installation config (WantedBy=, RequiredBy=, Also=,
Alias= settings in the [Install] section, and DefaultInstance= for template
units). This means they are not meant to be enabled using systemctl.
Possible reasons for having this kind of units are:
* A unit may be statically enabled by being symlinked from another unit's
  .wants/ or .requires/ directory.
* A unit's purpose may be to act as a helper for some other unit which has
  a requirement dependency on it.
* A unit may be started when needed via activation (socket, path, timer,
  D-Bus, udev, scripted systemctl call, ...).
* In case of template units, the unit is meant to be enabled with some
  instance name specified.

And to be honest I am not really sure about what this command is supposed to do.
I tried a sudo systemctl start geoclue instead. No answer from the terminal.

The sudo gpsfake --cycle 4 --clientinit='?WATCH={"enable":true,"json":true}' --pipe --slow -W 0 location.nmea | gpsd --foreground "tcp://" command seems to do something. But if I open gnome-maps, I see no effects.

Actually I found very few information on internet. That’s very surprising.

You need a VPN to change that…



I think you didn’t really understand what I am trying to do.

A VPN will change my internet-based position, not the fact that geoclue use my internet-based position rather than my gpsd-based position.
If you want to change the datetime of your PC, you just tell your pc to use the date set manually, or change your timezone. You don’t pay for being able to synchronize your clock with a server which compute the date in a Roman calendar to lie to your PC. How would I do if the VPN is not at the position I want for exemple ?

What I want is not to spoof my IP and the position of my connection. I just want, when an application ask my PC to tell its position, my PC to answer the coordinates I decided. The true ones if I want, other ones if I don’t. If this application try to locate my pc by its own, this is another problem.

So, as geoclue doesn’t allow to change coordinates as I can change the clock of my PC (why? That’s seems to me so basic!), the only solution I found (tell me if this is not the best one) is to tell geoclue I use a gnss receiver and to use gpsfake to simulate this receiver. Ok, for the theory.

Now, how can I achieve that? The documentation of gpsfake and gpsd are clearly destined to somebody who already understand how it work (it is just a brief description of what it can do and a reminder of possible options and parameters) and when I do a research on google, 90% of the links just reproduce the man page of gpsd/gpsfake and the 10% left are people asking the same question than me without finding any answer, like in the link posted by Yochanan. No working examples, no tutorials.

So, does somebody know how to make geoclue use the coordinates I want ?

1 Like