×

Discussion Board

Page 1 of 2 12 LastLast
Results 1 to 15 of 17
  1. #1
    Registered User
    Join Date
    Oct 2008
    Posts
    29

    cell ID to location?

    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.

  2. #2
    Super Contributor
    Join Date
    Feb 2008
    Location
    Belo Horizonte, Brazil
    Posts
    744

    Re: cell ID to location?

    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 00:43.

  3. #3
    Nokia Developer Champion
    Join Date
    Feb 2008
    Location
    Ahmedabad, Gujarat, India
    Posts
    3,852

    Re: cell ID to location?

    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

  4. #4
    Nokia Developer Champion
    Join Date
    Sep 2007
    Location
    Bhavnagar
    Posts
    928

    Re: cell ID to location?

    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

  5. #5
    Registered User
    Join Date
    Mar 2008
    Location
    Frankfurt, Germany
    Posts
    35

    Re: cell ID to location?

    @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)
    Last edited by szallah; 2008-10-30 at 11:57.
    Python-Stuff I work on @
    http://www.daniel-perna.de/Python.htm

  6. #6
    Registered User
    Join Date
    Nov 2006
    Posts
    568

    Re: cell ID to location?

    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?

  7. #7
    Registered User
    Join Date
    Jun 2008
    Posts
    45

    Re: cell ID to location?

    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

  8. #8
    Regular Contributor
    Join Date
    Jan 2004
    Location
    Helsinki
    Posts
    376

    Question Re: cell ID to location?

    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

    http://mfabrik.com
    http://blog.mfabrik.com

  9. #9
    Registered User
    Join Date
    Nov 2006
    Posts
    568

    Re: cell ID to location?

    Simply you are not allowed to use it that way

  10. #10
    Registered User
    Join Date
    Nov 2006
    Posts
    568

    Re: cell ID to location?

    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

  11. #11
    Super Contributor
    Join Date
    Mar 2003
    Posts
    580

    Re: cell ID to location?


  12. #12
    Registered User
    Join Date
    Feb 2009
    Posts
    1

    Re: cell ID to location?

    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)

  13. #13
    Registered User
    Join Date
    Sep 2011
    Posts
    29

    Re: cell ID to location?

    Hi...when i use the above code..I get the lat and long of other country i'e Germany..what changes do i need to do in the code so that it can display the current location's lat and long..??

    Please do reply ASAP.

    Regards

  14. #14
    Registered User
    Join Date
    Nov 2006
    Posts
    568

    Re: cell ID to location?

    You need to change the values for mnc, mcc, cid and lac. Those should reflect values of a cell tower near to you.

  15. #15
    Registered User
    Join Date
    Sep 2011
    Posts
    29

    Re: cell ID to location?

    What values of mcc,mnc,cid and lac should be given to get the surrounding values of cell tower...???

Similar Threads

  1. Location Estimation based on Multiple BTS Cell IDs
    By hU in forum Symbian Networking & Messaging (Closed)
    Replies: 3
    Last Post: 2009-06-09, 15:57
  2. cell id and location area code
    By vvsnaresh in forum Symbian
    Replies: 5
    Last Post: 2009-01-04, 12:55
  3. Cell information-Cell id & location string
    By mayankkedia in forum Symbian Networking & Messaging (Closed)
    Replies: 5
    Last Post: 2008-08-06, 17:33
  4. Replies: 0
    Last Post: 2007-10-07, 06:42
  5. cell id - location
    By gheese in forum Symbian Networking & Messaging (Closed)
    Replies: 0
    Last Post: 2003-07-24, 10:18

Posting Permissions

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