Skip to content

Commit

Permalink
Imported cultural values grids and added new script for cultural valu…
Browse files Browse the repository at this point in the history
…es Mollusca as sample
  • Loading branch information
amb26 committed Nov 13, 2023
1 parent 8951001 commit 6e0a1be
Show file tree
Hide file tree
Showing 32 changed files with 3,456 additions and 15 deletions.
10 changes: 10 additions & 0 deletions Mollusca.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,16 @@ figs$reportingStatusMap
figs$reportingStatusFig
```

## Molluscs with Indigenous cultural significance

These include the [Giant pacific octopus](#taxon:Enteroctopus dofleini), known in Hul'qumi'num as [**sqi'mukw**](#taxon:Enteroctopus dofleini).

```{r, echo=FALSE, message=FALSE, warning=FALSE}
source("scripts/Cultural_map_script.R")
animal.cultural.map <- mx_cultural_map("mollusca")
animal.cultural.map
```

## Top community contributions to our knowledge of the island mollusc diversity

Here, you can browse photos of mollusc species commonly documented around Galiano Island, as well as recent observations, most favourited observations, and top observers, based on [iNaturalist](http://inaturalist.org/) data. Please help contribute to the growing record of the island mollusc diversity by submitting your observations to the [Biodiversity Galiano iNaturalist project.](http://inaturalist.org/projects/biodiversity-galiano-island)
Expand Down
40 changes: 28 additions & 12 deletions docs/Mollusca.html

Large diffs are not rendered by default.

78 changes: 78 additions & 0 deletions scripts/Cultural_map_script.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
# Map Galiano Island's marine animal diversity

# Load libraries

library(dplyr)
library(leaflet)
library(raster)
library(reshape2)
library(rjson)
library(scales)
library(sf)
library(stringr)
library(viridis)

# Source dependencies

source("scripts/utils.R")

mx_diversityRowToOptions <- function (row) {
return (list(mx_regionId = row$cell_id, mx_richness = row$richness))
}

mx_cultural_map <- function (taxon) {
title <- str_to_title(taxon);

# Read gridded marine animal dataset

gridded.records <- read.csv(str_glue("tabular_data/{taxon}_all_records_gridded.csv"))

hulq <- read.csv("tabular_data/reintegrated-hulq.csv")
hulqTaxa <- hulq$Taxon.name

# Filter only those records with cultural values
cultural.records <- gridded.records[gridded.records$scientificName %in% hulqTaxa, ]

# Summarize species by grid cell and export to JSON file for viz

culturalTaxa <- mx_griddedObsToHash(cultural.records)

culturalData <- list(taxa = culturalTaxa, mapTitle = str_glue("Diversity for {title} with cultural values"))

mx_writeJSON(culturalTaxa, str_glue("viz_data/Cultural-{taxon}PlotData.json"))

# Load choropleth

choropleth <- mx_read(str_glue("spatial_data/vectors/{taxon}_hulq_grid"))

# Plot choropleth

richness <- choropleth$richness
t <- max(richness)
values <- 0:t
pal <- leaflet::colorNumeric(viridis_pal(option = "D")(t), domain = values)

# Plot map

culturalMap <- leaflet(options=list(mx_mapId="Cultural")) %>%
fitBounds(-123.6, 48.85, -123.2917, 49.03) %>%
addTiles(options = providerTileOptions(opacity = 0.5)) %>%
addLegend(position = 'topright',
pal = pal,
bins = ifelse(t < 5, t, 5),
values = values,
title = "Richness",
labels = values)

# Draw the gridded data in a funny way so that richness, cell_id etc. can be tunnelled through options one at a time
for (i in 1:nrow(choropleth)) {
row <- choropleth[i,]
culturalMap <- culturalMap %>% addPolygons(data = row, fillColor = pal(row$richness), fillOpacity = 0.4, weight = 0,
popup = paste("Richness:", row$richness),
popupOptions = popupOptions(closeButton = FALSE),
options = mx_diversityRowToOptions(row))
}

#Note that this statement is only effective in standalone R
print(culturalMap)
}
3 changes: 2 additions & 1 deletion scripts/Diversity_map_script.R
Original file line number Diff line number Diff line change
Expand Up @@ -68,5 +68,6 @@ mx_diversity_map <- function (taxon) {
}

#Note that this statement is only effective in standalone R
print(diversityMap)
print(diversityMap)

}
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
PROJCS["WGS_1984_UTM_Zone_10N",GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137.0,298.257223563]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Transverse_Mercator"],PARAMETER["False_Easting",500000.0],PARAMETER["False_Northing",0.0],PARAMETER["Central_Meridian",-123.0],PARAMETER["Scale_Factor",0.9996],PARAMETER["Latitude_Of_Origin",0.0],UNIT["Meter",1.0]]
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
PROJCS["WGS_1984_UTM_Zone_10N",GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137.0,298.257223563]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Transverse_Mercator"],PARAMETER["False_Easting",500000.0],PARAMETER["False_Northing",0.0],PARAMETER["Central_Meridian",-123.0],PARAMETER["Scale_Factor",0.9996],PARAMETER["Latitude_Of_Origin",0.0],UNIT["Meter",1.0]]
Binary file not shown.
Binary file not shown.
Binary file not shown.
1 change: 1 addition & 0 deletions spatial_data/vectors/fishes_hulq_grid/fishes_hulq_grid.prj
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
PROJCS["WGS_1984_UTM_Zone_10N",GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137.0,298.257223563]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Transverse_Mercator"],PARAMETER["False_Easting",500000.0],PARAMETER["False_Northing",0.0],PARAMETER["Central_Meridian",-123.0],PARAMETER["Scale_Factor",0.9996],PARAMETER["Latitude_Of_Origin",0.0],UNIT["Meter",1.0]]
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
PROJCS["WGS_1984_UTM_Zone_10N",GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137.0,298.257223563]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Transverse_Mercator"],PARAMETER["False_Easting",500000.0],PARAMETER["False_Northing",0.0],PARAMETER["Central_Meridian",-123.0],PARAMETER["Scale_Factor",0.9996],PARAMETER["Latitude_Of_Origin",0.0],UNIT["Meter",1.0]]
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
PROJCS["WGS_1984_UTM_Zone_10N",GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137.0,298.257223563]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Transverse_Mercator"],PARAMETER["False_Easting",500000.0],PARAMETER["False_Northing",0.0],PARAMETER["Central_Meridian",-123.0],PARAMETER["Scale_Factor",0.9996],PARAMETER["Latitude_Of_Origin",0.0],UNIT["Meter",1.0]]
Binary file not shown.
Binary file not shown.
Loading

0 comments on commit 6e0a1be

Please sign in to comment.