繁体   English   中英

使用纬度,经度和方位角在R中创建和绘制空间对象

[英]Create and Plot spatial objects in R with lat, long & azimuth

寻找一些帮助。我想创建基于R中绘制空间对象的latlongazimuth 方位角是给定纬度(长)处的角度间隔。 预期输出,如下图所示,其中对象用蓝色填充:

在此处输入图片说明

输入数据:

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)
#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)

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM