Ashwin
Ashwin

Reputation: 5

Add X meters in Latitude and Longitude and generate new latitude and longitude in PHP

Suppose I have latitude= 21.15490584 and longitude= 79.04627271 and add X meters, am I able to calculate new coordinates?

Upvotes: -1

Views: 2766

Answers (1)

Sarvan Kumar
Sarvan Kumar

Reputation: 934

I think this one is worked for you...

Can you please check this...

<?php
$meters = 30;
$coef = $meters * 0.0000089;
echo $new_lat = 13.0406067 + $coef;
echo "<br>";
echo $new_long = 80.1925414 + $coef / cos(13.0406067 * 0.018);
?>

In the above example i have added 30 meters...

Upvotes: 0

Related Questions