【问题标题】:Finding location using MCC, MNC, LAC, and Cell ID使用 MCC、MNC、LAC 和小区 ID 查找位置
【发布时间】:2013-09-12 06:32:17
【问题描述】:

我知道 MCC、MNC、LAC 和小区 ID 的值是什么。我想在C语言中编写一个程序,在Linux中以经纬度值的形式计算位置。

仅供参考:

问题:

  1. 如何在 linux 中将 MCC、MNC、LAC、Cell ID 转换为经纬度值?
  2. 为什么每次尝试读取时 Cell ID 都不同?

【问题讨论】:

  • 这里是题外话,但无论如何:据我了解,您无法从中计算纬度/经度;您将需要在一些公开可用的数据库中查看这些值以查找位置。检查:en.wikipedia.org/wiki/Cell_ID
  • 我读过。但不知道,如何获取位置信息?正如我们在移动设备上看到的,在启用位置信息时。它在屏幕上显示最近的 BTS。如何根据 MCC、MNC、LAC 和 Cell ID 知道位置?
  • 是否有任何 API 可以反过来执行此操作,获取 MCC、MNC、LAC 和 Cell ID 中的单元列表?

标签: android linux geolocation gps wireless


【解决方案1】:

我写了一个 python 脚本可以为你做这件事。您可以从 pyc 文件中获取二进制文件。

#!/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

【讨论】:

    【解决方案2】:

    回答您的问题:

    1. 您可以从终端或浏览器访问公共数据库,将小区 ID 转换为纬度/经度。数据库包括:

    2. Cell ID 是您的手机/设备连接到的手机信号塔的 ID。当你稍微移动一点,或者附近另一个塔的信号比现在的好,你的手机就会切换到那个塔,你的 Cell ID 现在反映了那个塔的 ID。

    【讨论】:

    • 但是“查找单元”站点使用 4 个参数:MMC、MNC、LAC、CID(不仅是 CID),那么他们为什么需要所有这些值呢?是否有演示如何使用这些参数查找位置(经度、纬度)的代码?
    • 请添加明确的披露;在推荐您自己的产品时,您必须说明您与 Unwired Labs 的关系。
    【解决方案3】:

    您可以使用这个简单但高效的网站,无需任何登录:

    http://www.cell2gps.com/

    虽然您可以通过 wiki 页面访问 MCC 和 MNC 等运营商信息:

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

    结果是通过谷歌地图定位GPS,

    【讨论】:

      【解决方案4】:

      你要么需要一个数据库 OpenCellID(他们为新细胞测量提供API,获取特定细胞的位置等)

      使用“秘密”API: “http://www.google.com/glm/mmap”是一个将cellLocation转换为经纬度的非公开API。

      this SO question. 的答案中提供了许多方法来做到这一点

      【讨论】:

      • 请注意 link-only answers 是不鼓励的,所以答案应该是寻找解决方案的终点(相对于另一个参考中途停留,随着时间的推移往往会变得陈旧)。请考虑在此处添加独立的概要,并保留链接作为参考。
      猜你喜欢
      • 1970-01-01
      • 2014-08-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多