Baidu Map API Description How to use
The first step, the application of the key (AK), as the basis for accessing the service;
Second, follow the request parameter description to send the URL of the HTTP request, note the need to use the first step of the AK application;
The third step is to receive the returned data (in JSON or XML format).
Note: This interface supports callbacks.
Service Address
Http://api.map.baidu.com/geoconv/v1/?
Composition Description:
- Domain Name: http://api.map.baidu.com
- Service Name: Geoconv
- Service version number: v1
Service parameter Description
Parameters |
meaning |
range of Values |
whether you must |
Default Value |
Coords |
SOURCE coordinates |
Format: Longitude, latitude, longitude, latitude ... Limit: up to 100 supported Examples of formats: 114.21892734521,29.575429778924; 114.21892734521,29.575429778924 |
Is |
No |
Ak |
Developer Key |
|
Is |
No |
sn |
User's permission signature |
|
Whether |
This parameter must be used if the user is using the AK Check mode for SN check. (SN generation algorithm) |
From |
source Coordinate type |
The values are as follows: The angular coordinates obtained by the 1:GPS device; 2:gps obtained by the metric coordinates, sogou map coordinates used; 3:google map, Soso map, Aliyun map, mapabc map and AMAP map coordinates Metric coordinates for list map coordinates in 4:3 5: Baidu map using latitude and longitude coordinates 6: Baidu map using the metric coordinate system 7:mapbar map coordinates; 8:51 Map coordinates |
Whether |
The default is 1, which is the coordinates acquired by the GPS device |
To |
Destination coordinate type |
There are two options available: 5, 6. 5:bd09ll (Baidu latitude and longitude coordinates), 6:BD09MC (Baidu metric system latitude and longitude coordinates); |
Whether |
The default is 5, which is bd09ll (Baidu coordinates) |
Output |
return result format |
JSON or XML |
Whether |
Json |
Return value Description
name |
type |
meaning |
range of Values |
Status |
Init |
Status code |
Normal 0, abnormal non 0, detailed status code description |
Result |
JSON or XML array |
Conversion results |
Consistent with input order |
|
X |
Float |
Abscissa |
|
Y |
Float |
Ordinate |
|
Delphi's Invocation process
Procedure Gpstobaidu (Gx,gy:real;var bx,by:real);
Const
urs1= ' http://api.map.baidu.com/geoconv/v1/?coords= ';
Urs2= ' &&ak= your secret key ';//Two &&
Var
url:string;
Ts:tstringstream;
Jo:isuperobject;
Xy:tsuperarray;
Begin
Url:=urs1+floattostr (Gx) + ', ' +floattostr (Gy) +urs2;
Ts:=tstringstream.create;
Try
Idhttp1.get (Url,ts);
Ts. position:=0;
Jo:=so (TS. datastring);
xy:=jo[' result '. Asarray;
Jo:=so (Xy[0]. asstring);
bx:=jo[' x ']. asdouble;
by:=jo[' y ']. asdouble;
Except//conversion failed
BX:=GX;
By:=gy;
Exit
End
End
Delphi Call Baidu Map WebService convert GPS coordinates turn