-
두 gps 지점으로 방위각 구하기PHP 2022. 1. 24. 14:50반응형
방위각 계산 사이트 와 실제 코드를 통해 나온 결과값을 비교해 보고 시작하자.
https://www.omnicalculator.com/other/azimuth
Azimuth Calculator
If you want to give a location of a point relative to your current position, you need to provide two values: the azimuth and the distance. If Earth was flat, the latter would simply by the straight-line distance between two points. As Earth is a sphere (or
www.omnicalculator.com
347.4도 라고 나온다.
$TargetAngle = Azimuth( "37.02828302166191", "126.85734872883606" ,"37.64102883333334" , "126.68457433333333" ); if($TargetAngle < 0){ $TargetAngle = 180+(180+$TargetAngle); } echo $TargetAngle; function Azimuth($lat1, $long1, $lat2, $long2) { $Lat1 = deg2rad($lat1); echo $Lat1."<br/><br/>"; $Lat2 = deg2rad($lat2); echo $Lat2."<br/><br/>"; $Long1 = deg2rad($long1); echo $Long1."<br/><br/>"; $Long2 = deg2rad($long2); echo $Long2."<br/><br/>"; $y = sin($Long2-$Long1)*cos($Lat2); echo $y."<br/><br/>"; $x = cos($Lat1)*sin($Lat2)-sin($Lat1)*cos($Lat2)*cos($Long2-$Long1); echo $x."<br/><br/>"; echo (atan2($y, $x))."<br/><br/>"; echo rad2deg(atan2($y, $x))."<br/><br/>"; return rad2deg(atan2($y, $x)); }
php 계산 프로그램도 347.4
반응형'PHP' 카테고리의 다른 글
그래프 그리기 (0) 2021.12.15 수수점 계산오류 (0) 2021.11.26 file multiple upload (0) 2021.11.25 네이버 단축url API 이용하기. (2) 2021.10.13 홈텍스 사업자등록상태조회 프로그램 (0) 2020.03.05