php已知圆的半径求圆的,(PHP)高德已知圆心,半径,计算圆弧坐标

467bccb2b3adb2bf51283c618aafd598.png

/**

* 高德地图画电子围栏

* $key 需要填写

*/

function DrFence($radius,$c_lon,$c_lat){

$curl = new Curl\Curl();

$url = 'http://restapi.amap.com/v3/assistant/coordinate/convert?locations='.substr($c_lon,0,10).','.substr($c_lat,0,9).'&coordsys=gps&output=json&key=$key';

$rst = $curl->get($url);

$rst = json_decode($rst->response,true);

if($rst['status']==1){

$locations=$rst['locations'];

list($c_lon,$c_lat) = explode(',',$locations);

}

$r = (double)6371000.79;

$numpoints = 360;

$phase = 2 * M_PI/$numpoints;

for ($i=0;$i

/*计算坐标点*/

$dx = ($radius * cos($i * $phase));

$dy = ($radius * sin($i * $phase));

/**

* 转换成坐标

*/

$f_lon = $c_lon + $dx / ($r * cos($c_lat * M_PI/180) * M_PI / 180);

$f_lat = $c_lat + $dy / ($r * M_PI / 180);

$str[] = $f_lon.','.$f_lat;

}

$str = implode(';',$str);

$zoom = 17;

return 'http://restapi.amap.com/v3/staticmap?zoom='.$zoom.'&size=1000*500&paths=3,0x666fff,1,,:'.$str.'&key=$key';

}

使用高德地图画圆

Bill Zhang

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值