寻求帮助..
我正在尝试根据lat
,long
&创建和绘制R中的空间对象。 azimuth
。方位角是给定纬度的角度分离,长。预期输出如下图所示,其中对象用蓝色填充:
输入数据:
df <- data.frame(Latitude = c(32.897, 32.897, 32.897, 32.811, 32.811, 32.811),
Longitude = c(-97.04, -97.04, -97.04, -97.12, -97.12, -97.12),
Azimuth = c(0, 120, 240, 60, 200, 240),
Site = c("A", "A", "A", "B", "B", "B"),
Sector = c(1,2,3,1,2,3),
stringsAsFactors = F)
答案 0 :(得分:0)
#Convert df into a spatial object:
library(sp)
coordinates(df)<-~Longitude+Latitude
#Simple plot:
plot(df, col="Blue")
#Plot with icons:
plot(df, col="Blue", pch=24)
plot(df, col="Blue", pch=25, add=TRUE)
#Plot on a map: (You need the associated projection)
proj4string(df) = CRS("+proj=longlat +datum=WGS84 +ellps=WGS84 +towgs84=0,0,0")
library(mapview)
mapview(df)