The content presented in this repo will be used in a future package (still under development).
-
maps:
-
hex_cropped_portugal_100km2.gpkg, hex map of Mainland Portugal, cropped by Mainland geometry (border), with 100 km2 area for each (not all) hex polygon
-
Other maps are present for reusability in other projects:
-
hex_cropped_portugal_25km2.gpkg, same as above but with 25km2 area for each (not all) hex polygon
-
square_cropped_portugal_100km2.gpkg, now with square grids with 100km2 area for each (not all) square polygon
-
square_uncropped_portugal_100km2.gpkg, square grid with 100km2 area for each square polygon, not cropped by the Mainland Portugal geometry (border)
-
utm10+ilhas.gpkg, downloaded from Atlas of Mammals in Portugal, GitHub Repo
-
-
-
data: strictly related with map (Gridded map of Mainland Portugal in hexagons of about 100 km2), through the variable grid_id which is present in both files. Data was worked out based on the grid of the map
-
population: human_pop_density.csv, GHSL - Global Human Settlement Layer, variables ("grid_id" "population_km2")
-
co2_emission: co2_emissions_density.csv, Global Greenhouse Gas Emissions - EDGAR v8.0, variables ("grid_id" "co2_emission_km2")
-
gas_stations: gas_stations_density.csv, Data: @OpenStreetMap contributors, variables ("grid_id" "gas_stations_km2")
-
-
scripts (R code to generate maps and data):
-
hex_map_100.r: R code to generate hexagonal grid map of Mainland Portugal, cropped by Mainland geometry (border), with 100 km2 area for each (not all) hex polygon. The output of this script is present on the folder maps.
-
hex_map_25.r: R code to generate hexagonal grid map of Mainland Portugal, cropped by Mainland geometry (border), with 25 km2 area for each (not all) hex polygon. The output of this script is present on the folder maps.
-
square_map_100.r: R code to generate square grid map of Mainland Portugal, cropped by Mainland geometry (border), with 100 km2 area for each (not all) square polygon. The output of this script is present on the folder maps.
-
square_uncropped_map_100.r: R code to generate square grid map of Mainland Portugal, uncropped by Mainland geometry (border), with 100 km2 area for each square polygon. The output of this script is present on the folder maps.
-
data_wrangling_population.r: R code to generate Human population density per km2.
-
data_wrangling_co2_emissions.r: R code to generate CO2 emission density in ktons per km2.
-
data_wrangling_osm_data.r: R code to generate number of Gas Stations per km2.
-
-
vignettes: practical examples to help users get the most out of this repo.
-
plot_map.r: R code that uses get_map() function to load hex gridded map of Mainland Portugal with 100km2 area for each polygon (not all - because is cropped by Mainland Portugal geometry), and creates the respective plot;
-
analyse_layers.r: R code to analyze get_layer(layer), a function that loads a .csv file with columns grid_id and the layer to analyze (population per km2, co2 emissions per km2, ...), the results from files on the scripts directory.
- layer = "human", human population per km2
- layer = "co2", co2 emissions per km2
- layer = "gas_stations", number of gas stations per km2
- layer = ...
-
population.r: R code exemplifying the application of functions get_map() and get_layer(layer), to layer = "human" (population per km2)
-
co2_emissions.r: R code to generate plot co2_emissions_density.png and co2_emissions_density_choropleth.png
-
correlation.r: R code to generate corretation between two variables. Plots: correlation_co2_pop.png, ...
-
gas_stations.r: R code to generate plot gas_stations_density_choropleth.png
-
Vignette file: plot_map.r
Vignette file: population.r
Vignette file: co2_emissions.r
Vignette file: correlation.r
Vignette file: gas_stations.r
Note: This repository is primarlly inspired by the work carried out by Benjamin Nowak (@BjnNowak) with its amazing package {frex}
How to fill maps with density gradients with R, {ggplot2}, and {sf}




