PHP calculates the maximum minimum latitude and longitude instance in 4 corners in the current coordinates 3 km

Source: Internet
Author: User
Tags php database php programming
This example describes the PHP method for calculating the maximum minimum latitude and longitude of 4 corners in the current coordinates of 3 km. Share to everyone for your reference, 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 ' = The 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 readers interested in PHP related content can view the topic: "PHP Date and Time usage summary", "PHP Object-oriented Programming tutorial", "PHP string (String) Usage Summary", "Php+mysql database operation Getting Started tutorial" and " A summary of common PHP database operation techniques

I hope this article is helpful to you in PHP programming.

The above describes the PHP calculation of the current coordinates of 3 kilometers in 4 corners of the largest minimum latitude and longitude examples, including the content of the text, I hope that the PHP tutorial interested friends helpful.

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.