A set of R scripts to complete the analysis behind the Environmental Indicator Protected Lands & Waters in B.C., published by Environmental Reporting BC in June 2016.
Note: Moving forward this analysis and indicator will be updated using the analysis and approach found here.
The analysis uses data from several sources; they should be downloaded
and stored in the data
folder:
- Canadian Council on Ecological Areas (CCEA) shapefile database of protected areas in Canada
- B.C. Government Conservation Lands (Licence: Open Government Licence - British Columbia)
- B.C. NGO Conservation Areas Database — Fee Simple Areas
- Ecoregions - Ecoregion Ecosystem Classification of British Columbia (Licence: Open Government Licence - British Columbia)
- Biogeoclimatic Ecosystem Classification (BEC) Map (Licence: Open Government Licence - British Columbia)
There are four core scripts that are required for the analysis; they need to be run in order:
01_load.R
- unzips the data files in the data folder02_clean.R
- cleans and prepares the spatial data for analysis, especially resolving overlaps among types of protected area designations03_analysis.R
- performs the spatial intersections and creates data summaries04_plot.R
- creates plots for communicating the results
The file fun.R
contains a few custom functions required for the
analysis.
Spatial packages:
sp
rgdal
rgeos
raster
maptools
geojsonio
bcmaps
rmapshaper
General data manipulation packages:
dplyr
tidyr
readr
Plotting packages:
ggplot2
RColorBrewer
ggthemes
envreportutils
Most packages used in the analysis can be installed from CRAN using
install.packages()
, but there are a few you will need to install using
devtools:
install.packages("devtools") # If you don't already have it installed
library(devtools)
install_github("bcgov/envreportutils")
install_github("bcgov/bcmaps")
You will also need the mapshaper node package, and for this you will require Node.js to be installed. You can install it from here, then on the command line type:
npm install -g mapshaper
To report bugs/issues/feature requests, please file an issue.
If you would like to contribute, please see our CONTRIBUTING guidelines.
Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms.
Copyright 2016 Province of British Columbia
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
This repository is maintained by Environmental Reporting BC. Click here for a complete list of our repositories on GitHub.