周边地点搜索
云析API铺 官方文档
搜索指定经纬度周边区域地点,例如查询指定地点区域公交,公厕,酒店,酒吧等各类地点信息
基本说明:
接口地址:https://cn.apihz.cn/api/other/diming.php
返回格式:json
请求方式:get/post
请求示例:https://cn.apihz.cn/api/other/diming.php?id=10006620&key=key&words=公交&radius=1000&lon=121.415&lat=31.218
请求参数说明:
名称 类型 必填 说明
id int 必填 用户中心的数字ID,例:id=10000000
key string 必填 对应平台秘钥,非本平台 扫码关注公众号
words string 必填 要查询的关键词
lon float 必填 查询经度
lat float 必填 查询纬度
返回参数说明:
名称 类型 说明
datas.address string 地址。
datas.distance string 1千米以下单位为米(m),1千米以上单位为千米(km)。
datas.provinceCode string 省行政区编码,前缀带156,请自行去除。
datas.cityCode string 市行政区编码,前缀带156,请自行去除。
datas.county string 所属区县名称。
datas.typeName string 分类名称。
datas.source string 数据信息来源。
datas.lonlat string 坐标。
datas.typeCode string 分类编码。
datas.countyCode string 区县行政区编码,前缀带156,请自行去除。
datas.province string 所属省名称。
datas.poiType string 101:POI数据 102:公交站点。
datas.name string Poi点名称。
datas.hotPointID string poi热点ID。
datas.stationData string 车站数据集。
datas.stationData.stationUuid string 公交站uuid。
datas.stationData.lineName string 线路名称。
datas.stationData.uuid string 线路uuid。
JSON返回示例:
{
	"code": 200,
	"count": "27",
	"allpage": 1,
	"nowpage": 1,
	"datas": [{
		"address": "上海市长宁区",
		"distance": "240m",
		"poiType": "102",
		"name": "安化路定西路-公交站",
		"source": "",
		"hotPointID": "51644186BDC272E1",
		"stationData": [{
			"stationUuid": "1449946",
			"lineName": "947路",
			"uuid": "240424"
		}],
		"lonlat": "121.417121,31.216823"
	}]
}
服务级错误码参照
错误码 说明
400 错误信息提示
完整教学代码示例
<?php
/**
 * Created by PhpStorm.
 * User: FZS
 * Time: 2025/4/20 07:11
 */
class freeApi
{
    private $apiUrl;

    public function __construct()
    {
        $this->apiUrl = 'https://cn.apihz.cn/api/other/diming.php?id=10006620&key=key&words=公交&radius=1000&lon=121.415&lat=31.218';
    }

    /**
     * 获取结果
     * @return array
     */
    public function getResult()
    {
        return file_get_contents($this->apiUrl);
    }
}
package main

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

const (
	APIURL   = "https://cn.apihz.cn/api/other/diming.php?id=10006620&key=key&words=公交&radius=1000&lon=121.415&lat=31.218"
)

func main() {
	queryUrl := fmt.Sprintf("%s",APIURL)
	resp, err := http.Get(queryUrl)
	if err != nil {
		log.Println(err)
		return
	}

	defer resp.Body.Close()

	body, err := ioutil.ReadAll(resp.Body)

	if err != nil {
		fmt.Println(err)
		return
	}

	fmt.Println(string(body))
}