maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Applications (https://talk.maemo.org/forumdisplay.php?f=41)
-   -   [Announce] Snuggle : Geolocation using CellID and Google APIs (https://talk.maemo.org/showthread.php?t=72497)

Saturn 2011-04-25 10:54

[Announce] Snuggle : Geolocation using CellID and Google APIs
 
The Snuggle application (http://maemo.org/packages/view/snuggle/) uses the cell tower information to locate the geolocation coordinates.
It captures the CellID parameters (available from the connected GSM network) and by using Google APIs translates those to locate your position in a map.


In detail:
  • The application makes use of the CellID parameters extracted using the dbus call (seen it here, thanks BluesLee) and
  • Two Google APIs to lookup in the online cellid db, locate your position and show it in a map.

Usage description:

The user interface shows four buttons;
  • The "CellID" button, makes a dbus call to get the CellID information (requires a GSM connection).
  • The "Coordinates" button, makes an access to (the hidden) mmap Google API to get the latitude and longitude coordinates of the connected cell tower (requires a network connection).
  • The "Image" button, grabs from google maps an image of your location and opens a new window for the user to see it (requires a network connection).
  • The "Browser" button, opens the browser on googlemaps with the location coordinates found (requires a network connection).

When I get some time will create a wiki to give additional information on the usage, settings and implications.

The application is in extras-devel at the moment. Feel free to post comments and ideas for additions as well as any ideas for a better name :)


Future Plans:

Primary objective was to give a quick access at the location present.
In my opinion this has been accomplished in the version at extras-testing.

Next version (which is running on my device and needs some more work to be ready for upload) has in addition a daemon in the background logging silently the cells the device connects continuously. This part is ready and has been running for more than 2 weeks in my device without any significant power consumption.
All data are stored in a SQL DB. A configurable tracker will be available that grabs from a Google API the geolocation data for the Cell IDs recorded and updates the DB automatically on selected network connections and date/time settings.

An additional panel allows the user to grab from another Google API the locations between two dates and creates a KML file that can be directly uploaded in google maps and show the path/places visited. This part is missing the date/time selector but the rest of the code is ready.

CrckMc 2011-04-25 11:28

Re: [Announce] Geolocation using CellID and Google APIs
 
testing right now and nothing happens when i press "Coordinates"
"CellID" worked fine. How long does it take normally?

Saturn 2011-04-25 11:36

Re: [Announce] Geolocation using CellID and Google APIs
 
Quote:

Originally Posted by CrckMc (Post 994958)
testing right now and nothing happens when i press "Coordinates"
"CellID" worked fine. How long does it take normally?

In the next version will add some information banners on what is happening and if it wasn't possible to make a location match.

Do you have a network connection active?

If yes, can you run it from xterm and pm me with the messages you get?

Code:

/opt/locatefromcell/Locate_From_Cell

jd4200 2011-04-25 11:48

Re: [Announce] Geolocation using CellID and Google APIs
 
Tesing it, and it all seems to work fine for me.
Thanks!

Screeny:
http://img821.imageshack.us/img821/2...1042512443.png

CrckMc 2011-04-25 11:52

Re: [Announce] Geolocation using CellID and Google APIs
 
Code:

$ /opt/locatefromcell/Locate_From_Cell
262 3 4666 37920
262 3 4666 61000
en
Traceback (most recent call last):
  File "/opt/locatefromcell/locatefromcell.py", line 210, in doGetLocation
  File "/opt/locatefromcell/locatefromcell.py", line 276, in get_location_by_cell
  File "/usr/lib/python2.5/struct.py", line 87, in unpack
    return o.unpack(s)
struct.error: unpack requires a string argument of length 25

this is the output in xterm and yes i have a network connection.

Alfred 2011-04-25 12:01

Re: [Announce] Geolocation using CellID and Google APIs
 
Works really great and fast as ****. Thanks a lot, although there are some bugs. No portrait mode.

nicholes 2011-04-25 12:27

Re: [Announce] Geolocation using CellID and Google APIs
 
Quote:

Originally Posted by CrckMc (Post 994958)
testing right now and nothing happens when i press "Coordinates"
"CellID" worked fine. How long does it take normally?

same happened with me but i solved it
just go to settings>phone>network and change network mode by GSM and it worked for me! it did not work for me on 3G mode!!!!!

Saturn 2011-04-25 14:33

Re: [Announce] Geolocation using CellID and Google APIs
 
Uploaded a new version (1.2-1) with better info and some small new features.

Changelog:
  • Added several information banners to show actions/failures.
  • Added an Edit Mode in the menu to manually enter the information.
  • Added some UI settings for correct display.

Saturn 2011-04-25 14:40

Re: [Announce] Geolocation using CellID and Google APIs
 
Quote:

Originally Posted by CrckMc (Post 994969)
Code:

$ /opt/locatefromcell/Locate_From_Cell
262 3 4666 37920
262 3 4666 61000
en
Traceback (most recent call last):
  File "/opt/locatefromcell/locatefromcell.py", line 210, in doGetLocation
  File "/opt/locatefromcell/locatefromcell.py", line 276, in get_location_by_cell
  File "/usr/lib/python2.5/struct.py", line 87, in unpack
    return o.unpack(s)
struct.error: unpack requires a string argument of length 25

this is the output in xterm and yes i have a network connection.

The cell tower info you show don't follow the expected values (in specific the Local Area Code).
Maybe I need to add some padding for cases like this in the code but I don't know really what is needed yet.

Thanks for the fail case.

Saturn 2011-04-25 15:05

Re: [Announce] Geolocation using CellID and Google APIs
 
Quote:

Originally Posted by Alfred (Post 994972)
Works really great and fast as ****. Thanks a lot, although there are some bugs. No portrait mode.

Thanks!
Yes it's fast (especially if the network is wifi) since the data are not much.
Including the image grabbed, it is still < 100 kB.

About the portrait mode, The application responds to the movement of the device (check the About window that works nicely). For the main window I haven't found any info on how to instruct the Qt Designer to produce a layout that works on both modes. my question is similar to that made here for example: http://maemo.org/community/maemo-dev...bfae7bae1bae1/

Any help appreciated.

Saturn 2011-04-25 21:08

Re: [Announce] Geolocation using CellID and Google APIs
 
OK! I found a (fancy) name that I like better and re-uploaded:

http://maemo.org/packages/view/snuggle/

Remove the old application with the following (to cleanup all traces):
Code:

sudo gainroot
apt-get remove --purge locatefromcell
rm -rf /opt/locatefromcell
rm -rf /home/user/.locatefromcell/


Saturn 2011-04-30 17:45

Re: [Announce] Snuggle : Geolocation using CellID and Google APIs
 
2 Attachment(s)
Uploaded new version 1.6-1

Changes:
  • Added logging of all queries in /home/user/.snuggle/.
  • Major modification in the UI - portrait/landscape support.
  • Update in the icon.
  • Cleanup, commenting of code.

handaxe 2011-05-05 13:22

Re: [Announce] Snuggle : Geolocation using CellID and Google APIs
 
Latest update does not acquire coords although cell info is present. Only tested while in one place - ie no cell changes.

Saturn 2011-05-05 19:56

Re: [Announce] Snuggle : Geolocation using CellID and Google APIs
 
Quote:

Originally Posted by handaxe (Post 1000611)
Latest update does not acquire coords although cell info is present. Only tested while in one place - ie no cell changes.

Hi, it works after the next update. Will put it in my list to make a query also in the first toggle. Thanks for mentioning it.

In general:
Haven't announced yet the new devel version (1.8-1) - didn't have much time really. :)

It's kind of a rewrite in logic and functionality. I'm not gonna work on it more for the next couple of weeks but uploaded for those interested on where I'm heading.

My ambitious plan is to make a daemon and a small DB to store the cell and location info on every change of the cell tower connection. The impact in battery will be minimal since I managed to make use of the DBus triggers (already in this version).

The UI will be to view live the info, extract data between two points in time (for example in kml format) and plot them in a map.

I have thought of many end uses but my favourite is to have a tracklog of all the places I visited during a trip and check where I've been last week Saturday night! All these are not quite possible now (that is using the GPS) without a heavy impact in the battery.

handaxe 2011-05-05 20:54

Re: [Announce] Snuggle : Geolocation using CellID and Google APIs
 
Brilliant stuff - something I would love to have cos as you write, a GPS app doing the same would hammer the battery.

I know nothing of cell tech - can one only get mast info from a network on which you are registered? What info do other provider's transmitters send?

Saturn 2011-05-05 21:26

Re: [Announce] Snuggle : Geolocation using CellID and Google APIs
 
Quote:

Originally Posted by handaxe (Post 1000865)
Brilliant stuff - something I would love to have cos as you write, a GPS app doing the same would hammer the battery.

Thanks. Time is limited but will try..

Quote:

I know nothing of cell tech - can one only get mast info from a network on which you are registered? What info do other provider's transmitters send?
You could get info of all available networks around but this will cost in battery. Here, the idea is to use the one that the device is already connected/uses. This is a function it already needs to do so that it is reachable in the GSM network for the phone function and the device weaks up when necessary.

The extra 'cost' is to get notified and log this change everytime it happens. Using DBus (which is designed/optimised for efficiency) already minimises the impact of the first part of the action needed.

Cheers

handaxe 2011-05-05 22:31

Re: [Announce] Snuggle : Geolocation using CellID and Google APIs
 
Quote:

Originally Posted by Saturn (Post 1000879)
You could get info of all available networks around but this will cost in battery. Here, the idea is to use the one that the device is already connected/uses.

I understand precisely: I asked because I had been looking for a prog that would canvass surrounding masts and provide location info on them. Use case: an umts/hsdpa modem on a provider different to that of my n900 and I wanted to know where the mast was for best placement of the modem in a built up environment.

Anyhow, thanks v much

Saturn 2011-05-06 00:33

Re: [Announce] Snuggle : Geolocation using CellID and Google APIs
 
Quote:

Originally Posted by handaxe (Post 1000902)
I understand precisely: I asked because I had been looking for a prog that would canvass surrounding masts and provide location info on them. Use case: an umts/hsdpa modem on a provider different to that of my n900 and I wanted to know where the mast was for best placement of the modem in a built up environment.

Anyhow, thanks v much

Ohh. now I understand. Don't know of a program to do this. Nevertheless, when I was searching for info read that most services provide a preload feature.

e.g. look here: http://www.opencellid.org/api and specifically the "get in area" feature.

It's a free service but not as up-to-date as others.

Saturn 2011-05-07 16:31

Re: [Announce] Snuggle : Geolocation using CellID and Google APIs
 
NOTE: Update in devel (1.9-1) with a small change to improve the UI.

Basically what handaxe reported earlier

debernardis 2011-05-07 17:43

Re: [Announce] Snuggle : Geolocation using CellID and Google APIs
 
Hi Saturn,
I guess this logs the single cell you're connected.
Could it be possible to make it more accurate by calculating a triangulation between the nearest cells, and estimating the radius of uncertainty, like google maps on android uses to do?

Saturn 2011-05-07 18:08

Re: [Announce] Snuggle : Geolocation using CellID and Google APIs
 
Quote:

Originally Posted by debernardis (Post 1001798)
Hi Saturn,
I guess this logs the single cell you're connected.
Could it be possible to make it more accurate by calculating a triangulation between the nearest cells, and estimating the radius of uncertainty, like google maps on android uses to do?

Hi Debernardis,

When I get some time will check if DBus reports anything on the other (the non connected) cells. It seems many to be asking for this. If I find something maybe I can add it as an advanced method in the UI.

As I said, for the time being, my objective is to have something very light for the battery so that I can have it always on and logging in the background.

Thanks for the suggestion.

handaxe 2011-05-07 21:01

Re: [Announce] Snuggle : Geolocation using CellID and Google APIs
 
Would be a powerful tool for eg. smscon. (The new version never appeared - hijack alert!!!! so ....:)

Saturn 2011-05-07 22:26

Re: [Announce] Snuggle : Geolocation using CellID and Google APIs
 
Quote:

Originally Posted by handaxe (Post 1001831)
Would be a powerful tool for eg. smscon. (The new version never appeared - hijack alert!!!! so ....:)

I will for sure have a command to sent the last location for SMSCON. We have already discussed it briefly with digitalvoid.

On the delay, it is always more complex when two developers, but mostly because the app is way too complex. We are sitting on the new version for some time now - most probably we'll post something at the end of the month.

Saturn 2011-05-09 18:31

Re: [Announce] Snuggle : Geolocation using CellID and Google APIs
 
Interesting thread on getting all CellIDs around:

http://talk.maemo.org/showthread.php?t=72907

seridyan 2011-05-10 04:17

Re: [Announce] Snuggle : Geolocation using CellID and Google APIs
 
It is not working for me! I don't get the coordinates when I press "Track on" nor when I check "Get Coordinates". When I activate "Edit mode" and press Image or Browser nothing happens.

Using the terminal to run the program I realize that "Image" and "browser" won't work because there are no values in the coordinates.

So what might be happening?

handaxe 2011-05-10 09:07

Re: [Announce] Snuggle : Geolocation using CellID and Google APIs
 
Quote:

Originally Posted by seridyan (Post 1003190)
It is not working for me! I don't get the coordinates when I press "Track on" nor when I check "Get Coordinates". When I activate "Edit mode" and press Image or Browser nothing happens.

Using the terminal to run the program I realize that "Image" and "browser" won't work because there are no values in the coordinates.

So what might be happening?

To clarify: no coords BUT you do get values for the cell id etc? I ask because that sounds like the situation that existed in the version before the current one. Current version is 1.9-1

Saturn 2011-05-10 18:21

Re: [Announce] Snuggle : Geolocation using CellID and Google APIs
 
@seridyan

The database is not complete (it is estimated to have in the order of 200,000 cells registered) and I have seen also places that the Google API would not return a location. In my case, moving ~100 metres further the new cell ID I got returned a location.

Did you try on different locations?

seridyan 2011-05-10 18:33

Re: [Announce] Snuggle : Geolocation using CellID and Google APIs
 
Well, I suppose the problem is that I live in Venezuela and there are no registered cells.

Btw, there is a little bug regarding the version. I have installed 1.9-1 but in "about" appears as if i have 1.8-1.

@handaxe: yes, It recovers all the cell info.

Saturn 2011-05-10 18:49

Re: [Announce] Snuggle : Geolocation using CellID and Google APIs
 
Quote:

Originally Posted by seridyan (Post 1003586)
Well, I suppose the problem is that I live in Venezuela and there are no registered cells.

Unlikely for the whole country. I see plenty of MCC=734, i.e. Venezuela
but it is possible for your operator. What's your MNC?

Quote:

Btw, there is a little bug regarding the version. I have installed 1.9-1 but in "about" appears as if i have 1.8-1.
Then you must have 1.8-1.

What you get if you do in xterm:
Code:

dpkg -l snuggle

seridyan 2011-05-10 19:01

Re: [Announce] Snuggle : Geolocation using CellID and Google APIs
 
Quote:

Unlikely for the whole country. I see plenty of MCC=734, i.e. Venezuela
but it is possible for your operator. What's your MNC?
MNC = 2

Quote:

Then you must have 1.8-1.
I have 1.9-1

handaxe 2011-05-10 20:03

Re: [Announce] Snuggle : Geolocation using CellID and Google APIs
 
Quote:

Originally Posted by seridyan (Post 1003600)
I have 1.9-1

Strange, as my version displays 1.9-1 in the about window.....

Dragoss91 2011-05-10 20:26

Re: [Announce] Snuggle : Geolocation using CellID and Google APIs
 
Could I see coords of other people with this application ?

handaxe 2011-05-10 20:52

Re: [Announce] Snuggle : Geolocation using CellID and Google APIs
 
Quote:

Originally Posted by Dragoss91 (Post 1003671)
Could I see coords of other people with this application ?

No, not directly. If they sent to you the info for the cell they were on, say by sms, you could enter that information using the edit function and derive the coords.

sr00t 2011-06-08 18:48

Re: [Announce] Snuggle : Geolocation using CellID and Google APIs
 
What an effective app. It's really fast. Kudos for you!

Just one question:
When I press Browser or Image, the result of my location vary by 4 or 5 blocks of distance.
What happens? Because the coordinates are the same in the app.

Saturn 2011-06-09 09:59

Re: [Announce] Snuggle : Geolocation using CellID and Google APIs
 
Quote:

Originally Posted by sr00t (Post 1025254)
What an effective app. It's really fast. Kudos for you!

Thanks for the nice words.

My primary objective was to give me a quick access to the place I was at the time.
In my opinion this has been accomplished in the version at extras-testing.

Next version (which is running on my device only and needs some more work to be ready for upload) has in addition a daemon in the background logging silently the cells the device connects continuously. This part is ready and has been running for more than 2 weeks in my device without any significant power consumption.

A new panel allows the user to grab from another api the locations between two dates and creates a KML file that can be directly uploaded in google maps and show the path/places visited. This part is missing the date/time selector but the rest of the code is ready.

Quote:

Just one question:
When I press Browser or Image, the result of my location vary by 4 or 5 blocks of distance.
What happens? Because the coordinates are the same in the app.
That is strange and can only attributed in differences between Google APIs. In my case, both show the same exactly location.

If you like you can send me an example location and I'll try to investigate further.

thp 2011-06-09 10:07

Re: [Announce] Snuggle : Geolocation using CellID and Google APIs
 
Cool idea! Could you cache the returned values, so that in case one doesn't have an internet connection, but is again in a place that he/she has been before, the information can be returned immediately? (not having looked at the data that is sent, this might not be possible, depending on how fine-grained the input data is)

It would be great for this application to create an "offline positioning database" based on all the cell information. Also, can't you just record all the cellIDs while a user is running around in offline mode, then (if the user wants to) geocode all these IDs when the user is online the next time and save all this in the database for later retrieval?

Saturn 2011-06-09 10:59

Re: [Announce] Snuggle : Geolocation using CellID and Google APIs
 
Quote:

Originally Posted by thp (Post 1025685)
Cool idea! Could you cache the returned values, so that in case one doesn't have an internet connection, but is again in a place that he/she has been before, the information can be returned immediately? (not having looked at the data that is sent, this might not be possible, depending on how fine-grained the input data is)

Could be done but it would mean creating a db etc. Eventually would be another map application. I will invest some time in finding a way to call the already available ovi maps on the location found. I know it is possible, but haven't found the time to search for the appropriate dbus call.

Quote:

It would be great for this application to create an "offline positioning database" based on all the cell information. Also, can't you just record all the cellIDs while a user is running around in offline mode, then (if the user wants to) geocode all these IDs when the user is online the next time and save all this in the database for later retrieval?
This is basically what the next version will bring. A daemon will log all the cell ids it gets connected and later when wifi connection is available it will allow to get the geolocations visited.

In future, I would like to create a db to store all data and maybe add a tracker that updates automatically the geolocation data on selected network connections and date/time settings.

My knowledge is limited in the sql database creation and that makes it even more interesting for me. Unfortunately, I haven't found a good tutorial on sql and python yet.

If you or anyone else wants to participate feel free to join.

thp 2011-06-09 11:06

Re: [Announce] Snuggle : Geolocation using CellID and Google APIs
 
Quote:

Originally Posted by Saturn (Post 1025709)
Unfortunately, I haven't found a good tutorial on sql and python yet.

Python provides the sqlite3 module which makes it easy to create a single-file database. If you want it even more comfortable, feel free to use minidb which is a minimalistic data store for simple Python objects that uses SQLite3 as the backend, but exposes a nicer API (while still allowing to access the underlying DB if you choose to).

Plus, Stack Overflow has an answer to your question: comprehensive beginner's tutorial for python and sqlite?

Julien_2006 2011-12-19 19:50

Re: [Announce] Snuggle : Geolocation using CellID and Google APIs
 
Hello there !

any news about using snuggle with smscon ?
it could be great if your friends could send you a sms with eg the word "cell" and in return get the picture and/or browser link send by mail/sms

Alfred 2011-12-19 20:22

Re: [Announce] Snuggle : Geolocation using CellID and Google APIs
 
Quote:

Originally Posted by Julien_2006 (Post 1139622)
Hello there !

any news about using snuggle with smscon ?
it could be great if your friends could send you a sms with eg the word "cell" and in return get the picture and/or browser link send by mail/sms

Have you read smscon wiki? there is already command for gps data and a map on google


All times are GMT. The time now is 05:14.

vBulletin® Version 3.8.8