This repository contains R code that calculates summaries of the amount of land designated in B.C. that contributes to conservation. It supports this Environmental Reporting BC indicator.
Other than bcmaps
and envreportutils
, all required packages are
available from CRAN
devtools::install_github("bcgov/bcmaps")
)devtools::install_github("bcgov/envreportutils")
)The inputs required to run this analysis can be obtained by downloading the data via the B.C. Data Catalogue. They are released under the Open Government Licence - British Columbia:
designatedlands.gpkg
- the land designations layerlands_bec.gpkg
- the land designations layer intersected with BEC.lands_eco.gpkg
- the land designations layer intersected with
ecosections.Place these in the data
folder of this repository. You will also
require BEC_BIOGEOCLIMATIC_POLY.gdb
from
here
and ERC_ECOSECTIONS_SP.gdb
from
here
The data-raw
folder contains a file
sources.csv
that lists all of the source land
designation layers used in the analysis.
01_clean.R
file to prepare the data. Note that this will
take a long time (several hours)02_analysis.R
file to calculate the summaries.out
directory, and summary
tabular objects for use in the land designations Shiny
app are copied
to the out-shiny
directory.03_output_static.R
script to create outputs (png maps and
graphs etc).04_output_shiny.R
scrip to generate the objects required
for the shiny app. This will also copy the files from out-shiny
to
the ../land-designations-shinyapp/app/data
folder, assuming the
folder exists in same parent directory as this repositoryInput data was created by running the python script here. Please note that the code there is still being developed to make it more efficient.
It was run using the following commands:
## Download the Biogeoclimatic Zone layer from here:
## https://catalogue.data.gov.bc.ca/dataset/biogeoclimatic-ecosystem-classification-bec-map
## and store it in your working directory
## Download the Ecosection layer from here:
## https://catalogue.data.gov.bc.ca/dataset/ecosections-ecoregion-ecosystem-classification-of-british-columbia
## and store it in your working directory
python designatedlands.py create_db
python designatedlands.py load
python designatedlands.py process
python designatedlands.py dump --out_file=designatedlands.gpkg
python designatedlands.py overlay BEC_BIOGEOCLIMATIC_POLY.gdb --in_layer=WHSE_FOREST_VEGETATION_BEC_BIOGEOCLIMATIC_POLY_polygon --new_layer_name=bec
python designatedlands.py overlay ERC_ECOSECTIONS_SP.gdb --in_layer=WHSE_TERRESTRIAL_ECOLOGY_ERC_ECOSECTIONS_SP_polygon --new_layer_name=eco
python designatedlands.py dump --out_table=bec_overlay --out_file=lands_bec.gpkg --aggregate_fields="bc_boundary,designation,category,zone,subzone,variant,phase,map_label"
python designatedlands.py dump --out_table=eco_overlay --out_file=lands_eco.gpkg --aggregate_fields="bc_boundary,designation,category,parent_ecoregion_code,ecosection_code,ecosection_name"
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.