I already have a formula that can calculate the distance between 2 geographic coordinates:
public function getGeoDistance(Coordinate $geoCoord1,Coordinate $geoCoord2){
if(is_object($geoCoord1) && is_object($geoCoord2)){
$aR = $geoCoord1->getLatitude()*(M_PI/180);
$bR = $geoCoord2->getLatitude()*(M_PI/180);
$latD = ($geoCoord2->getLatitude()-$geoCoord1->getLatitude())*(M_PI/180);
$longD = ($geoCoord2->getLongitude()-$geoCoord1->getLongitude())*(M_PI/180);
$a = pow(sin($latD/2), 2)+cos($aR)*cos($bR)*pow(sin($longD/2), 2);
$c = 2*atan2(sqrt($a), sqrt(1-$a));
return self::getWorldRadius()*$c;
}
return -1;
}
Now, i want to create another function that can calculate coordinates from another coordinate pair and distance value. The prototype is:
public function getGeoByGeoAndDistance(Coordinate $geoCoord1,int $distance):Coordinate
Does someone know the math beyond it?
P.S. the code is in PHP.
thanks.
Shlomi.