How does PHP determine the longitude and latitude range of a point within a certain distance?

Source: Internet
Author: User
** @ Paramdouble $ x longitude @ paramdouble $ y latitude @ paramdouble $ d distance from the unit of meters @ returnarray * functiongetrange ($ x, $ y, $ d, $ x indicates the longitude of a vertex $ y indicates the latitude of a vertex $ d returns the latitude and longitude range from the distance from the vertex /**

  • @ Param double $ x longitude

  • @ Param double $ y latitude

  • @ Param double $ d Distance unit/Meter

  • @ Return array
    */

Function getrange ($ x, $ y, $ d ){

}

The above function,
$ X indicates the longitude of a vertex.
$ Y indicates the point latitude
$ D distance from this point
Returns the longitude and latitude range.

Reply content:

/**

  • @ Param double $ x longitude

  • @ Param double $ y latitude

  • @ Param double $ d Distance unit/Meter

  • @ Return array
    */

Function getrange ($ x, $ y, $ d ){

}

The above function,
$ X indicates the longitude of a vertex.
$ Y indicates the point latitude
$ D distance from this point
Returns the longitude and latitude range.

Go to Google and "calculate the distance between two points by latitude and longitude"

If the precision requirement is not high, you can calculate it by yourself. Do you know the radius of the earth? Longitude divides the earth's surface into 360 equals points, and latitude is divided into 180 equals points. In this way, the longitude and latitude ranges that span are calculated based on the distance and the given center point.

If the precision requirement is high, you 'd better check whether there are any third-party professional interfaces available (such as Google Maps, AMAP maps, Baidu maps)

Isn't that a mathematical problem?

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.