일부 GPS 좌표에서 북쪽, 남쪽, 서쪽 및 동쪽으로 500m 떨어진 새 좌표를 가져와야합니다.gps coordinates + meters
위도 : 45.815005 긴 : 15.978501가
가 보자,
로 시작하는이 작업을 수행하는 방법에 대한 지식없이, 당신에게
일부 GPS 좌표에서 북쪽, 남쪽, 서쪽 및 동쪽으로 500m 떨어진 새 좌표를 가져와야합니다.gps coordinates + meters
위도 : 45.815005 긴 : 15.978501가
가 보자,
로 시작하는이 작업을 수행하는 방법에 대한 지식없이, 당신에게
음을 감사 aproximate 수 있습니다 솔루션의 어떤 종류 I 올 수 있습니다.
각 경도의 길이가 항상 같기 때문에 남북을 쉽게 구할 수 있으므로 거리와 각도를 연결해야하고 따라서 지구의 둘레를 미터 단위로 계산하여 계산할 수 있습니다 360도를 나눔으로써 미터 당 각도를 제공합니다. 그러나 위도의 선의 길이가 적도에서 멀수록 멀어 지므로 미터 당 위도가 바뀌므로 기하학적/삼각 함수가됩니다. 자, 내가 삼각형에 대해 알고있는 것으로부터, cos (deg) * (pi * d) = 도의 구도의 평면에 평행 한 원의 둘레. degree는 북쪽 또는 남쪽의도입니다. d는 구의 직경이다.
그럼 보겠습니다.
<?php
$lat = 45.815005;
$long = 15.978501;
$meters = 500; //Number of meters to calculate coords for north/south/east/west
$equator_circumference = 6371000; //meters
$polar_circumference = 6356800; //meters
$m_per_deg_long = 360/$polar_circumference;
$rad_lat = ($lat * M_PI/180); //convert to radians, cosine takes a radian argument and not a degree argument
$m_per_deg_lat = 360/(cos($rad_lat) * $equator_circumference);
$deg_diff_long = $meters * $m_per_deg_long; //Number of degrees latitude as you move north/south along the line of longitude
$deg_diff_lat = $meters * $m_per_deg_lat; //Number of degrees longitude as you move east/west along the line of latitude
//changing north/south moves along longitude and alters latitudinal coordinates by $meters * meters per degree longitude, moving east/west moves along latitude and changes longitudinal coordinates in much the same way.
$coordinates['north']['lat'] = $lat + $deg_diff_long;
$coordinates['north']['long'] = $long;
$coordinates['south']['lat'] = $lat - $deg_diff_long;
$coordinates['south']['long'] = $long;
$coordinates['east']['lat'] = $lat;
$coordinates['east']['long'] = $long + $deg_diff_lat; //Might need to swith the long equations for these two depending on whether coordinates are east or west of the prime meridian
$coordinates['west']['lat'] = $lat;
$coordinates['west']['long'] = $long - $deg_diff_lat;
?>
적어도 나는 그것을 얻을 것이라고 생각합니다. 나는 완전히 틀릴지도 모른다. 원산지와의 차이가있는 좌표가 500m 밖에 떨어지지 않을 정도로 작습니다.
도 단위당 미터 단위로 전환되었지만 변수 이름은 동일하게 유지되었습니다.
이 답변은 저에게 매우 유용했습니다. 내가하려는 것은 Google 어스 용 KML에서 서클을 그리는 것이 었습니다. 그래서 두 반경에 대해 $ deg_diff_long과 $ deg_diff_lat를 사용했습니다. 그러나 반경이 너무 커서 반경이 너무 길어서 2 * M_PI로 나누면 완벽 해집니다. (그들은 내 프로젝트가 Heremap에 그려주는 시클릿에 동의합니다). 이유를 알면 저를 계몽하십시오. – soger
가능한 복제본 : http://stackoverflow.com/questions/5390497/calculating-gps-coordinate-radius – Czechnology
MySQL 데이터베이스로 작업하는 경우 위의 SO 질문이 도움이 될 수 있습니다. PHP 만 사용하는 경우 "Great Circle Calculator"를 검색하십시오. 베어링과 거리를 기준으로 Lat/Long Co-Ords를 계산할 수 있으며 그 반대의 경우도 마찬가지입니다. –
감사합니다.이게 내가 필요한 것입니다. – mgalesic