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.
This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.
< ? php
namespace tencent\map ;
class Travel extends Base
{
/**
* 批量距离计算
* @param string $from 起点坐标,格式: lat,lng[,heading];lat,lng[,heading]…
* @param string $to 终点坐标, 格式: lat,lng;lat,lng...
* @param string $mode 计算方式: driving( 驾车) 、walking( 步行) 默认: driving
* @date 2021-02-04
*/
public function getDistance ( $from , $to , $mode = 'driving' )
{
$key = $this -> config [ 'key' ];
$url = $url = $this -> url . " distance/v1/matrix?mode= $mode &from= $from &to= $to &key= $key " ;
$result = http_data_get ( $url );
return $result ;
}
/**
* 路线规划(驾车/公交/步骑)
* @param string $from 起点位置坐标, 格式: from=40.034852,116.319820
* @param string $to 终点位置坐标, 格式: lat,lng to=39.771075,116.351395
* @param string $mode 计算方式: driving( 驾车) 、walking( 步行) 、骑行( bicycling) 、公交( transit) 默认: driving
* @param string $waypoints 途经点, 格式: lat1,lng1;lat2,lng2;… 最大支持16个
* @param string $other_param 其他参数拼接
* @date 2021-02-04
*/
public function getTravelRoute ( $from , $to , $mode = 'driving' , $waypoints = '' , $other_param = '' )
{
$key = $this -> config [ 'key' ];
$waypoints_param = ! empty ( $waypoints ) ? '&waypoints=' . $waypoints : '' ; //拼接waypoints参数
$url = $this -> url . " direction/v1/ $mode /?from= $from &to= $to &key= $key $waypoints_param & $other_param " ;
$result = http_data_get ( $url );
return $result ;
}
}