我正在尝试从起点和向南和向东行驶的距离计算纬度 lng 点。我将使用什么地圈函数来计算?
new_coordinate <- nc(latitude, longitude, km_south, km_east)
new_coordinate
[1] 49.49578 -101.48574
我试过从互联网上手动计算,但似乎没有什么对我有用。我确保使用弧度。
coords <- function(cells_south, cells_east) {
start_lat <- 52.285883
start_lng <- -101.497821
cells_south <- 3000
cells_east <- 2500
kmeast<-cells_east/10 #each cell 100 m
kmsouth<-cells_south/10
#Latitude: 1 deg = 110.574 km
#Longitude: 1 deg = 111.320*cos(latitude) km
#lng_east <- (kmeast / (111.320 * cos(start_lat*(pi/180)))) + start_lng
#lat_south <- start_lat - (kmsouth /110.574)
#elevation <- dem$data[cells_south,cells_east] #elevation from ascii grid
#Lets try calculating the distance from the north west origin
theta <- 270 * pi /180
cos_a = cos(theta)
sin_a = sin(theta)
cl <- cos(start_lat)
# r = 100 meters.
east_displacement = 100 * 0.5 / cl / 111111
south_displacement = 100 * cos_a / 111111
ret<-(c(start_lat-south_displacement,start_lng+east_displacement))
lat1<-start_lat
tc <- 0*pi / 270
d<-kmsouth
lon1 <- start_lng
lat =asin(sin(lat1)*cos(d)+cos(lat1)*sin(d)*cos(tc))
dlon=atan2(sin(tc)*sin(d)*cos(lat1),cos(d)-sin(lat1)*sin(lat))
lon=(lon1-dlon +pi %% 2*pi )-pi
}
52.28588 -101.49886
认为它应该在附近
57.760 -99.764
(根据谷歌地图推测东 300 公里 250 公里。)