You are not logged in.
Is there a utility to get the current GPS location from the command line? A quick search says `geo` will do it, but that appears to come with the android dev tools, which I'd rather not install right now. The reason I want to do this is to avoid hard-coding my coordinates in a call to `redshift`.
Offline
Wouldn't that necessarily require a GPS device?
In Zen they say: If something is boring after two minutes, try it for four. If still boring, try it for eight, sixteen, thirty-two, and so on. Eventually one discovers that it's not boring at all but very interesting.
~ John Cage
Offline
Approximating location can also be done with the IP address. The relevant packages in the repos is geoip and geoip-database. But I think that it is limited to simply determining what country your are in. In the US, that doesn't really tell you too much in terms of positioning.
Offline
Approximating location can also be done with the IP address.
I'm aware of that but the OP was asking for a GPS tool.
In Zen they say: If something is boring after two minutes, try it for four. If still boring, try it for eight, sixteen, thirty-two, and so on. Eventually one discovers that it's not boring at all but very interesting.
~ John Cage
Offline
WonderWoofy wrote:Approximating location can also be done with the IP address.
I'm aware of that but the OP was asking for a GPS tool.
Yeah, this is true. But there was also the reference to redshift as being the reason for trying to find such a tool, and that is what I was really trying to address. Sorry about the confusion, as I should prbably have specified that in my post. Also, I realized that it is not geoip that redshift works with, but geoclue.
Offline
The most common tool on linux is gpsd. It can talk to many different devices and present the data in a unified format. To get the raw data in a terminal, run gpspipe.
| alias CUTF='LANG=en_XX.UTF-8@POSIX ' |
Offline
Thanks! I'll look into it.
Offline
Bash script found across the internet:
#!/bin/bash
date
#gpsdata=$( gpspipe -w -n 10 | grep -m 1 lon )
gpsdata=$( gpspipe -w | grep -m 1 TPV )
lat=$( echo "$gpsdata" | jsawk 'return this.lat' )
lon=$( echo "$gpsdata" | jsawk 'return this.lon' )
alt=$( echo "$gpsdata" | jsawk 'return this.alt' )
dt=$( echo "$gpsdata" | jsawk 'return this.time' )
echo "$dt"
echo "You are here: $lat, $lon at $alt"
Just modify it so that redshift -l $lat:$lon ...
Having a devil of a time trying to get that to work in awesomewm.
I may have to CONSOLE you about your usage of ridiculously easy graphical interfaces...
Look ma, no mouse.
Offline
Hmm.. `gpspipe` gives me:
gpspipe: could not connect to gpsd localhost:2947, Unknown error -6(-6)
And `gpsd` gives me:
gpsd:ERROR: can't run with neither control socket nor devices
Do I need to be root for these applications? Alternatively, could I maybe just grab the timezone from /etc/localtime and use that? (though I guess that doesn't get close enough on longitude...)
Offline
Hmm.. `gpspipe` gives me:
gpspipe: could not connect to gpsd localhost:2947, Unknown error -6(-6)
And `gpsd` gives me:
gpsd:ERROR: can't run with neither control socket nor devices
Do I need to be root for these applications? Alternatively, could I maybe just grab the timezone from /etc/localtime and use that? (though I guess that doesn't get close enough on longitude...)
You have to start gpsd from systemctl. And you can plug/unplug gps devices at will, so it can be enabled in systemctl whether or not an actual gps is always available.
I may have to CONSOLE you about your usage of ridiculously easy graphical interfaces...
Look ma, no mouse.
Offline