Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

google maps, cellid to location

According to this sample:

http://www.codeproject.com/KB/mobile/DeepCast.aspx

It's possible to request a gps coordinate (longitude & latitude) including range when sending cellid information (MCC, MNC, towerid, etc)

Can someone tell me the actual parameter to request/post to this address?

http://www.google.com/glm/mmap

It could be something like this

http://www.google.com/glm/mmap?mcc=xxx&mnc=xxx&towerid=xxx

And i would like to know what response we would get.

I have observe OpenCellid website and they provide some nice API to begin with, but i want to know about that in google map too (since they have more completed database).

OpenCellID API

like image 633
Dels Avatar asked Oct 21 '09 04:10

Dels


People also ask

How to obtain the approximate location of CellID?

It should be noted that we obtain the approximate location of CellID. The most accurate location is determined using the averaging function, which calculates the coordinates in all sectors (CellID) of one base station and then calculate the average value. How to use CellIDfinder?

Is it possible to request GPS coordinates when sending CellID information?

Bookmark this question. Show activity on this post. According to this sample: It's possible to request a gps coordinate (longitude & latitude) including range when sending cellid information (MCC, MNC, towerid, etc) Can someone tell me the actual parameter to request/post to this address?

What is the difference between CellID and location area?

A location area is a set of base stations that are grouped together to optimize signalling. CellID (CID) — is a generally unique number used to identify each Base transceiver station (BTS) or sector of a BTS within a Location area code.

What is CellID finder?

CellID Finder help RF engineers and netmonitor geeks Google map Find GSM CellID MCC MNC LAC LAC (HEX) CID CID (HEX) Google data:


2 Answers

Here is example for work with

#!/usr/bin/python

country = 'fr'
#device = 'Sony_Ericsson-K750'
device = "Nokia N95 8Gb"
user_agent = 'Mozilla/4.0 (compatible; MSIE 5.5; Windows NT)'
mmap_url = 'http://www.google.com/glm/mmap'
geo_url = 'http://maps.google.com/maps/geo'

from struct import pack, unpack
from httplib import HTTP
import urllib2

def fetch_latlong_http(query):
    http = HTTP('www.google.com', 80)
    http.putrequest('POST', '/glm/mmap')
    http.putheader('Content-Type', 'application/binary')
    http.putheader('Content-Length', str(len(query)))
    http.endheaders()
    http.send(query)
    code, msg, headers = http.getreply()
    result = http.file.read()
    return result

def fetch_latlong_urllib(query):
    headers = { 'User-Agent' : user_agent }
    req = urllib2.Request(mmap_url, query, headers)
    resp = urllib2.urlopen(req)
    response = resp.read()
    return response

fetch_latlong = fetch_latlong_http

def get_location_by_cell(cid, lac, mnc=0, mcc=0, country='fr'):
    b_string = pack('>hqh2sh13sh5sh3sBiiihiiiiii',
                    21, 0,
                    len(country), country,
                    len(device), device,
                    len('1.3.1'), "1.3.1",
                    len('Web'), "Web",
                    27, 0, 0,
                    3, 0, cid, lac,
                    0, 0, 0, 0)

    bytes = fetch_latlong(b_string)
    (a, b,errorCode, latitude, longitude, c, d, e) = unpack(">hBiiiiih",bytes)
    latitude = latitude / 1000000.0
    longitude = longitude / 1000000.0

    return latitude, longitude

def get_location_by_geo(latitude, longitude):
    url = '%s?q=%s,%s&output=json&oe=utf8' % (geo_url, str(latitude), str(longitude))
    return urllib2.urlopen(url).read()

if __name__ == '__main__':
    print get_location_by_cell(20465, 495, 3, 262)
    print get_location_by_cell(20442, 6015)
    print get_location_by_cell(1085, 24040)
    print get_location_by_geo(40.714224, -73.961452)
    print get_location_by_geo(13.749113, 100.565327)
like image 185
Andrey Nikishaev Avatar answered Oct 11 '22 20:10

Andrey Nikishaev


You could use the Google Location API which is used by Firefox (Example see at http://www.mozilla.com/en-US/firefox/geolocation/ ) which has the url www.google.com/loc/json/. In fact this is JSON based webservice and a minimal Perl Example Look like this:

use LWP;

my $ua = LWP::UserAgent->new;
$ua->agent("TestApp/0.1 ");
$ua->env_proxy();

my $req = HTTP::Request->new(POST => 'https://www.google.com/loc/json');

$req->content_type('application/jsonrequest');
$req->content('{"cell_towers": [{"location_area_code": "8721", "mobile_network_code": "01", "cell_id": "7703", "mobile_country_code": "262"}], "version": "1.1.0", "request_address": "true"}');

# Pass request to the user agent and get a response back
my $res = $ua->request($req);

# Check the outcome of the response
if ($res->is_success) {
    print $res->content;
} else {
    print $res->status_line, "\n";
    return undef;
}

Please keep in mind that Google has not officially opened this API for other uses...

like image 8
Lairsdragon Avatar answered Oct 11 '22 18:10

Lairsdragon