Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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.

share|improve this question
1  

1 Answer 1

See this:

http://www.codeguru.com/Cpp/Cpp/algorithms/article.php/c5115

It's very well explained. You should not have problems to convert the code to php.

If I understand well what you want, you would use Problem 1B to find the azimuth and them the problem 1C to get your coordinate.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.