Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 880337
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T12:04:52+00:00 2026-05-15T12:04:52+00:00

I have 2 coordinates. Coordinate 1 is a ‘person’. Coordinate 2 is a destination.

  • 0

I have 2 coordinates. Coordinate 1 is a ‘person’. Coordinate 2 is a destination.

How do I move coordinate 1 100 meters closer to coordinate 2?

This would be used in a cron job, so only php and mysql included.

For example:

Person is at: 51.26667, 3.45417

Destination is: 51.575001, 4.83889

How would i calculate the new coordinates for Person to be 100 meters closer?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T12:04:53+00:00Added an answer on May 15, 2026 at 12:04 pm

    Use Haversine to calculate the difference between the two points in metres; then adjust the value of the person coordinates proportionally.

    $radius = 6378100; // radius of earth in meters
    $latDist = $lat - $lat2;
    $lngDist = $lng - $lng2;
    $latDistRad = deg2rad($latDist);
    $lngDistRad = deg2rad($lngDist);
    $sinLatD = sin($latDistRad);
    $sinLngD = sin($lngDistRad);
    $cosLat1 = cos(deg2rad($lat));
    $cosLat2 = cos(deg2rad($lat2));
    $a = ($sinLatD/2)*($sinLatD/2) + $cosLat1*$cosLat2*($sinLngD/2)*($sinLngD/2);
    if($a<0) $a = -1*$a;
    $c = 2*atan2(sqrt($a), sqrt(1-$a));
    $distance = $radius*$c;
    

    Feeding your values of:

    $lat = 51.26667;        //  Just South of Aardenburg in Belgium
    $lng = 3.45417;
    $lat2 = 51.575001;      //  To the East of Breda in Holland
    $lng2 = 4.83889;
    

    gives a result of 102059.82251083 metres, 102.06 kilometers

    The ratio to adjust by is 100 / 102059.82251083 = 0.0009798174985988102859004569070625

    $newLat = $lat + (($lat2 - $lat) * $ratio);
    $newLng = $lng + (($lng2 - $lng) * $ratio);
    

    Gives a new latitude of 51.266972108109 and longitude of 3.4555267728867

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a bunch of files with coordinates in UTM form. For each coordinate
I would like use a panel whose children have coordinates specified as percentage of
I have coordinates from some source and want to tag my jpg files with
Problem: a table of coordinate lat/lngs. Two rows can potentially have the same coordinate.
I have a function that identify coordinates on a page, and I am returning
I have a list of more than 15 thousand latitude and longitude coordinates. Given
I have a table where I'm storing Lat/Long coordinates, and I want to make
I have a bunch of latitude/longitude pairs that map to known x/y coordinates on
I have the coordinates (X,Y) of a point in an HTML document. How do
Have just started using Google Chrome , and noticed in parts of our site,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.