我正在尝试组合几个不同的文件并将它们全部绘制在 R 中。我在 QGIS 中创建并导出了一个具有几个不同多边形的 shapefile。如果我使用此代码读取并绘制此文件:
#Reading in shapefile
shp <- readOGR( dsn =".", layer = "NRW_dominant_species")
species <- st_read('NRW_dominant_species.shp')
#Plotting basemap of species distribution
basemap <- ggplot(species) + geom_sf(aes(fill = Species))
basemap
此外,我添加了点数据并想将其绘制在这张地图的顶部:
#Reading in data
data <- read.csv("NRW_growing_stock_BAU.csv")
#Reading points
plots <- read.csv("NRW_plots.csv")
plots <- plots %>% dplyr::rename(plot = tmt.plot.id)
data <- left_join(data, plots, by="plot", all.x=TRUE)
data <- na.omit(data)
#Map with data
data <- subset(data, time = 2011)
map_with_data <- base_map +
geom_point(data = data, aes(x = longitude, y = latitude,color=volume_per_ha), size=1.5, inherit.aes = FALSE)
map_with_data
summary(species)
fid DN Species geometry
Min. : 1.0 Min. : 1.00 Length:627 POLYGON :627
1st Qu.:157.5 1st Qu.: 7.00 Class :character epsg:3035 : 0
Median :314.0 Median :13.00 Mode :character +proj=laea...: 0
Mean :314.0 Mean :11.46
3rd Qu.:470.5 3rd Qu.:16.00
Max. :627.0 Max. :19.00
summary(data)
plot time volume_per_ha latitude longitude
Length:73882 Min. :2011 Min. : 0.0 Min. :50.36 Min. :6.00
Class :character 1st Qu.:2021 1st Qu.: 194.6 1st Qu.:50.98 1st Qu.:6.99
Mode :character Median :2031 Median : 278.1 Median :51.30 Median :7.69
Mean :2031 Mean : 287.1 Mean :51.33 Mean :7.67
3rd Qu.:2041 3rd Qu.: 364.7 3rd Qu.:51.73 3rd Qu.:8.32
Max. :2051 Max. :1025.6 Max. :52.50 Max. :9.41
我正在努力找出解决这个问题的最佳方法。理想情况下,我想要做的是在
species
多边形下方添加一个 DEM,并使用 rayshader
绘制 3D 中的所有内容