You Are Here:

Community: Developer Discussion Boards

#1 Old cell ID to location? - 2008-10-29, 22:36

Join Date: Oct 2008
Posts: 29
mango7
Offline
Registered User
Hi,

I am writing an application that uses the cell phone's location data. I have a T-Mobile voice plan, but no data plan. I am using a Nokia with which I can successfully obtain a CellID [location.gsm_location()]. However, I am unable to turn this into a specific location (gps coordinates or an address).

Has anyone been successful in retrieving coordinates with a similar setup (voice plan, no data plan) and could suggest some API that would do this for me? Any suggestions would be much appreciated!

Thanks in advance.
Reply With Quote

#2 Old Re: cell ID to location? - 2008-10-29, 22:56

Join Date: Feb 2008
Posts: 743
Location: Belo Horizonte, Brazil
Send a message via Skype™ to Rafael T.
Rafael T.'s Avatar
Rafael T.
Offline
Forum Nokia Champion
Quote:
Originally Posted by mango7 View Post
Hi,

I am writing an application that uses the cell phone's location data. I have a T-Mobile voice plan, but no data plan. I am using a Nokia with which I can successfully obtain a CellID [location.gsm_location()]. However, I am unable to turn this into a specific location (gps coordinates or an address).

Has anyone been successful in retrieving coordinates with a similar setup (voice plan, no data plan) and could suggest some API that would do this for me? Any suggestions would be much appreciated!

Thanks in advance.
Hi mango7,

Well, I think you can do this. Please take a look at this article, it might help you.


BR,

Rafael.
Last edited by Rafael T. : 2008-10-30 at 01:43.
Reply With Quote

#3 Old Re: cell ID to location? - 2008-10-30, 03:24

Join Date: Feb 2008
Posts: 2,542
Location: Bhavnagar, Gujarat, India
Send a message via Yahoo to gaba88 Send a message via Skype™ to gaba88
gaba88's Avatar
gaba88
Online
Forum Nokia Champion
Hi mango7
The thing goes like this if you want to get the location then you have to use GPS to get the perfect lat/long. You cant map location perfectly using the cellid method.
For more details you can have a look at he MopyMaps example in the mobile python book.

Enjoy pythoning
Gaba88


Gargi Das- http://gargidas.blogsot.com

Forum Nokia Python Wiki


Learn Python at http://mobapps.org/PyS60
Reply With Quote

#4 Old Re: cell ID to location? - 2008-10-30, 04:06

Join Date: Sep 2007
Posts: 395
Location: Bhavnagar
Send a message via Yahoo to james1980
james1980's Avatar
james1980
Offline
Forum Nokia Champion
Quote:
Originally Posted by Rafael T. View Post
Hi mango7,

Well, I think you can do this. Please take a look at this article, it might help you.


BR,

Rafael.
hi ,
The article explain only about getting cell id, mcc, mnc and lac. But using this data you cant get exact location. I think gaba88 is correct, you have to use gps to get exact lat-long.
Bye.


Jajal Mehul
Reply With Quote

#5 Old Re: cell ID to location? - 2008-10-30, 12:09

Join Date: Mar 2008
Posts: 35
Location: Frankfurt, Germany
szallah
Offline
Registered User
@mango7

