Centre for Ecosystem Science, University of New South Wales
UNSW Data Science Hub, University of New South Wales
IUCN Commission on Ecosystem Management
Published
May 16, 2024
The Cumberland Plain Woodland in the Sydney Basin Bioregion is listed as a critically endangered ecological community according to the New South Wales Threatened Species Conservation Act (NSW Scientific Committee 2009). This community is included within the critically endangered ecological community listed under the Environment Protection and Biodiversity Conservation Act as “Cumberland Plain Shale Woodlands and Shale-Gravel Transition Forest” (Department of the Environment 2024).
Data access and download
For this workflow we will load datasets from the Central Resource for Sharing and Enabling Environmental Data in NSW (SEED NSW) and other portals.
Flora surveys and vegetation condition
We identified the following relevant datasets for this workflow:
This reproducible workflow is based on R and uses packages sf, leaflet and mapview for visualisation of the spatial data, plus additional packages for data import (readxl, httr) and data wrangling (dplyr, tidyr).
We read the BioNet PCT data directly from the downloaded file and filter the PCTs in the Cumberland region and belonging to the Grassy Woodlands formation.
Cumberland Plain Woodland belongs to the Coastal Valley Grassy Woodlands vegetation class (Keith 2004) and includes: ‘Shale Hills Woodland’ (map unit 9) and ‘Shale Plains Woodland’ (map unit 10) of M. Tozer (2003); equivalent to the ‘Cumberland Shale Hills Woodland’ (map unit GW p28) and ‘Cumberland Shale Plains Woodland’ (map unit GW p29) of M. G. Tozer et al. (2010).
BioNET Flora Survey data
Now we can query spatial data from the NSW BioNet Flora Survey Data Collection for these PCT IDs using a REST API call.
Query BioNet Flora Survey from MapServer API
# PCT codes to query:PCT_ids <- BioNet_PCT |>filter(vegetationFormation %in%"Grassy Woodlands", grepl("Cumberland",PCTName)) |>pull(PCTID)# Constructing url request for REST API:mapserver_url <-paste("https://mapprod3.environment.nsw.gov.au/arcgis/rest/services","EDP/SystematicFloraSurvey/MapServer/0/query", sep ="/")url <-parse_url(mapserver_url)url$query <-list(where =sprintf("currentClassification IN (%s)",paste(PCT_ids, collapse =",")), outFields ="*",returnGeometry ="true",f ="geoJSON")request <-build_url(url)# read spatial data using simple features package: FloraSurveyQuery <-st_read(request)
Reading layer `OGRGeoJSON' from data source
`https://mapprod3.environment.nsw.gov.au/arcgis/rest/services/EDP/SystematicFloraSurvey/MapServer/0/query?where=currentClassification%20IN%20%28830%2C849%2C850%2C1395%2C3318%2C3319%2C3320%2C3321%29&outFields=%2A&returnGeometry=true&f=geoJSON'
using driver `GeoJSON'
Simple feature collection with 768 features and 51 fields
Geometry type: POINT
Dimension: XY
Bounding box: xmin: 150.51 ymin: -34.38476 xmax: 151.0866 ymax: -33.24606
Geodetic CRS: WGS 84
This query returns 768 features (point locations) and many columns, but we want to match this information with benchmark data.
Vegetation condition benchmarks
The vegetation condition benchmark raw data is also available as a downloaded file, we read this file and join it with the downloaded Flora Survey data using the site id column, then we select the columns we want to display in the map. Only a subset of survey sites has cover and richness benchmark data.
We will load the vegetation map from a web mapping service (WMS). The labels of the coloured polygons are only visible when zooming in to the map. The labels refers to class codes from M. G. Tozer et al. (2010). We can look up the codes in the raster attribute table that we have downloaded.
We will also visualise a layer with the recent changes in the distribution of CPW. First we import the downloaded vector data into R and then filter the corresponding communities based on their description. To optimise visualisation in an on-line document, we group the original polygons by community description and status.
Department of the Environment. 2024. “Cumberland Plain Shale Woodlands and Shale-Gravel Transition Forest in Community and Species Profile and Threats Database.” Canberra: Department of the Environment. http://www.environment.gov.au/sprat.
Keith, David Andrew. 2004. Ocean Shores to Desert Dunes: The Native Vegetation of New South Wales and the ACT. Department of Environment; Conservation (NSW).
NSW Scientific Committee, and C. C. Simpson. 2008. “Change in the Distribution of Cumberland Plain Woodland.” Sydney, New South Wales: Scientific Committee of the Threatened Species Conservation Act.
Tozer, Mark. 2003. “The Native Vegetation of the Cumberland Plain, Western Sydney: Systematic Classification and Field Identification of Communities.”Cunninghamia 8 (1): 1–75.
Tozer, Mark G, Ken Turner, David A Keith, Daniel Tindall, Christopher Pennay, C Simpson, Berin MacKenzie, P Beukers, and Stephen Cox. 2010. “Native Vegetation of Southeast NSW: A Revised Classification and Map for the Coast and Eastern Tablelands.”Cunninghamia 11 (3): 359–406.
@online{ferrer-paris2024,
author = {Ferrer-Paris, José R.},
title = {Reproducible Workflow for Visualisation of Geospatial Data of
the {Cumberland} {Plain} {Woodland}},
date = {2024-05-16},
url = {https://jrfep.quarto.pub/cpw-workflow-mapview/},
langid = {en}
}
For attribution, please cite this work as:
Ferrer-Paris, José R. 2024. “Reproducible Workflow for
Visualisation of Geospatial Data of the Cumberland Plain
Woodland.” May 16, 2024. https://jrfep.quarto.pub/cpw-workflow-mapview/.
Source Code
---title: "Reproducible workflow for visualisation of geospatial data of the Cumberland Plain Woodland"subtitle: "Reproducible workflow using R"author: - name: given: "José R." family: "Ferrer-Paris" email: j.ferrer@unsw.edu.au orcid: 0000-0002-9554-3395 corresponding: true affiliations: - id: ces name: Centre for Ecosystem Science, University of New South Wales city: Sydney country: Australia - id: udash name: UNSW Data Science Hub, University of New South Wales city: Sydney country: Australia - id: iucn name: IUCN Commission on Ecosystem Management city: Gland country: Switzerland date: 16 May 2024bibliography: references.bibcitation: url: https://jrfep.quarto.pub/cpw-workflow-mapview/engine: knitrformat: html: code-fold: true code-summary: "Show the code" code-tools: trueeditor_options: chunk_output_type: console---The **Cumberland Plain Woodland** in the Sydney Basin Bioregion is listed as a critically endangered ecological community according to the New South Wales Threatened Species Conservation Act [@NSW_SC_2024]. This community is included within the critically endangered ecological community listed under the Environment Protection and Biodiversity Conservation Act as “Cumberland Plain Shale Woodlands and Shale-Gravel Transition Forest” [@SPRAT2024]. ## Data access and download For this workflow we will load datasets from the Central Resource for Sharing and Enabling Environmental Data in NSW (SEED NSW) and other portals.### Flora surveys and vegetation conditionWe identified the following relevant datasets for this workflow:- BioNet Plant Community Type data - Direct download from [Environment and Heritage NSW](https://www.environment.nsw.gov.au/research-and-publications/publications-search/bionet-plant-community-type-data)- NSW BioNet Flora Survey Data Collection - Dataset metadata, description and links from [datasets.seed.nsw.gov.au](https://datasets.seed.nsw.gov.au/dataset/nsw-bionet-flora-survey-data-collection1c3a0) - Available through a [WFS service](https://mapprod3.environment.nsw.gov.au/arcgis/services/EDP/SystematicFloraSurvey/MapServer/WFSServer?request=GetCapabilities&service=WFS) and a [ArcGIS REST Service](https://mapprod3.environment.nsw.gov.au/arcgis/rest/services/EDP/SystematicFloraSurvey/MapServer/)- NSW BioNet Flora Survey Plots – PCT Reference Sites - Dataset metadata, description and links from [datasets.seed.nsw.gov.au](https://datasets.seed.nsw.gov.au/dataset/nsw-bionet-flora-survey-data-collection-pctreferencesites) - [ArcGIS REST Service](https://mapprod3.environment.nsw.gov.au/arcgis/rest/services/EDP/BioNet_Flora_Survey_Sites_PCTs/MapServer)- Vegetation condition benchmark - Direct download (Cover and richness) from [datasets.seed.nsw.gov.au](https://datasets.seed.nsw.gov.au/dataset/vegetation-condition-benchmarks-cover-and-richness-raw-data-v1-2) - Other datasets also available from SEED potal.Data can be downloaded manually or programmatically into a data folder. An example for use in Linux or MacOSX is given in the next code snippets.```{bash}#| code-summary: "Script for data download in bash/zsh terminal"#| eval: falsemkdir-p sandbox/cd sandbox/wget--continue https://datasets.seed.nsw.gov.au/dataset/b2220d40-fd3c-4404-ba7b-b8a867c7b8de/resource/99a64722-0803-48b1-8011-310a04cc9fff/download/vegetation-condition-benchmarks-cover-and-richness-raw-data-v1-2.xlsxwget--continue https://www.environment.nsw.gov.au/-/media/OEH/Corporate-Site/Documents/BioNet/bionet-plant-community-type-data.xlsx```### Vegetation maps - Southeast NSW Native Vegetation Classification and Mapping - SCIVI. VIS_ID 2230 - Based on @Tozer2010 - Dataset metadata, description and links from [dataset@seed.nsw.gov.au](https://datasets.seed.nsw.gov.au/dataset/southeast-nsw-native-vegetation-classification-and-mapping-scivi-vis_id-223006f8a) - Also at [data.gov.au](https://data.gov.au/data/dataset/0f1aeb33-1b49-4839-88fa-8b635cf9d3ab) - We will load the [WMS layer](https://mapprod3.environment.nsw.gov.au/arcgis/services/VIS/Vegetation_SouthCoast_SCIVI_V14_E_2230/MapServer/WMSServer?request=GetCapabilities&service=WMS)- Change in the distribution of Cumberland Plain Woodland - Dataset from @Simpson2008 - Data download from [dataset@seed.nsw.gov.au](https://datasets.seed.nsw.gov.au/dataset/change-in-the-distribution-of-cumberland-plain-woodland-vis_id-3785236f0) - Refers to changes between 1998 and 2007```{bash}#| code-summary: "Script for data download in bash/zsh terminal"#| eval: falsemkdir-p sandbox/cd sandbox/wget--continue https://datasets.seed.nsw.gov.au/dataset/a55ea79e-967e-42cc-b6a7-2f2627a606be/resource/5426a635-fa31-48d3-bb0a-ed8ca4a0d60e/download/vegetationsouthcoastsciviv14e2230.zipunzip-U vegetationsouthcoastsciviv14e2230.zipwget--continue https://datasets.seed.nsw.gov.au/dataset/d872b07e-253d-47fa-8e27-fea0d2522b9d/resource/c2cb2276-7706-40ad-8922-63cca8520d37/download/ageonetworkzipscumberlandplainupdate3785.zipunzip-U ageonetworkzipscumberlandplainupdate3785.zip ```## Reproducible workflow with R```{r}#| eval: false #| echo: false # This is only needed if we run into errors in the terminaloptions(browser ='firefox')```This reproducible workflow is based on R and uses packages `sf`, `leaflet` and `mapview` for visualisation of the spatial data, plus additional packages for data import (`readxl`, `httr`) and data wrangling (`dplyr`, `tidyr`).```{r}#| code-summary: "How to load the libraries in R"#| warning: false#| message: falselibrary(sf)library(dplyr)library(mapview)library(leaflet)library(readxl)library(httr)library(knitr)library(tidyr)library(units)```### BioNET Plant Community Type (PCT) dataWe read the BioNet PCT data directly from the downloaded file and filter the PCTs in the Cumberland region and belonging to the Grassy Woodlands formation.```{r}#| code-summary: "Import BioNet PCT data in R"#| warning: false#| message: falsehere::i_am("CPW-workflow-mapview.qmd")data_dir <- here::here("sandbox")BioNet_PCT <-read_excel(here::here(data_dir, "bionet-plant-community-type-data.xlsx"), "PCT Data PQ")BioNet_PCT |>filter(vegetationFormation %in%"Grassy Woodlands", grepl("Cumberland",PCTName)) |>select(PCTID,PCTName) |>kable()```:::{.aside}**Cumberland Plain Woodland** belongs to the Coastal Valley Grassy Woodlands vegetation class [@Keith2004] and includes: ‘Shale Hills Woodland’ (map unit 9) and ‘Shale Plains Woodland’ (map unit 10) of @Tozer2003; equivalent to the ‘Cumberland Shale Hills Woodland’ (map unit GW p28) and ‘Cumberland Shale Plains Woodland’ (map unit GW p29) of @Tozer2010.:::### BioNET Flora Survey dataNow we can query spatial data from the NSW BioNet Flora Survey Data Collection for these PCT IDs using a REST API call.```{r}#| code-summary: "Query BioNet Flora Survey from MapServer API"# PCT codes to query:PCT_ids <- BioNet_PCT |>filter(vegetationFormation %in%"Grassy Woodlands", grepl("Cumberland",PCTName)) |>pull(PCTID)# Constructing url request for REST API:mapserver_url <-paste("https://mapprod3.environment.nsw.gov.au/arcgis/rest/services","EDP/SystematicFloraSurvey/MapServer/0/query", sep ="/")url <-parse_url(mapserver_url)url$query <-list(where =sprintf("currentClassification IN (%s)",paste(PCT_ids, collapse =",")), outFields ="*",returnGeometry ="true",f ="geoJSON")request <-build_url(url)# read spatial data using simple features package: FloraSurveyQuery <-st_read(request)```This query returns `r nrow(FloraSurveyQuery)` features (point locations) and many columns, but we want to match this information with benchmark data.### Vegetation condition benchmarksThe vegetation condition benchmark raw data is also available as a downloaded file, we read this file and join it with the downloaded Flora Survey data using the site id column, then we select the columns we want to display in the map. Only a subset of survey sites has cover and richness benchmark data.```{r}#| code-summary: "Import benchmark data and join with survey data"#| warning: false#| message: falsebenchmarks <-read_excel(here::here(data_dir, "vegetation-condition-benchmarks-cover-and-richness-raw-data-v1-2.xlsx")) |>filter(!is.na(Longitude)) |>st_as_sf(coords =c("Longitude","Latitude"), crs =4326) |>filter(`Class IBRA`%in%"Coastal Valley Grassy Woodlands/Sydney Basin")benchmarks_surveys <- FloraSurveyQuery |>inner_join(st_drop_geometry(benchmarks), by =c("siteID"="Site no")) |>select(`PCT id`= currentClassification,`PCT name`= currentClassificationDesc, elevationInMeters, DateTxt, FrCov:Rain12)benchmarks_surveys |>st_drop_geometry() |>group_by(`PCT id`, `PCT name`) |>summarise(`Nr. of sites`=n(), .groups ='drop') |>kable()```### Vegetation mapWe will load the vegetation map from a web mapping service (WMS). The labels of the coloured polygons are only visible when zooming in to the map. The labels refers to class codes from @Tozer2010. We can look up the codes in the raster attribute table that we have downloaded. ```{r}#| code-summary: "Read value attribute table from GeoTiff file"SciVi <-read_sf(here::here(data_dir,"Vegetation_SouthCoast_SCIVI_v14_E_2230/Vegetation_SouthCoast_SCIVI_v14_E_2230/SouthCoast_SCIVI_v14_E_2230/Data/SouthCoast_SCIVI_v14_E_2230.tif.vat.dbf"))SciVi |>filter(CLASS %in%c("p28", "p29")) |>select(CLASS, MAPUNIT) |>distinct()```We will also visualise a layer with the recent changes in the distribution of CPW. First we import the downloaded vector data into R and then filter the corresponding communities based on their description. To optimise visualisation in an on-line document, we group the original polygons by community description and status.```{r}#| code-summary: "Import vector data into R"CPW_dist <-read_sf(here::here(data_dir, "cumberland_V2_2008_VISmap_3785.shp")) |>st_transform(crs ='+proj=longlat +datum=WGS84 +no_defs') |>filter(COMM_DESC %in%c('14 - Moist Shale Woodland', '103 - Shale/Gravel Transition Forest', '9 - Shale Hills Woodland', '10 - Shale Plains Woodland')) |>st_make_valid()CPW_changes <- CPW_dist |>group_by(COMM_DESC, STATUS2007) |>summarise(geometry =st_union(geometry),.groups ="drop")```We can summarise the information from the vector data into a table. Here we calculate the area (in hectars) under each category for each community.```{r}#| code-summary: "Summarise spatial data"options(knitr.kable.NA ='--')CPW_changes |>mutate(area=st_area(geometry) |>set_units('ha') |>round(2)) |>st_drop_geometry() |>pivot_wider(names_from=STATUS2007, values_from=area) |> knitr::kable(digits =2)```This datasets cover ca. 80% of the total distribution of Cumberland Plain Woodland [@Simpson2008].### Interactive mapNow we can show these layers in a interactive map.```{r}#| code-summary: "Code for mapview"#| fig-height: 8wms_src <-"https://mapprod3.environment.nsw.gov.au/arcgis/services/VIS/Vegetation_SouthCoast_SCIVI_V14_E_2230/MapServer/WMSServer?"mapviewOptions(fgb=FALSE)m <-mapview(benchmarks_surveys,zcol ='PCT name',layer.name ="Benchmark raw data v1.2", col.regions = sf.colors) +mapview(CPW_changes, zcol ='STATUS2007', layer.name ="CPW distribution changes (Simpson 2008)") m@map <- m@map |>addWMSTiles(group ='Vegetation map (Tozer 2010)', wms_src,layers ="0,1",options =WMSTileOptions(format ="image/png", transparent =TRUE),attribution ="") |> mapview:::mapViewLayersControl(names =c('Vegetation map (Tozer 2010)'))m```### References::: {#refs}:::### R session info```{r}#| echo: falsesessionInfo()```