Learn R Programming

⚠️There's a newer version (2.2.1) of this package.Take me there.


bcmaps

An R package of map layers for British Columbia

Features

Various layers of British Columbia, such as administrative boundaries, natural resource management boundaries, etc. All layers are available as sp objects, and are in BC Albers projection, which is the B.C. government standard.

Installation

The package is not available on CRAN, but can be installed using the devtools package:

install.packages("devtools") # if not already installed

library(devtools)
install_github("bcgov/bcmaps", build_vignettes = TRUE)

Usage

At the moment, there are nine layers available:

To load any of them, simply type data(layer_name), where layer_name is the name of the layer of interest. Then you can use the data as you would any sp object. A couple of simple examples:

library(bcmaps)
#> Loading required package: sp

# Load and plot the boundaries of B.C.
data(bc_bound)
plot(bc_bound)


## Next load the Regional Districts data, then extract and plot the Kootenays
data(regional_districts_disp)
kootenays <- regional_districts_disp[grep("Kootenay", 
                                          regional_districts_disp$region_name), ]
plot(kootenays)
text(coordinates(kootenays), 
     labels = kootenays$region_name, cex = 0.6)

Size of British Columbia

There is also a simple function that returns the size of B.C. in various units. You can choose total area, land area only, or freshwater area only:

bc_area("total", "ha")
#> total_ha 
#> 94473500

bc_area("land", "m2")
#>     land_m2 
#> 9.25186e+11

bc_area("freshwater", "km2")
#> freshwater_km2 
#>          19549

Vignettes

We have written a short vignette on plotting points on one of the layers from bcmaps. You can view the vignette online here or if you installed the package using devtools::install_github("bcgov/bcmaps", build_vignettes = TRUE) you can open it using browseVignettes("bcmaps").

Project Status

Under active development, we will add different layers iteratively.

Getting Help or Reporting an Issue

To report bugs/issues/feature requests, please file an issue.

How to Contribute

Pull requests of new B.C. layers are welcome. If you would like to contribute to the package, 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.

Source data

The source datasets used in this package come from various sources under open licenses, including DataBC (Open Government License - British Columbia) and Statistics Canada (Statistics Canada Open Licence Agreement). See the data-raw folder for details on each source dataset.

License

The data and code in this repository is licensed under multiple licenses.

This repository is maintained by Environmental Reporting BC. Click here for a complete list of our repositories on GitHub.

Copy Link

Version

Install

install.packages('bcmaps')

Monthly Downloads

509

Version

0.7.1

License

file LICENSE

Maintainer

Andy Teucher

Last Published

December 21st, 2024

Functions in bcmaps (0.7.1)

ecoprovinces

British Columbia Ecoprovinces
ecoregions

British Columbia Ecoregions
bcmaps-defunct

Defunct functions in bcmaps
bcmaps

bcmaps: A data package providing various map layers for British Columbia
regional_districts_disp

Regional districts
watersheds

British Columbia Hydrometric Watershed Boundaries
nr_regions

British Columbia Natural Resource (NR) Regions
bc_bound_hres

BC Boundary
bc_bound

BC Boundary
self_union

Union a SpatialPolygons* object with itself to remove overlaps, while retaining attributes
get_poly_attribute

Get or calculate the attribute of a list-column containing nested dataframes.
transform_bc_albers

Transform a Spatial* object to BC Albers projection
airzones

British Columbia Air Zones
bc_area

The size of British Columbia
nr_districts

British Columbia Natural Resource (NR) Districts
nr_areas

British Columbia Natural Resource (NR) Areas
fix_geo_problems

Check and fix polygons that self-intersect, and sometimes can fix orphan holes