-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvisualize_in_R.R
35 lines (28 loc) · 1.1 KB
/
visualize_in_R.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
setwd("/home/petra/Studium/SPAT_OPT/LandUseOptimization")
library(sf)
library(dplyr)
library(stars)
# load from /results
yield <- read.csv("./results/result_F1_yield.csv", sep = ",")
biomass <- read.csv("./results/result_F2_biomass.csv", sep = ",")
dist <- read.csv("./results/result_F3_dist.csv", sep = ",")
# make into sf data frames
yield$geometry <- as.character(yield$geometry)
yield$geometry <- as.list(yield$geometry)
yield <- st_as_sf(yield)
yield <- st_zm(yield, drop = TRUE)
biomass$geometry <- as.character(biomass$geometry)
biomass$geometry <- as.list(biomass$geometry)
biomass <- st_as_sf(biomass)
biomass <- st_zm(biomass, drop = TRUE)
dist$geometry <- as.character(dist$geometry)
dist$geometry <- as.list(dist$geometry)
dist <- st_as_sf(dist)
dist <- st_zm(dist, drop = TRUE)
# plot
plot(yield["mining"], pal = c("green", "grey"), main="yield")
plot(biomass["mining"], pal = c("green", "grey"), main="biomass")
plot(dist["mining"], pal = c("green", "grey"), main="distance")
write_sf(yield, "./results/best_yield.shp")
write_sf(biomass, "./results/best_bio.shp")
write_sf(dist, "./results/best_dist.shp")