This article describes the method for PHP to calculate the maximum minimum latitude and longitude of 4 corners within 3 km of the current coordinates. Share to everyone for your reference, specific as follows:
$LNG, $lat latitude and longitude
$half = 6371;
$distance = 3; 3 km
$DLNG = 2 * ASIN (SIN ($distance/(2 * $half))/cos (Deg2rad ($lat)));
$DLNG = Rad2deg ($DLNG);
$dlat = $distance/$half;
$dlat = Rad2deg ($dlat);
$fourpoint = Array ('
left-top ' => array (' lat ' => $lat + $dlat, ' LNG ' => $lng-$dlng),
' Right-top ' => Array (' lat ' => $lat + $dlat, ' LNG ' => $lng + $dlng),
' Left-bottom ' => array (' lat ' => $lat-$dlat, ' LNG ' => $lng-$dlng),
' Right-bottom ' => array (' lat ' => $lat-$dlat, ' LNG ' => $lng + $dlng)
);
More interested in PHP related content readers can view the site topics: "PHP date and Time usage summary", "PHP object-oriented Programming Introduction Tutorial", "PHP string (String) Usage Summary", "Php+mysql Database Operation Introduction" and " A summary of common PHP database operations tips
I hope this article will help you with the PHP program design.