在半径上生成随机 GPS 点

Generate random GPS Points on a Radius

有没有办法在给定半径上的 2 个点之间生成随机点? 正如您在我的绘图中看到的:A 点和 B 点是已知的。 r 也是已知的。我正在寻找一种在 G 和 F 之间生成点 1、2、3 的方法。我没有点 G 和 F。拥有那些 G 和 F 点不是必须的。我把这些点以某种方式定义了一个范围。例如,点 1、2、3 之间的给定距离可能是这样的定义。也就是说,半径上的随机点彼此之间的距离为 5 公里,方位已知。有没有一个包或一种方法来实现这一目标? 非常感谢您!

经过一番研究后,我使用了这个解决方案。 我希望其他人会发现它很有趣。

points_on_a_circle <- function(p1,p2,rb_wgs84,km_distance){
  
  LatDec = p1[2]
  LonDec = p1[1]
  b <- geosphere::bearingRhumb(p1, p2)
  Km = km_distance
  ER <- 6371 #Mean Earth radius in kilometers. Change this to 3959 and you will have your function working in miles.
  AngDeg <- seq((b - 40),(b + 40)) #angles in degrees / Set G and F borders
  Lat1Rad <- LatDec*(pi/180)#Latitude of the center of the circle in radians
  Lon1Rad <- LonDec*(pi/180)#Longitude of the center of the circle in radians
  AngRad <- AngDeg*(pi/180)#angles in radians
  Lat2Rad <- asin(sin(Lat1Rad)*cos(Km/ER) + cos(Lat1Rad)*sin(Km/ER)*cos(AngRad)) #Latitude of each point of the circle rearding to angle in radians
  Lon2Rad <- Lon1Rad + atan2(sin(AngRad)*sin(Km/ER)*cos(Lat1Rad),cos(Km/ER) - sin(Lat1Rad)*sin(Lat2Rad))#Longitude of each point of the circle rearding to angle in radians
  Lat2Deg <- Lat2Rad*(180/pi)#Latitude of each point of the circle rearding to angle in degrees (conversion of radians to degrees deg = rad*(180/pi) )
  Lon2Deg <- Lon2Rad*(180/pi)#Longitude of each point of the circle rearding to angle in degrees (conversion of radians to degrees deg = rad*(180/pi) )
  point_on_circle <- cbind(Lon2Deg,Lat2Deg)
  
  return(point_on_circle)
  
}