You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

45 lines
1.1 KiB

<?php
namespace tencent\map;
class Location extends Base
{
/**
* 逆地址解析(经纬度转地址)
* @param string $lat 纬度
* @param string $lng 经度
* @param int $get_poi 是否返回周边POI列表 1--返回 0--不返回(默认)
* @param string $poi_options 用于控制POI列表
* @date 2021-02-04
*/
public function locationToAddress($lat, $lng, $get_poi = 0, $poi_options = 'policy=1')
{
$key = $this->config['key'];
$url = $this->url . "geocoder/v1/?location=$lat,$lng&key=$key&get_poi=$get_poi&poi_options=$poi_options";
$result = http_data_get($url);
return $result;
}
/**
* 地址解析(地址转经纬度)
* @param string $address 地址(注:地址中请包含城市名称,否则会影响解析效果)
* @param string $region 指定地址所属城市
* @date 2021-02-04
*/
public function addressToLocation($address, $region = '')
{
$key = $this->config['key'];
$url = $this->url . "geocoder/v1/?address=$address&key=$key";
$result = http_data_get($url);
return $result;
}
}