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)

Reply With Quote




