一、接口功能:三网基站,秒级定位
该API直连三大运营商基站数据库,通过输入基站编码(MNC、LAC、CellID),即可返回:
-
经纬度坐标(WGS84坐标系,可直接用于地图标注)
-
覆盖半径(精度范围,单位:米)
-
详细地址(省市区+道路+地标描述)
二、实战演示:根据基站信息查询位置
下面通过 C# 代码调用该接口
using System;
using System.IO;
using System.Net;
using System.Text;
using System.Security.Cryptography.X509Certificates;
public class CellLocationTest
{
private const string host = "https://market.aliyun.com/detail/cmapi00065871"#接口地址;
private const string path = "/cell/index";
private const string method = "GET";
private const string appcode = "你自己的AppCode"; // 替换为真实 AppCode
public static void Main(string[] args)
{
string querys = "mnc=0&lac=33204&cellid=202944490";
string url = host + path;
if (!string.IsNullOrEmpty(querys))
{
url = url + "?" + querys;
}
HttpWebRequest httpRequest = null;
HttpWebResponse httpResponse = null;
if (host.Contains("https://"))
{
ServicePointManager.ServerCertificateValidationCallback =
new RemoteCertificateValidationCallback(CheckValidationResult);
httpRequest = (HttpWebRequest)WebRequest.CreateDefault(new Uri(url));
}
else
{
httpRequest = (HttpWebRequest)WebRequest.Create(url);
}
httpRequest.Method = method;
httpRequest.Headers.Add("Authorization", "APPCODE " + appcode);
try
{
httpResponse = (HttpWebResponse)httpRequest.GetResponse();
}
catch (WebException ex)
{
httpResponse = (HttpWebResponse)ex.Response;
}
Console.WriteLine(httpResponse.StatusCode);
Stream st = httpResponse.GetResponseStream();
StreamReader reader = new StreamReader(st, Encoding.GetEncoding("utf-8"));
string result = reader.ReadToEnd();
Console.WriteLine(result);
}
public static bool CheckValidationResult(object sender, X509Certificate certificate,
X509Chain chain, SslPolicyErrors errors)
{
return true;
}
}
三、返回字段解析
| 字段 | 类型 | 说明 |
|---|---|---|
lat | string | 纬度(WGS84坐标系) |
lng | string | 经度(WGS84坐标系) |
radius | int | 定位精度半径(米),值越小精度越高 |
addr | string | 结构化地址描述 |

1万+

被折叠的 条评论
为什么被折叠?



