How to access geolocation from command line?
I'd like to get access to my position and gps data from the command line - surely that must be possible?
We have moved to a new Sailfish OS Forum. Please start new discussions there.
I'd like to get access to my position and gps data from the command line - surely that must be possible?
when maps is running, following command gives you lat,long
dbus-send --session --type=method_call --print-reply \
--dest=org.freedesktop.Geoclue.Providers.Here \
/org/freedesktop/Geoclue/Providers/Here \
org.freedesktop.Geoclue.Position.GetPosition
something like
method return sender=:1.918 -> dest=:1.979 reply_serial=2
int32 3
int32 1421521856
double 61.2342
double 23.5406
double nan
struct {
int32 5
double 135.2
double nan
}
maybe there is way to enable it also from command line, but didn't yet figure it out.
(Couldn't find a way to send a{sv} aka QVariantMap from cli)
Made small commandline app called position (also a learning project).
Altough i requested updates every second, it updates every 30 sec (?)
sources: https://github.com/kimmoli/position-cli
You can find readybuilt binary from mer obs (link valid for version 0.0.3)
While developing GPSInfo I was also seeing this "problem" about the interval, it seems to be something like a minimum. While there is no GPS fix, you will get updates containing the last known location in a lower interval, but if the GPS is available you will get updates as soon as they are available.
balta ( 2015-01-19 09:46:58 +0200 )editYep, also noticed the same thing when working on modRana. Until it gets a real GPS fix, it uses some alternative approximate method to get a preliminary fix every 30 seconds.
This alternative method is most probably WiFi an/or mobile cell positioning using a remote service over the Internet - you send it the WiFi AP MAC addresses/mobile cell ids and it tells you your approximate coordinates.
And the 30 second interval is mot probably rate limiting so that all the Jollas (and other devices) using the API don't DDoS it out of existence or there could be some usage quotas Jolla bought for the API, etc.
Also given the approximate nature of the coordinates returned (tens of meters in best case, which is still quite good actually), it won't make much sense to run another request sooner, unless you are currently moving.
MartinK ( 2015-01-19 14:10:37 +0200 )editLate answer to the question, but I made a python script that actually starts the gps by itself and prints the gps coordinates. It does not need another application to be running, in contrast to the other answers.
You can get it from here
Posted a howto some months ago which describes an approach based on cell location:
https://together.jolla.com/question/24943/howto-retrieve-gsm-cell-coordinates/
This thread is public, all members of Together.Jolla.Com can read this page.
Asked: 2015-01-17 11:34:38 +0200
Seen: 6,184 times
Last updated: Dec 05 '18
HowTo: Install a chroot for building apps
Can I import my contacts from N9? [answered]
User wants to see certain part of picture as a Lock Screen background [answered]
We want to create our own TOH [answered]
How user can take backups out of device [released]
What is the best maps/navigation application to use on Jolla? [answered]
How to change Ambiences really fast [answered]
Markdown basics [not relevant]