DEMO code:
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 ();
}
}
}
Example returned by GPS correction Interface
Interface Information
URL: http://api.haoservice.com/api/convertlnglat
Supported format: JSON
HTTP Request Method: Get post
Demo: http://api.haoservice.com/api/Convertlnglat? Old_lnglat = 116.44361, 39.93554 & Key = the key you applied
Returned results:
{"Error_code": 0,
"Reason": "successful ",
"Result ":
{"Address": "Dongzhimen Street (Dongcheng District), Xingfu Village Middle Road, Chaoyang district, Beijing, opens the Northeast happiness Plaza in Sanlitun ",
"Province": "municipality ",
"City": "Beijing ",
"Dist": "Chaoyang District ",
"Area": "Happy Village Middle Road ",
"Town": "Dongzhimen Street (Dongcheng District )",
"Village": "Sanlitun ",
"Poi": "Opening happiness square ",
"Poitype": "Residential Area ",
"Direction": "Northeast China ",
"Di stance": 0.0,
"Roadname": "Sanlitun East 3 Street ",
"Roaddirection": "North ",
"Roaddistance": 0.0}
}
}
Note:
Apply for the key value on the web page (http://www.haoservice.com/docs/15) and pass the key and the old_lnglat parameters to run
If an error occurs, refer to the code table below:
Return Code Description
0 successful
Request key with 10001 Error
10002 this key has no request permission
The 10003 key expires.
SDK key with 10004 Error
10005 application not reviewed timeout. Please submit for authentication
10007 unknown request source (the server has not obtained an IP address)
10008 forbidden IP Address
10009 forbidden key
10011 the current IP request exceeds the limit
10012 the current key request has exceeded the limit.
10013 the test key exceeds the request limit
10020 interface Maintenance
10021 disable the interface
10022 the number of requests remaining on demand for the appkey is zero.
10023 invalid request IP Address
10024 network errors
10025 no results found
Example returned by GPS correction Interface