地址与经纬度互转API接口

在线经纬度查询坐标拾取系统可方便在线查询地名位置拾取,可实现经度纬度查询地名位置,地名查询经度纬度位置、任意地图位置解析经纬度

接口文档 《查看会员》
接口地址: http://api.toolfk.com/api/map | 在线体验接口
请求方法: [ "GET", "POST" ]
请求参数:
名称类型描述示例
tokenstring请求的token用户中心获取token
lngstring 经度(经纬度和地址二选一) 116.481499
latstring 纬度(经纬度和地址二选一) 39.990375
addressstring 地址(经纬度和地址二选一) 北京市朝阳区阜通东大街6号
-- 漂亮的分割符 --
返回数据:

#经纬度转物理位置(只传lng,lat两个参数)
{
    "status": 1,
    "data": "中国北京市朝阳区望京街道"
}
#物理位置转经纬度(只传address参数)
{
    "status": 1,
    "data": "116.479115,39.994945"
}

                
                            
代码示例:
  • Curl
  • PHP
  • Java
  • Python
  • JavaScript
  • Go
  • Nodejs

    curl -X POST \
    http://api.toolfk.com/api/map \
    -H 'Content-Type: application/x-www-form-urlencoded' \
    -d 'token=用户中心获取&lng=116.481499&lat=39.990375&address=%E5%8C%97%E4%BA%AC%E5%B8%82%E6%9C%9D%E9%98%B3%E5%8C%BA%E9%98%9C%E9%80%9A%E4%B8%9C%E5%A4%A7%E8%A1%976%E5%8F%B7'
                                       
//记得去掉这个 "\" 斜线
<\?php
$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "http://api.toolfk.com/api/map",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => "token=用户中心获取&lng=116.481499&lat=39.990375&address=%E5%8C%97%E4%BA%AC%E5%B8%82%E6%9C%9D%E9%98%B3%E5%8C%BA%E9%98%9C%E9%80%9A%E4%B8%9C%E5%A4%A7%E8%A1%976%E5%8F%B7",
  CURLOPT_HTTPHEADER => array(
    "Content-Type: application/x-www-form-urlencoded",
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
   

OkHttpClient client = new OkHttpClient();

MediaType mediaType = MediaType.parse("application/x-www-form-urlencoded");
RequestBody body = RequestBody.create(mediaType, "token=用户中心获取&lng=116.481499&lat=39.990375&address=%E5%8C%97%E4%BA%AC%E5%B8%82%E6%9C%9D%E9%98%B3%E5%8C%BA%E9%98%9C%E9%80%9A%E4%B8%9C%E5%A4%A7%E8%A1%976%E5%8F%B7");
Request request = new Request.Builder()
  .url("http://api.toolfk.com/api/map")
  .post(body)
  .addHeader("Content-Type", "application/x-www-form-urlencoded")
  .build();

Response response = client.newCall(request).execute();


                                       
import requests

url = "http://api.toolfk.com/api/map"

payload = "token=用户中心获取&lng=116.481499&lat=39.990375&address=%E5%8C%97%E4%BA%AC%E5%B8%82%E6%9C%9D%E9%98%B3%E5%8C%BA%E9%98%9C%E9%80%9A%E4%B8%9C%E5%A4%A7%E8%A1%976%E5%8F%B7"
headers = {'Content-Type': "application/x-www-form-urlencoded"}

response = requests.request("POST", url, data=payload, headers=headers)

print(response.text)
var data = "token=用户中心获取&lng=116.481499&lat=39.990375&address=%E5%8C%97%E4%BA%AC%E5%B8%82%E6%9C%9D%E9%98%B3%E5%8C%BA%E9%98%9C%E9%80%9A%E4%B8%9C%E5%A4%A7%E8%A1%976%E5%8F%B7";

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
    if (this.readyState === 4) {
        console.log(this.responseText);
    }
});

xhr.open("POST", "http://api.toolfk.com/api/map");
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");

xhr.send(data);
                                       
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io/ioutil"
)

func main() {

	url := "http://api.toolfk.com/api/map"

	payload := strings.NewReader("token=用户中心获取&lng=116.481499&lat=39.990375&address=%E5%8C%97%E4%BA%AC%E5%B8%82%E6%9C%9D%E9%98%B3%E5%8C%BA%E9%98%9C%E9%80%9A%E4%B8%9C%E5%A4%A7%E8%A1%976%E5%8F%B7")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Content-Type", "application/x-www-form-urlencoded")

	res, _ := http.DefaultClient.Do(req)

	defer_no res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
                                       
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io/ioutil"
)

func main() {

	url := "http://api.toolfk.com/api/map"

        payload := strings.NewReader("{
          "token": "用户中心获取token",
          "type": "a",
          "format": "json"
        }")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Content-Type", "application/x-www-form-urlencoded")

	res, _ := http.DefaultClient.Do(req)

	defer_no res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
                                       
返回状态码 status 描述参照
返回码描述
status1:表示成功,0:表示失败
data成功返回数据
errmsg失败返回数据
备注:开通API接口服务,可同时享用 www.toolfk.com 网站的会员工具。