PHP MySQL get locations in radius user's location from GPS

前端 未结 5 1054
轻奢々
轻奢々 2020-12-17 03:27

I have in my database car incidents for example. These incidents have a latitude and longitude. On a mobile using the GPS, I get the user\'s location with his coordinates. T

5条回答
  •  盖世英雄少女心
    2020-12-17 03:35

    I did a quick search and turned up this blog post which gives a good explanation and SQL to select records in a given radius.

    In the comments, he suggests "For speed on large datasets you probably want to grab a square block around the origin point first by adding a mile or so to and from both lat/lon for origin and then using the above as a subselect to work from the middle out" which sounds to me like the way to go.

提交回复
热议问题