i once made a script that gathers the lat/lon google-maps assigns to cell-towers. there are far from accurate, but correct within a radius of +/- 2 kilometers... the script also is in use in pynetmony (http://discussion.forum.nokia.com/fo...d.php?t=114522)...
i'll post the script when i'm back from work...

EDIT
here's the quick-and-dirty script. this one doesn't work with PyS60 since there's no urllib2 in PyS60. but it can be done using the the normal urllib and it'll give you a hint how it works...
anyhow, this just works if google has data for the cell-tower you're trying to lookup...
Code:
import urllib2

url = 'http://www.google.com/glm/mmap'
string1 = '000E00000000000000000000000000001B0000000000000000000000030000'
string2 = 'FFFFFFFF00000000'

def make_string(value):
    hex_s = hex(value)[2:]
    return hex_s.zfill(8)

def fetch_latlon(bytestring):
    global url
    user_agent = 'Mozilla/4.0 (compatible; MSIE 5.5; Windows NT)'
    headers = { 'User-Agent' : user_agent }
    req = urllib2.Request(url, bytestring, headers)
    resp = urllib2.urlopen(req)
    response = resp.read().encode('hex')
    return response

def convert_bytestring(response):
    lathex_s = response[14:22]
    lonhex_s = response[22:30]
    lat = float(int(lathex_s,16))/1000000
    lon = float(int(lonhex_s,16))/1000000
    return (lat,lon)

def main(cid,lac,mnc,mcc):
    global string1, string2
    string = string1+make_string(cid)+make_string(lac)+make_string(mnc)+make_string(mcc)+string2
    b_string = string.decode('hex')
    bytes = fetch_latlon(b_string)
    (a,b) = convert_bytestring(bytes)
    print a
    print b

CID = 20465
LAC = 495
MNC = 3
MCC = 262

main(CID,LAC,MNC,MCC)


Python-Stuff I work on @
http://www.daniel-perna.de/Python.htm
Last edited by szallah : 2008-10-30 at 12:57.
Reply With Quote

#6 Old Re: cell ID to location? - 2008-10-30, 19:43

Join Date: Nov 2006
Posts: 501
neil.young
Offline
Super Contributor
You'll find all you need to know here. http://foreverneilyoung.blogspot.com...here-am-i.html

I didn't had a trigger to port my C# sample to python, but I thought I could make it and embed the code into my LocateMe http://discussion.forum.nokia.com/fo...d.php?t=148748

What do you think?
Reply With Quote

#7 Old Re: cell ID to location? - 2008-10-31, 00:02

Join Date: Jun 2008
Posts: 45
maclun123
Offline
Registered User
Hello,

I have found something that may be useful here:

http://blog.jebu.net/2008/07/google-...python-on-s60/

Works very good, ass long as your cell ID is in database.

I have tested it mainly in Denmark, where 90% of towers are accessible. In Poland and Germany it is much worse. I am wondering how it is in different countries. If anyone will be making some tests I will be very much interested in results. You can contact me at maclun@gmail.com.

Maciej
Reply With Quote

#8 Old Question Re: cell ID to location? - 2008-10-31, 00:24

Join Date: Jan 2004
Posts: 368
Location: Helsinki
Send a message via Skype™ to miohtama
miohtama's Avatar
miohtama
Offline
Regular Contributor
Quote:
Originally Posted by maclun123 View Post
Hello,

I have found something that may be useful here:

http://blog.jebu.net/2008/07/google-...python-on-s60/

Works very good, ass long as your cell ID is in database.
What are licensing terms for this data? Google Maps ToS has some limitations regarding its use - you must have it on a HTML page and so on...

Also Yahoo's Fire Eagle is probably offering cell tower database too.


Mikko Ohtamaa
Twinapex Research
http://www.twinapex.com
Reply With Quote

#9 Old Re: cell ID to location? - 2008-10-31, 00:38

Join Date: Nov 2006
Posts: 501
neil.young
Offline
Super Contributor
Simply you are not allowed to use it that way
Reply With Quote

#10 Old Re: cell ID to location? - 2008-10-31, 00:47

Join Date: Nov 2006
Posts: 501
neil.young
Offline
Super Contributor
Quote:
Originally Posted by maclun123 View Post
Hello,

I have found something that may be useful here:

http://blog.jebu.net/2008/07/google-...python-on-s60/

Works very good, ass long as your cell ID is in database.

I have tested it mainly in Denmark, where 90% of towers are accessible. In Poland and Germany it is much worse. I am wondering how it is in different countries. If anyone will be making some tests I will be very much interested in results. You can contact me at maclun@gmail.com.

Maciej
Yeah, this is using an older API version and has a lot of crappy parameters in the request. But basically it seems to be OK, although it doesn't recognize the builtin error reporting field and the HPE field... The latest API is discussed in my blog http://foreverneilyoung.blogspot.com...here-am-i.html). I'm currently rewrite it in Python.

In contrary to your claim the hit rate in Germany is extremely good. The problem: Google is (or at least was last time I used this API) faulty with its handling of UMTS towers. Because Germany is full of 3G towers, you are likely lost, if you ask them for geocodes for UMTS cells. But taken that error into account, you may come to a result. I have blogged in details on this issue, and as far as I can see, the python code doesn't take the UMTS problem into account....

Regards
Reply With Quote

#11 Old Re: cell ID to location? - 2008-10-31, 19:48

Join Date: Mar 2003
Posts: 564
cassioli's Avatar
cassioli
Offline
Super Contributor
www.opencellid.org
Reply With Quote

#12 Old Re: cell ID to location? - 2009-02-22, 22:47

Join Date: Feb 2009
Posts: 1
vonamann
Offline
Registered User
Hey, szallah, this script gives wrong coordinates if they are negative (e. g. try MCC=310, MNC=410, LAC=11946, CID=6559), must me something like this:
Code:
def convert_bytestring(response):
    lathex_s = response[14:22]
    lonhex_s = response[22:30]
    negative_threshold = 0x7fffffff
    lat = int(lathex_s,16)
    lon = int(lonhex_s,16)
    if lat > negative_threshold:
      lat = -(1 + negative_threshold - (lat & negative_threshold))
    if lon > negative_threshold:
      lon = -(1 + negative_threshold - (lon & negative_threshold))
    lat = float(lat)/1000000
    lon = float(lon)/1000000
    return (lat,lon)
Quote:
Originally Posted by szallah View Post
@mango7

i once made a script that gathers the lat/lon google-maps assigns to cell-towers. there are far from accurate, but correct within a radius of +/- 2 kilometers... the script also is in use in pynetmony (http://discussion.forum.nokia.com/fo...d.php?t=114522)...
i'll post the script when i'm back from work...

EDIT
here's the quick-and-dirty script. this one doesn't work with PyS60 since there's no urllib2 in PyS60. but it can be done using the the normal urllib and it'll give you a hint how it works...
anyhow, this just works if google has data for the cell-tower you're trying to lookup...
Code:
import urllib2

url = 'http://www.google.com/glm/mmap'
string1 = '000E00000000000000000000000000001B0000000000000000000000030000'
string2 = 'FFFFFFFF00000000'

def make_string(value):
    hex_s = hex(value)[2:]
    return hex_s.zfill(8)

def fetch_latlon(bytestring):
    global url
    user_agent = 'Mozilla/4.0 (compatible; MSIE 5.5; Windows NT)'
    headers = { 'User-Agent' : user_agent }
    req = urllib2.Request(url, bytestring, headers)
    resp = urllib2.urlopen(req)
    response = resp.read().encode('hex')
    return response

def convert_bytestring(response):
    lathex_s = response[14:22]
    lonhex_s = response[22:30]
    lat = float(int(lathex_s,16))/1000000
    lon = float(int(lonhex_s,16))/1000000
    return (lat,lon)

def main(cid,lac,mnc,mcc):
    global string1, string2
    string = string1+make_string(cid)+make_string(lac)+make_string(mnc)+make_string(mcc)+string2
    b_string = string.decode('hex')
    bytes = fetch_latlon(b_string)
    (a,b) = convert_bytestring(bytes)
    print a
    print b

CID = 20465
LAC = 495
MNC = 3
MCC = 262

main(CID,LAC,MNC,MCC)
Reply With Quote
Reply « Previous Thread | Next Thread »
Display Modes
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules

You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump
Similar Threads
Thread Thread Starter Forum Replies Last Post
Location Estimation based on Multiple BTS Cell IDs hU Symbian Networking & Messaging 3 2009-06-09 16:57
cell id and location area code vvsnaresh General Symbian C++ 5 2009-01-04 13:55
Cell information-Cell id & location string mayankkedia Symbian Networking & Messaging 5 2008-08-06 18:33
Location Estimation based on Multiple BTS Cell IDs hU General Symbian C++ 0 2007-10-07 07:42
cell id - location gheese Symbian Networking & Messaging 0 2003-07-24 11:18

Rate This

 
Bookmark this page: DeliciousDiggFacebookGoogleYahooStumbleUponRedditDiigoTechnocratiTwitter  Share this page Share this page Print this Page Print this page Invite a friend Invite a friend
京ICP备05048969号    Email Newsletters Press Terms & Conditions Privacy Policy Sitemap Contact Us © 2009 Nokia 
RDF Facets: qdcZidentifierQSxhttpE3aE2fE2fdiscussionE2eforumE2enokiaE2ecomhttpE3aE2fE2fdiscussionE2eforumE2enokiaE2ecomE2fforumE2fshowthreadE2ephpE3ftE3d81449X qdcZtypeQUqfnZE45E78cludedFromGeneralE4cistingsQ qdcZtypeQUqfntypeZCommunityContentQ qdcZtypeQUqfntypeZE44iscussionQ qdcZtypeQUqfntypeZE44iscussionContentQ qdcZtypeQUqfntypeZE52esourceQ qdcZtypeQUqfntypeZWebpageQ qdcZtypeQUqmarsZManagedE52esourceQ qdcZtypeQUqwebZInformationE52esourceQ qdcZtypeQUqwebZPageQ qdcZtypeQUqwebZE52esourceQ qdcZtypeQUqrdfsZE52esourceQ qfnZtopicQUqfnTopicZpythonQ qfnZtypeQUqfntypeZCommunityContentQ qfnZtypeQUqfntypeZE44iscussionQ qfnZtypeQUqfntypeZE44iscussionContentQ qfnZtypeQUqfntypeZE52esourceQ qfnZtypeQUqfntypeZWebpageQ qfnZuserE5ftagQSxpythonX qmarsZlanguageQUxhttpE3aE2fE2fswE2enokiaE2ecomE2flanguageE2d1E2fenX qrdfZtypeQUqfnZE45E78cludedFromGeneralE4cistingsQ qrdfZtypeQUqfntypeZCommunityContentQ qrdfZtypeQUqfntypeZE44iscussionQ qrdfZtypeQUqfntypeZE44iscussionContentQ qrdfZtypeQUqfntypeZE52esourceQ qrdfZtypeQUqfntypeZWebpageQ qrdfZtypeQUqmarsZManagedE52esourceQ qrdfZtypeQUqwebZInformationE52esourceQ qrdfZtypeQUqwebZPageQ qrdfZtypeQUqwebZE52esourceQ qrdfZtypeQUqrdfsZE52esourceQ