×

Discussion Board

Results 1 to 11 of 11

Thread: Help on LBS

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

    Help on LBS

    HI List,
    I Need a bit help on the following.I just got soem cose from forum to test the LBS functionality from Google MAP.The author of the code has hard coded the following values

    cellId = 41508 lac = 18007 mnc = 76 mcc = 404.
    Whe i use this to ping google i get good results for Latitude and longitude with following code.If i use mcc, mnc, lac, cellId) = location.gsm_location()
    I get CID = 118040699 LAC = 18007 MCC = 404 MNC = 76 .If i use these values to ping google than i dont get any value from google map.Can any one suggest on this.any pointer would of great help to me.

    Br
    Tulip



    Code:
    import urllib2
    import location
    import sysinfo
    
    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
    
    
    cellId = 41508
    lac = 18007
    mnc = 76
    mcc = 404
    #(mcc, mnc, lac, cellId) = location.gsm_location()
    main(cellId,lac,mnc,mcc)
    Last edited by tulipneo; 2009-12-15 at 10:46.

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

    Re: Help on LBS

    hello

    First thing you should do is debug your srcipt and check wheather you are getting correct cell id and other other parameters, then we can move ahaead.

    Regards

  3. #3
    Registered User
    Join Date
    Nov 2009
    Posts
    12

    Re: Help on LBS

    Hi Gargi,
    I knew atleast u r going to reply me like u help others every time.
    Well i get values as bellow:

    cellId = 118041508 lac = 18007 mnc = 76 mcc = 404
    First thing how do i make sure/Debug that these are correct values.
    Second thing my application gives me lat and long when i use the parameter given by author who posted the code.
    ie.
    CID = 20465 LAC = 495 MNC = 3 MCC = 262

    If i analyse both the data i get surprised as author's cellid value is only 5 octets.

    Pls suggest on this.

    Br
    Tulip

  4. #4
    Registered User
    Join Date
    Nov 2009
    Posts
    12

    Re: Help on LBS

    Hi Gargi,
    Further more from GSP spec GSM 11.14 version 5.2.0

    I get following interpretaion..

    from GSM specs i could get to know that

    Byte(s) Description Length
    1 Location Information 1
    2 Length (X) of bytes following 1
    3-5 Mobile Country & Network Codes (MCC & MNC) 3
    6-7 Location Area Code (LAC) 2
    8-9 Cell Identity Value (Cell ID) 2

    So i wonder how do i get such a big cell id value.

    So if u look above the total octet is 9 octet.is it the case that the cellid i get 118041508(9 octets) is this octet.

    Br
    Tulip

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

    Re: Help on LBS

    Quote Originally Posted by tulipneo View Post
    Hi Gargi,
    I knew atleast u r going to reply me like u help others every time.
    Well i get values as bellow:

    cellId = 118041508 lac = 18007 mnc = 76 mcc = 404
    First thing how do i make sure/Debug that these are correct values.
    Second thing my application gives me lat and long when i use the parameter given by author who posted the code.
    ie.
    CID = 20465 LAC = 495 MNC = 3 MCC = 262

    If i analyse both the data i get surprised as author's cellid value is only 5 octets.

    Pls suggest on this.

    Br
    Tulip
    hello tulip

    that cellid value sound fishy can you edit your first post and add the code tags there so that i can have a good look at the code.

    Enjoy Pythoning

  6. #6
    Registered User
    Join Date
    Nov 2009
    Posts
    12

    Re: Help on LBS

    Sorry Gargi I did not understand you.I mean what exactly u mean by code tag.
    My first post alreday contains the code.

    Br
    Tulip

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

    Re: Help on LBS

    i mean just edit your post and add the code tags, code tags are with # symbol on your forum nokia thread editor.

    Hope you got that.

  8. #8
    Registered User
    Join Date
    Nov 2009
    Posts
    12

    Re: Help on LBS

    Hi Gargi,
    Code tagged in first post.

    Br
    Tulip

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

    Re: Help on LBS

    hello tulip

    indeed a great script just checked with N97 PyS60 1.9.7 and that returns the exact cellid of my office.

    so now i guess the problem may be with your network operator can you check that with some other operator??

    Regards,

  10. #10
    Registered User
    Join Date
    Nov 2009
    Posts
    12

    Re: Help on LBS

    I will do so right away and ping u back.Just added you to Gtalk

    Br
    Tulip

  11. #11
    Registered User
    Join Date
    Nov 2009
    Posts
    12

    Re: Help on LBS

    In The code the bellow line was commented
    (mcc, mnc, lac, cellId) = location.gsm_location()
    did u uncomment and test it.i used some hard coded value and it worked but did not work with location.gsm_location() values

    Br
    Tulip

Similar Threads

  1. Realtime Fishing LBS Content's becoming a Hot Issue.
    By viva99kim in forum News and Announcements
    Replies: 1
    Last Post: 2008-02-29, 23:49

Posting Permissions

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