Obtain random latitude and longitude within the range of 1km without superposition

  • lng X coordinate 1000 m range factor, 0.010520
  • lat Y coordinate 1000 m range factor, 0.009000
  • 500m = 1000 m Factor divided by 2 pay attention to the precision of the coefficient, rounded
  • 2000 m = 1000 m Factor multiplied by 2
  • 3000 m = 1000 m Factor multiplied by 3
  • 5000 m = 5000 m Factor multiplied by 5

for example, the current longitude and latitude A 115.016818 and 36.532544 plus that coefficient range is a set of longitude and latitude B distance A within the range of 1000m. I want to obtain several groups of random longitude and latitude. The distance from each other is not too dense. I would like to ask you what we should do about this. It was in a random form before, but we got that several groups of longitude and latitude were too dense between each other. Want each group of longitude and latitude to differ by more than 200 meters from each other,


A relatively simple way is to first divide the determined range into n cells, and then get a point in each interval with a random number, which will be relatively sparse. Adding a padding to the interval can prevent two points from being too close to each other.


Random must have repetition, and the so-called "non-repetitive random" is actually a shuffle.


the idea I can think of is that if you need to get N sets of longitudes and latitudes, first divide the circle 1 km from the current longitude and latitude [x, y] into N parts, and then find out the central points of the N parts. and then random on these N central points.

I hope I can help you.


was in the form of random number in the wrong way. Later, it was adopted to obtain the maximum and minimum longitude and latitude first, then take the decimal part of each maximum and minimum longitude and latitude, enlarge N times random, and then reduce N times to get a set of random longitude and latitude

.
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3fce0-2c4b6.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3fce0-2c4b6.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?