Finding location using MCC, MNC, LAC, and Cell ID
Asked Answered
W

4

15

I know what the values are for MCC, MNC, LAC, & Cell ID. I want to in C write a program to calculate the position in the form of latitude and longitude values in Linux.

FYI:

Question:

  1. How can I convert MCC,MNC,LAC,Cell ID into latitude and longitude values in linux?
  2. Why does Cell ID varies every time,when trying to read?
Westerman answered 8/9, 2013 at 1:17 Comment(3)
Off-topic for here, but anyway: from what I understand, you can't calculate latitude/longitude from those; you will need to look those values on some of the publicly-available databases to find location. Check: en.wikipedia.org/wiki/Cell_IDVizierate
I read. But do not know, how can i get location information? As we saw mobile, when enabling location information. it displays nearest BTS on screen. How can i know position based on MCC,MNC,LAC and Cell ID?Westerman
Is there any API to do this the other way round, getting list of cells in MCC, MNC, LAC and Cell ID?Plagio
P
4

To answer your questions:

  1. You can access public databases from terminal or a browser to convert cell ID to lat/lon. Databases include:

  2. Cell ID is the ID of the cell phone tower your phone/device is connected to. The moment you move a bit, or the signal of another tower nearby is better than the current one, your phone will switch over to that tower, and your Cell ID now reflects the ID of that tower.

Prompter answered 10/2, 2014 at 16:8 Comment(2)
But the "find cell" sites use 4 parameters: MMC,MNC,LAC,CID ( not only CID ), then why do they need all these values ? Is there a code which demonstrate how to find location(longitude,latitude) using these parameters ?Mcclure
Please add a clear disclosure; you have to tell what relationship you have to Unwired Labs when recommending your own products.Feliks
P
3

i wrote a python script that can do this for you. You can get a binary from the pyc file.

#!/bin/python
"""
Written by Atissonoun - Credits to MFC & HAC
***You need to initialize the script in order to fix the import and the dependency.
This is only a Beta version of the project***
This python file works as the engine for the project.
imports, coordinates, run......
"""

#Importing modules
import requests
#defining a Api_Keys

Google_API_KEY="Your google API Key goes here"
OpenCell_Api_Key ="Your OpenCellID API Key goes here"

def Google(MMC,MNC,LAC,ID,API_KEY=Google_API_KEY):
    url = "https://www.googleapis.com/geolocation/v1/geolocate?key={}".format(API_KEY)
    data={
    "radioType": "gsm",
    "cellTowers":[
        {
        "cellId": ID,
        "locationAreaCode": LAC,
        "mobileCountryCode": MMC,
        "mobileNetworkCode": MNC
        }
    ]
    }
    response = requests.post(url, json=data)
    if response.status_code == 200 :
        lat=response.json()[u'location'][u'lat']
        long = response.json()[u'location'][u'lng']
        d={'LAT':lat,'LONG':long}
        print('Located Cell: {}'.format(ID))
        return d
    else:
        print('Error: {}'.format(response.status_code))
        return None

def Opencell(MMC,MNC,LAC,ID,API_KEY=OpenCell_Api_Key):
    url = "https://us1.unwiredlabs.com/v2/process.php"
    data = {
        "token": API_KEY,
        "radio": "gsm",
        "mcc": MMC,
        "mnc": MNC,
        "cells": [{
            "lac": LAC,
            "cid": ID
        }]
    }
    response = requests.post(url, json=data)
    if response.status_code == 200:
        if response.json()[u'status']== 'error':
            print('Error: {}'.format(response.json()[u'message']))
            return None
        else:
            lat = response.json()[u'lat']
            long = response.json()[u'lon']
            d = {'LAT': lat, 'LONG': long}
            print('Located Cell: {}'.format(ID))
            return d
    else:
        print('Error: {}'.format(response.status_code))
        return None
Puli answered 24/6, 2017 at 2:28 Comment(1)
is it still working ? actually i want to get exact location using these parameters ?Accrual
K
2

You either need a database OpenCellID (they provide APIs for new cell measurement, get the position of a specific cell, etc)

or

use the "secret" API: "http://www.google.com/glm/mmap" is a non-public API to convert cellLocation to latitude and longitude.

Many ways to do that are given in the answwers for this SO question.

Kristinkristina answered 17/10, 2013 at 8:54 Comment(1)
Note that link-only answers are discouraged, SO answers should be the end-point of a search for a solution (vs. yet another stopover of references, which tend to get stale over time). Please consider adding a stand-alone synopsis here, keeping the link as a reference.Josefinejoseito
F
0

You can use this simple but efficient web site that doesn't need any log in:

http://www.cell2gps.com/

while you can access to operator info like MCC and MNC to the wiki page:

http://en.wikipedia.org/wiki/Mobile_country_code#I

The result is the location GPS through Google Maps,

Fulltime answered 30/8, 2014 at 18:15 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.