Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.



share|improve this question

See this:

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


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.