diff --git a/figures/create_admin_barplot-1.png b/figures/create_admin_barplot-1.png index 74febfb..c4fe680 100644 Binary files a/figures/create_admin_barplot-1.png and b/figures/create_admin_barplot-1.png differ diff --git a/figures/create_choropleth_others-1.png b/figures/create_choropleth_others-1.png index 9b952ea..2ba6c94 100644 Binary files a/figures/create_choropleth_others-1.png and b/figures/create_choropleth_others-1.png differ diff --git a/figures/create_choropleth_others-2.png b/figures/create_choropleth_others-2.png index 651767b..6eabc04 100644 Binary files a/figures/create_choropleth_others-2.png and b/figures/create_choropleth_others-2.png differ diff --git a/figures/create_choropleth_others-3.png b/figures/create_choropleth_others-3.png index 408da16..55541c0 100644 Binary files a/figures/create_choropleth_others-3.png and b/figures/create_choropleth_others-3.png differ diff --git a/figures/create_simd_barplot-1.png b/figures/create_simd_barplot-1.png index e156aa7..194881b 100644 Binary files a/figures/create_simd_barplot-1.png and b/figures/create_simd_barplot-1.png differ diff --git a/figures/create_ur_barplot-1.png b/figures/create_ur_barplot-1.png index 0ad0b87..a78321b 100644 Binary files a/figures/create_ur_barplot-1.png and b/figures/create_ur_barplot-1.png differ diff --git a/figures/create_urbanrural_ecs_chart_choropleth-1.png b/figures/create_urbanrural_ecs_chart_choropleth-1.png index d3770c5..d2d57f3 100644 Binary files a/figures/create_urbanrural_ecs_chart_choropleth-1.png and b/figures/create_urbanrural_ecs_chart_choropleth-1.png differ diff --git a/figures/plot_admin_ecs_admin2_choropleth-1.png b/figures/plot_admin_ecs_admin2_choropleth-1.png index 5f13b35..5200f2f 100644 Binary files a/figures/plot_admin_ecs_admin2_choropleth-1.png and b/figures/plot_admin_ecs_admin2_choropleth-1.png differ diff --git a/figures/plot_admin_ecs_choropleth-1.png b/figures/plot_admin_ecs_choropleth-1.png index 46510ae..05caf24 100644 Binary files a/figures/plot_admin_ecs_choropleth-1.png and b/figures/plot_admin_ecs_choropleth-1.png differ diff --git a/figures/plot_admin_ecs_normed_choropleth-1.png b/figures/plot_admin_ecs_normed_choropleth-1.png index 3787e43..c8414e3 100644 Binary files a/figures/plot_admin_ecs_normed_choropleth-1.png and b/figures/plot_admin_ecs_normed_choropleth-1.png differ diff --git a/figures/plot_admin_ecs_normed_choropleth-2.png b/figures/plot_admin_ecs_normed_choropleth-2.png index 353491b..c3444c1 100644 Binary files a/figures/plot_admin_ecs_normed_choropleth-2.png and b/figures/plot_admin_ecs_normed_choropleth-2.png differ diff --git a/mapping_draft.Rmd b/mapping_draft.Rmd index 9e4b12c..eb16f54 100644 --- a/mapping_draft.Rmd +++ b/mapping_draft.Rmd @@ -1103,6 +1103,16 @@ write.csv(forest_inventory_counts_merged, "derivedData/forest_inventory_counts_m # TODO: Add ggplot overlaying all three wilderness area types with different colours for polygons + points of ecs with different colouration and colour intensity at 3 bins for dots within buffers at each level (0/50/500m) # Note: there seems to be a problem with ggplot rendering these shapefiles - as it takes well over 10 hours to plot currently even on the smaller sssi shapefile. +# Simplify geometries for plotting + +sssi_simple <- sf::st_simplify(sssi_sf) + +# Plot SSSI polygons with ECS points (using sp, for now) + +plot(sssi_simple, col='#aaaaaa', border=0) +plot(ecs_sf, col = 'red', add=TRUE) + + ``` diff --git a/testing_sf_plot_times.R b/testing_sf_plot_times.R index 1086e85..02c7a01 100644 --- a/testing_sf_plot_times.R +++ b/testing_sf_plot_times.R @@ -5,8 +5,9 @@ require(sp) # needed for proj4string, deprecated by sf() require(rgdal) # version version: 1.3-6 require(rgeos) # used for buffering below require(devtools) +require(ggplot2) -setwd("~/Downloads/test") +# setwd("~/Downloads/test") # load data transition_wgs <- read.csv(text=getURL("https://zenodo.org/record/165519/files/SCCAN_1.4.csv")) @@ -23,16 +24,47 @@ unzip("SSSI_SCOTLAND_ESRI.zip") unzip("National_Forest_Inventory_Woodland_Scotland_2017.zip") -sssi_sf <- st_read("SSSI_SCOTLAND.shp") -sssi_sp <- readOGR("./", "SSSI_SCOTLAND") +sssi_sf <- st_read("./data/SSSI_SCOTLAND.shp") +sssi_sp <- readOGR("./data", "SSSI_SCOTLAND") -forest_inventory_sf <- st_read("National_Forest_Inventory_Woodland_Scotland_2017.shp") -forest_inventory_sp <- readOGR("./", "National_Forest_Inventory_Woodland_Scotland_2017") +forest_inventory_sf <- st_read("./data/National_Forest_Inventory_Woodland_Scotland_2017.shp") +forest_inventory_sp <- readOGR("./data", "National_Forest_Inventory_Woodland_Scotland_2017") + +# Test validity of geometry + +rgeos::gIsValid(sssi_sp) +valid <- st_is_valid(sssi_sf) + valid[valid == FALSE] + +# Alternative approach from stackexchange using simplified geometry + + sssi_sp2 <- rgeos::gSimplify(sssi_sp, tol=3) + par(mfrow=c(1,2)) + plot(sssi_sp[1,]) + plot(sssi_sp2[1,]) + + system.time( + sssi_b1000 <- rgeos::gBuffer(sssi_sp2, width = 20, quadsegs = 30) + ) + + sssi_sf2 <- sf::st_simplify(sssi_sf) + system.time( + sssi_b1000 <- sf::st_buffer(sssi_sf2, dist = 20) + ) + +# Render ggplot2 plot on simplified geometry + +ggplot(sssi_sf2) + geom_sf(aes(fill = PA_CODE)) +plot(sssi_sf2) # First test out plots using spatialfeatures and spdf with core R system.time( -plot(sssi_sf) +plot(sssi_sf2) + ) + +system.time( + plot() ) system.time(