-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add map information and evaluation pages
- Loading branch information
Showing
7 changed files
with
265 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
--- | ||
title: "Map evaluation" | ||
subtitle: "Information on map quality" | ||
format: html | ||
execute: | ||
echo: false | ||
--- | ||
|
||
We will add here information about map quality as evaluated by our expert's group. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,46 @@ | ||
--- | ||
listing: | ||
contents: map-info | ||
type: table | ||
categories: true | ||
sort-ui: [title, subtitle] | ||
fields: [title, subtitle] | ||
field-display-names: | ||
title: "Ecosystem functional group" | ||
subtitle: "Biome" | ||
sort: | ||
- "subtitle" | ||
- "title" | ||
title: "Map information" | ||
subtitle: "Current (valid) maps" | ||
execute: | ||
echo: false | ||
warning: false | ||
message: false | ||
--- | ||
|
||
# Map information | ||
|
||
## General notes on maps: | ||
## General notes on maps | ||
|
||
The maps in each profile show areas of the world containing major or minor occurrences of the ecosystem functional group. Minor occurrences are areas where an EFG is scattered in patches within matrices of others or where they occur in substantial areas but only within a segment of a larger region. | ||
|
||
The maps were designed to be indicative of global distribution patterns and are not intended to represent fine-scale patterns. Given bounds of resolution and accuracy of source data, the maps should be used to query which EFG are likely to occur within areas, rather than which occur at particular point locations. | ||
|
||
## List of maps | ||
## List of maps | ||
|
||
:::{.callout-tip} | ||
## Valid maps | ||
These links will show the current or valid maps for each functional group. Please check that the map code and version information matches the data you are using. If you are working with a different version of the map, you can look at the version history [here](map-version-history.qmd). | ||
::: | ||
|
||
|
||
```{r} | ||
library(readxl) | ||
library(dplyr) | ||
library(readr) | ||
library(DT) | ||
library(stringr) | ||
here::i_am("map-version-history.qmd") | ||
out_folder <- here::here("gisdata", "profiles") | ||
dest_file <- here::here(out_folder, "biome-names.csv") | ||
biome_names <- read_csv(dest_file, show_col_types = FALSE) |> | ||
rename("biome code" = "biome_code" , "biome name" = "name") | ||
dest_file <- here::here(out_folder, "IUCN-GET-profiles-exported.xlsx") | ||
profile_info <- read_excel(dest_file, sheet = 2) |> | ||
left_join(biome_names, by = "biome code") | ||
altmap_table <- profile_info |> | ||
transmute(Biome = `biome name`, `Ecosystem functional group` = sprintf("<a href='map-info/%2$s_valid.html'>%1$s</a>", `name`, str_replace(`code`,"\\.", "_"))) | ||
DT::datatable(altmap_table, rownames = FALSE, escape = FALSE, filter = 'top', | ||
options = list(dom = 'tpl', pageLength = 25)) | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,135 @@ | ||
--- | ||
title: "Map updates" | ||
subtitle: "Priorities for map updates" | ||
format: html | ||
execute: | ||
echo: false | ||
--- | ||
|
||
As part of our data curation process we consider updates and improvements to all the maps. This is currently done in an irregular basis depending on time and resource availability. | ||
|
||
We have set up some priorities for map development and updates, but we also consider issues raised by users. Please add your comments and suggestions using the dialogue boxes below each page, or go directly to our GitHub repository. | ||
|
||
|
||
```{r} | ||
#| message: false | ||
#| warning: false | ||
#library(ggplot2) | ||
library(dplyr) | ||
#library(DT) | ||
#library(igraph) | ||
#library(stringr) | ||
#library(tidyr) | ||
#library(lubridate) | ||
library(RPostgreSQL) | ||
# load("Map-evaluation-data.rda") | ||
here::i_am("map-updates.qmd") | ||
``` | ||
|
||
```{r} | ||
#| message: false | ||
#| warning: false | ||
#| results: false | ||
drv <- dbDriver("PostgreSQL") ## remember to update .pgpass file | ||
con <- dbConnect(drv, | ||
dbname = Sys.getenv("DBNAME"), | ||
host = Sys.getenv("DBHOST"), | ||
port = Sys.getenv("DBPORT"), | ||
user = Sys.getenv("DBUSER")) | ||
qry <- " | ||
select license, count(*) as n | ||
from map_evaluation | ||
left join map_metadata USING(map_code,map_version) | ||
where status = 'valid' and map_type = 'Indicative Map' | ||
GROUP BY license; | ||
" | ||
maps_licenses <- dbGetQuery(con,qry) | ||
qry <- " | ||
SELECT license, evaluation[1] as evaluation, count(*) as N | ||
FROM map_evaluation | ||
LEFT JOIN map_metadata USING (map_code, map_version) | ||
WHERE status = 'valid' AND map_type = 'Indicative Map' | ||
GROUP BY license, evaluation | ||
ORDER BY license, evaluation; | ||
" | ||
license_evaluation <- dbGetQuery(con,qry) | ||
dbDisconnect(con) | ||
``` | ||
|
||
|
||
## Checking dataset licenses | ||
|
||
First we check the dataset licenses and aim to replace datasets that have any restrictions of use. | ||
|
||
```{r} | ||
license_evaluation_summary <- | ||
license_evaluation |> | ||
transmute(`datasets used` = case_when( | ||
license %in% 'Non-commercial use' ~ "restricted use", | ||
license %in% c(NA, 'Undocumented', 'See contact info') ~ "unclear/undocumented", | ||
TRUE ~ "commercial use allowed" | ||
), | ||
`Evaluation` = case_when( | ||
evaluation %in% c("Medium quality map", "Medium quality map series") ~ "Good enough", | ||
evaluation %in% "Coarse quality map" ~ "Unsatisfactory", | ||
evaluation %in% c("Fine quality map", "Fine quality map series") ~ "Best", | ||
TRUE ~ evaluation | ||
), | ||
n | ||
) | ||
``` | ||
|
||
```{r} | ||
license_evaluation_summary |> | ||
group_by(`datasets used`) |> | ||
summarise(total = sum(n), .groups = "drop") |> | ||
knitr::kable() | ||
``` | ||
|
||
## Improving quality | ||
|
||
The second step is to review map quality as we aim to create higher quality maps with better overall evaluation: | ||
|
||
```{r} | ||
license_evaluation_summary |> | ||
filter(`datasets used` %in% "commercial use allowed") |> | ||
group_by(`Evaluation`) |> | ||
summarise(total = sum(n), .groups = "drop") |> | ||
knitr::kable() | ||
``` | ||
|
||
## Next steps | ||
|
||
|
||
```{mermaid} | ||
%%| theme: forest | ||
%%| label: priorities | ||
%%| fig-cap: | | ||
%%| Summary of license and evaluation of EFG maps to identify | ||
%%| priorities for map updates. | ||
flowchart TB | ||
check1(["Check datasets used:\n license?"]):::checks | ||
check2(["Check:\n - spatial resolution\n- validation\n- concept match\n(uncertainty)"]):::checks | ||
step1(["Search\navailable/new\n datasets"]):::checks | ||
ready(["Hurray!"]):::done | ||
almostready([Best possible version\nflag any issues]):::done | ||
classDef checks fill:#d0e9fa,stroke:#000 | ||
classDef steps fill:#d0d93a,stroke:#000 | ||
classDef done fill:#c6fc9c,stroke:#000 | ||
check1 -->|n=37 allows\ncommercial use| check2 | ||
check1 -->|n=62 restricted use| step1 | ||
check1 -.->|n=7 unclear/undocumented| step1 | ||
check2 -->|n=14 golden standard| ready | ||
check2 -->|n=5 not perfect\nbut close enough| almostready | ||
check2 -->|n=18 unsatisfactory| step1 | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
--- | ||
title: "Map version history" | ||
execute: | ||
echo: false | ||
warning: false | ||
message: false | ||
--- | ||
|
||
## General notes on maps | ||
|
||
The maps in each profile show areas of the world containing major or minor occurrences of the ecosystem functional group. Minor occurrences are areas where an EFG is scattered in patches within matrices of others or where they occur in substantial areas but only within a segment of a larger region. | ||
|
||
The maps were designed to be indicative of global distribution patterns and are not intended to represent fine-scale patterns. Given bounds of resolution and accuracy of source data, the maps should be used to query which EFG are likely to occur within areas, rather than which occur at particular point locations. | ||
|
||
## Version history | ||
|
||
Please follow the links in the following table to review the version history for a particular functional group. You can filter by biome name or functional group name. | ||
|
||
```{r} | ||
library(readxl) | ||
library(dplyr) | ||
library(readr) | ||
library(DT) | ||
library(stringr) | ||
here::i_am("map-version-history.qmd") | ||
out_folder <- here::here("gisdata", "profiles") | ||
dest_file <- here::here(out_folder, "biome-names.csv") | ||
biome_names <- read_csv(dest_file, show_col_types = FALSE) |> | ||
rename("biome code" = "biome_code" , "biome name" = "name") | ||
dest_file <- here::here(out_folder, "IUCN-GET-profiles-exported.xlsx") | ||
profile_info <- read_excel(dest_file, sheet = 2) |> | ||
left_join(biome_names, by = "biome code") | ||
altmap_table <- profile_info |> | ||
transmute(Biome = `biome name`, `Ecosystem functional group` = name, | ||
`Links` = sprintf("<a href='map-info/%1$s_valid.html'>Current version</a> / <a href='altmap-info/%1$s_history.html'>Version history</a>", str_replace(`code`,"\\.", "_"))) | ||
DT::datatable(altmap_table, rownames = FALSE, escape = FALSE, filter = 'top', | ||
options = list(dom = 'tpl', pageLength = 25, | ||
columnDefs = list(list(targets = 2, searchable = FALSE)) | ||
)) | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters