黑莓上的细胞三角测量 [英] Cell triangulation on BlackBerry

查看:15
本文介绍了黑莓上的细胞三角测量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

关于如何对黑莓和 J2ME 手机进行蜂窝三角测量有什么想法吗?我知道如何获取单元格 ID,但无法进行三角测量.

Any ideas about how to do cell triangulation for Blackberry and J2ME phones? I know how to get the cell id but I couldn't do triangulation.

推荐答案

如果你可以向任意网站做一个 HTTP Post,你可以使用谷歌的 地理位置 api.

If you can do an HTTP Post to an arbitray website, you can use Google's geolocation api.

只需将以下 JSON 格式的数据发布到 https://www.google.com/loc/json.

Simply POST data in the following JSON format to https://www.google.com/loc/json.

请参阅上面的链接,了解如何从 wifi 等向您的 json 添加更多信息,以大大提高结果的准确性.并特别注意移动国家代码,获取它是 不明显.

See the above link on how to add more information to your json from wifi etc. to greatly increase the accuracy of the result. And pay special attention to the mobile country code, getting it is not obvious.

{
  "version": "1.1.0",
  "cell_towers": [
    {
      "cell_id": "42",
      "location_area_code": 415,
      "mobile_country_code": 310,
      "mobile_network_code.": 410,
      "age": 0,
      "signal_strength": -60,
      "timing_advance": 5555
    },
    {
      "cell_id": "88",
      "location_area_code": 415,
      "mobile_country_code": 310,
      "mobile_network_code": 580,
      "age": 0,
      "signal_strength": -70,
      "timing_advance": 7777
    }
  ]
}

这将返回 Google 对您所在位置的纬度/经度的估计值,以及准确性和可选的地理编码地址.您可以快速测试它,例如使用名为 REST Console 的 Chrome 扩展程序.

This will return you Google's estimate of the latitude/longitude on your location, along with accuracy and optionally a geocoded address. You can test it quickly e.g. with the Chrome extension called REST Console.

但是,似乎 Blackberry API 仅提供有关当前连接的单元格的信息,而不提供其他可见但未注册的单元格的信息.在这种情况下无法进行三角测量,因为您(不出所料)需要三个点来进行三角测量!然而,位置的不太准确的径向估计仍然是可能的.

However, it seems that the Blackberry API only provides info on the currently connected cell, not other visible but unregistered cells. In this situation cannot do triangulation, as you (unsuprisingly) need three points to triangulate! However, a less accurate radial estimate of location is still possible.

您仍然可以为此使用 Google API,只提供一个塔,或者您可以使用 爱立信 API 如果您选择.您可能想同时测试两者并比较准确性.Ericcson API 是类似于 Google 的 JSON api,但只需要一个单元格作为输入.教程可用,但归结为这样的 JSON 请求:

You can still use the Google API for this, by providing only one tower, or you can use the Ericsson API if you choose. You might want to test with both and compare the accuracy. The Ericcson API is a similar JSON api to Google's, but only expects a single cell as input. A tutorial is available, but it boils down to a JSON request like this:

StringBuffer url = new StringBuffer();
url.append("http://cellid.labs.ericsson.net/json/lookup");
url.append("?cellid=").append(cell.getCellId());
url.append("&mnc=").append(cell.getMnc());
url.append("&mcc=").append(cell.getMcc());
url.append("&lac=").append(cell.getLac());
url.append("&key=").append(API_KEY);
try {
  byte[] data = getHttp(url.toString());
  if(data!=null) {
    JSONObject o = new JSONObject(new String(data));
    JSONObject pos = o.getJSONObject("position");
    this.longitude = pos.getDouble("longitude");
    this.latitude = pos.getDouble("latitude");
    this.accuracy = pos.getDouble("accuracy");
    this.cellName = pos.optString("name");
  }
} catch (IOException e) {
  e.printStackTrace();
} 

这篇关于黑莓上的细胞三角测量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