【发布时间】:2021-11-03 06:48:51
【问题描述】:
我想获得新点的坐标,最好使用 sf 包,当初始位置以及行进的距离和航向已知时。 考虑一下;我们有三个点(pts),附有一个航向和一个以公里为单位的距离。如何找到新位置的坐标?
library(data.table, dplyr, sf)
dat <- data.table(lon = c(10,10.1,10.4), lat = c(58.4,57.4,57.8),
heading = c(45,10,235), distance_km = c(1,5.3,3))
pts <- dat %>%
sf::st_as_sf(coords = c("lon","lat")) %>%
sf::st_set_crs(4326)
Simple feature collection with 3 features and 2 fields
Geometry type: POINT
Dimension: XY
Bounding box: xmin: 10 ymin: 57.4 xmax: 10.4 ymax: 58.4
Geodetic CRS: WGS 84
heading distance_km geometry
1 45 1.0 POINT (10 58.4)
2 10 5.3 POINT (10.1 57.4)
3 235 3.0 POINT (10.4 57.8)
正在考虑围绕这些点制作圆圈,但不知道如何将点连接到具有正确航向的圆圈。
buf <- st_buffer(pts, dist = pts$distance_km*1000)
circ <- st_cast(buf, "LINESTRING")
【问题讨论】:
标签: distance sf heading 360-degrees