演示示例代码:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net.Security;
using System.Security.Cryptography.X509Certificates;
using System.Net;
using System.IO;
using System.IO.Compression;
using System.Text.RegularExpressions;
using System.Web.Script.Serialization;
namespace map
{
class Program
{
static void Main(string[] args)
{
string key = "************************";
string old_lnglat="116.44361,39.93554";
string url = "http://api.haoservice.com/api/Convertlnglat?old_lnglat="+old_lnglat+"&key="+key;
WebClient wc = new WebClient();
wc.Encoding = Encoding.UTF8;
string str = wc.DownloadString(url);
Console.WriteLine(str);
Console.ReadKey();
}
}
}
gps纠偏接口返回示例
接口信息
URL:http://api.haoservice.com/api/convertlnglat
支持格式:json
http请求方式:GET POST
DEMO:http://api.haoservice.com/api/Convertlnglat?old_lnglat=116.44361,39.93554&key=您申请的KEY
返回结果:
{"error_code":0,
"reason":"成功",
"result":
{"Address":"直辖市北京市朝阳区幸福村中路东直门街道(东城区)三里屯首开幸福广场东北",
"province":"直辖市",
"city":"北京市",
"dist":"朝阳区",
"area":"幸福村中路",
"town":"东直门街道(东城区)",
"village":"三里屯",
"poi":"首开幸福广场",
"poitype":"小区",
"direction":"东北",
"distance":0.0,
"roadname":"三里屯东三街",
"roadDirection":"北",
"roadDistance":0.0}
}
}
备注:
在网页(http://www.haoservice.com/docs/15)申请key值,将key和所需查询old_lnglat参数传入运行即可
若出现错误可参照一下代码表:
返回码 说明
0 成功
10001 错误的请求KEY
10002 该KEY无请求权限
10003 KEY过期
10004 错误的SDK KEY
10005 应用未审核超时,请提交认证
10007 未知的请求源,(服务器没有获取到IP地址)
10008 被禁止的IP
10009 被禁止的KEY
10011 当前IP请求超过限制
10012 当前Key请求超过限制
10013 测试KEY超过请求限制
10020 接口维护
10021 接口停用
10022 appKey按需剩余请求次数为零
10023 请求IP无效
10024 网络错误
10025 没有查询到结果