Map Layers and Spatial Utilities for British Columbia

Provides access to various spatial layers for B.C., such as administrative boundaries, natural resource management boundaries, etc. All layers are imported from the 'bcmaps.rdata' package as 'sf' or 'Spatial' objects through function calls in this package. All layers are in B.C. 'Albers' equal-area projection <>, which is the B.C. government standard.

Version 0.17.1

In production, but maybe in Alpha or Beta. Intended to persist and be supported. Travis-CI BuildStatus CRAN_Status_Badge CRANDownloads


An R package of spatial map layers for British Columbia.


Provides access to various spatial layers of British Columbia, such as administrative boundaries, natural resource management boundaries, watercourses etc. All layers are available in the BC Albers projection, which is the B.C. Government standard as sf or Spatial objects.

Layers are stored in the bcmaps.rdata package and loaded by this package, following the strategy recommended by Anderson and Eddelbuettel.


You can install bcmaps from CRAN:


To install the development version of the bcmaps package, you need to install the remotes package then the bcmaps package.



To get full usage of the package, you will also need to install the bcmaps.rdata package, which holds all of the datasets.

Note that unlike most packages it is not necessary to actually load the bcmaps.rdata package (i.e., with library(bcmaps.rdata)) - in fact it is less likely to cause problems if you don’t.

install.packages('bcmaps.rdata', repos='')

To see the layers that are available, run the available_layers() function:

#>            layer_name
#> 1            airzones
#> 2            bc_bound
#> 3       bc_bound_hres
#> 4           bc_cities
#> 5        ecoprovinces
#> 6          ecoregions
#> 7         ecosections
#> 8         gw_aquifers
#> 9          hydrozones
#> 10     municipalities
#> 11           nr_areas
#> 12       nr_districts
#> 13         nr_regions
#> 14 regional_districts
#> 15    water_districts
#> 16    water_precincts
#> 17   watercourses_15M
#> 18    watercourses_5M
#> 19      wsc_drainages
#> 20                bec
#> 21                tsa
#>                                                            title
#> 1                                     British Columbia Air Zones
#> 2                                                    BC Boundary
#> 3                                  BC Boundary - High Resolution
#> 4  BC Major Cities Points 1:2,000,000 (Digital Baseline Mapping)
#> 5                                  British Columbia Ecoprovinces
#> 6                                    British Columbia Ecoregions
#> 7                                   British Columbia Ecosections
#> 8             British Columbia's developed ground water aquifers
#> 9                 Hydrologic Zone Boundaries of British Columbia
#> 10                               British Columbia Municipalities
#> 11                  British Columbia Natural Resource (NR) Areas
#> 12              British Columbia Natural Resource (NR) Districts
#> 13                British Columbia Natural Resource (NR) Regions
#> 14                           British Columbia Regional Districts
#> 15                 British Columbia's Water Management Districts
#> 16                 British Columbia's Water Management Precincts
#> 17                  British Columbia watercourses at 1:15M scale
#> 18                   British Columbia watercourses at 1:5M scale
#> 19                 Water Survey of Canada Sub-Sub-Drainage Areas
#> 20                                      British Columbia BEC Map
#> 21                         B.C. Timber Supply Areas & TSA Blocks
#>    shortcut_function local
#> 1               TRUE  TRUE
#> 2               TRUE  TRUE
#> 3               TRUE  TRUE
#> 4               TRUE  TRUE
#> 5               TRUE  TRUE
#> 6               TRUE  TRUE
#> 7               TRUE  TRUE
#> 8               TRUE  TRUE
#> 9               TRUE  TRUE
#> 10              TRUE  TRUE
#> 11              TRUE  TRUE
#> 12              TRUE  TRUE
#> 13              TRUE  TRUE
#> 14              TRUE  TRUE
#> 15              TRUE  TRUE
#> 16              TRUE  TRUE
#> 17              TRUE  TRUE
#> 18              TRUE  TRUE
#> 19              TRUE  TRUE
#> 20              TRUE FALSE
#> 21              TRUE FALSE
#> ------------------------
#> Layers with a value of TRUE in the 'shortcut_function' column can be accessed
#> with a function with the same name as the layer (e.g., `bc_bound()`),
#> otherwise it needs to be accessed with the get_layer function.
#> Layers with a value of FALSE in the 'local' column are not stored in the
#> bcmaps.rdata package but will be downloaded from the internet and cached
#> on your hard drive.

Most layers are accessible by a shortcut function by the same name as the object. Then you can use the data as you would any sf or Spatial object. For example:

#> Linking to GEOS 3.6.1, GDAL 2.1.3, proj.4 4.9.3
bc <- bc_bound()

Alternatively, you can use the get_layer function - simply type get_layer('layer_name'), where 'layer_name' is the name of the layer of interest. The get_layer function is useful if the back-end bcmaps.rdata package has had a layer added to it, but there is as yet no shortcut function created in bcmaps.

ws <- get_layer("wsc_drainages", class = "sf")
plot(ws["SUB_SUB_DRAINAGE_AREA_NAME"], key.pos = NULL)

Simple Features objects

By default, all layers are returned as sf spatial objects:

# Load and plot the boundaries of B.C.
bc <- bc_bound()
## Next load the Regional Districts data, then extract and plot the Kootenays
rd <- regional_districts()
kootenays <- rd[rd$ADMIN_AREA_NAME == "Regional District of Central Kootenay", ]
plot(st_geometry(kootenays), col = "lightseagreen", add = TRUE)

Spatial (sp) objects

If you aren’t using the sf package and prefer the old standard sp way of doing things, set class = "sp" in either get_layer or the shortcut functions:

# Load watercourse data and plot with boundaries of B.C.
plot(get_layer("bc_bound", class = "sp"))
plot(watercourses_15M(class = "sp"), add = TRUE)

Biogeoclimatic Zones

As of version 0.15.0 the B.C. BEC (Biogeoclimatic Ecosystem Classification) map is available via the bec() function, and an accompanying function bec_colours() function to colour it:

# This example requires the development version of ggplot2 which has the 
# `geom_sf()` function:
# remotes::install_github("tidyverse/ggplot2")
bec <- bec()
ggplot() +
  geom_sf(data = bec[bec$ZONE %in% c("BG", "PP"),],
          aes(fill = ZONE, col = ZONE)) +
  scale_fill_manual(values = bec_colors()) +
  scale_colour_manual(values = bec_colours())


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 you can open it using browseVignettes("bcmaps").

Utility Functions

The package also contains a couple of handy utility functions:

  1. fix_geo_problems() for fixing invalid topologies in sf or Spatial objects such as orphaned holes and self-intersections
  2. transform_bc_albers() for transforming any sf or Spatial object to BC Albers projection.
  3. self_union() Union a SpatialPolygons* object with itself to remove overlaps, while retaining attributes

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 licences, including DataBC (Open Government Licence - British Columbia) and Statistics Canada (Statistics Canada Open Licence Agreement). See the data-raw folder for details on each source dataset.


# Copyright 2017 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
# Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS,
# 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.


bcmaps v0.17.1

  • Fixed an issue where self_union() would fail due to a change in the raster package (30cef3438)

bcmaps 0.17.0

  • Output of available_layers() has changed: shortcut_function column is now logical, uses better column names, and has a custom print function that gives more information. (#34)
  • Add links to combine_nr_rd() function from regional_districts() and municipalities(). This function combines Regional Districts with the Northern Rockies Regional Municipalites to create a full provincial layer of 'Regional-District-like' polygons.
  • Added Timber Supply Areas and BC cities shortcut function and to available_layers()
  • bec (and other large downloadable layers) show up in the output of available_layers(), bec() works, and get_layer("bec") works so that getting downloadable datasets is indistinguishable from getting local datasets. (#32)
  • Some utility functions use sf functions that have been moved to the lwgeom package. They now use the lwgeom function (Fixes CRAN CHECK NOTE; #33).
  • Added new layer: bc_cities() which is a point layer of B.C.'s major cities.

bcmaps 0.16.0

  • First release to CRAN
  • Added two new functions: raster_by_poly to overlay a SpatialPolygonsDataFrmae or sf polygons layer on a raster layer and clip the raster to each polygon, and summarize_raster_list to summarize the results of raster_to_poly

bcmaps 0.15.1

  • get_layer() now only accepts characters (#31)
  • Fixes bug in check_write_to_data_dir where it was not creating data directory
  • Update README installation instructions so that vignettes aren't built before bcmaps.rdata is installed (#29)

bcmaps 0.15.0

  • Added the ability to download Biogeoclimatic Zone map - as it was too big to fit in the bcmaps.rdata package, it is hosted as an asset on a GitHub release of bcmaps.rdata, and downloaded via the function bec(), which uses the new function get_big_data() (#28).
  • Added function bec_colours() (and alias bec_colors()) to generate a vector of colours that match the standard colours used to colour Biogeoclimatic Zone maps.

bcmaps 0.14.0

  • Changed the lookup for exported objected to getNamespaceExports("bcmaps") so that you can call layers without loading the package via bcmaps::
  • Removed watersheds layer from package
  • Added ecosections to package

bcmaps 0.13.0

This is a major new release with breaking changes.

All data has been removed from the bcmaps package and moved to the bcmaps.rdata package, which is hosted on the bcgov drat repository: That package must be installed in order for bcmaps to access the data. It can be installed with: install.packages('bcmaps.rdata', repos='')

In previous versions of bcmaps, data was stored in the package and loaded by calling data("layername") or simply layername (e.g., data("bc_bound") or bc_bound).

Now loading data requires a function call - either using a shortcut function that is the same name as the dataset (e.g., bc_bound() whereas previously one would simply use bc_bound). Alternatively, one can use the get_layer() function (e.g., get_layer("bc_bound")).

Another major change is that all the layers are now returned as sf classes by default, rather than Spatial classes. Spatial versions of the data can still be obtained by setting the class argument to "sp" in get_layer() and the shortcut functions (E.g., bc_bound(class = "sp") or get_layer("bc_bound", class = "sp")).

bcmaps 0.12.0

  • Added wsc_drainages

bcmaps 0.11.0

  • Added hydrozones dataset.

bcmaps 0.10.1

  • Fixed ring self-intersctions in bc_bound_hres and airzones (#13)

bcmaps 0.10.0

  • Added water_districts and water_precincts datasets.

bcmaps 0.9.0

  • Added gw_aquifers dataset.

bcmaps 0.8.2

  • Added a tries argument to fix_geo_problems function to set the maximum number of iterations it should go through in attempting to repair topological issues.

bcmaps 0.8.1

  • Set character encoding of watercourses_15M and watercourses_5M datasets to UTF-8.

bcmaps 0.8.0

  • Added watercourses_15M and watercourses_5M datasets.

bcmaps 0.7.1

  • fix_geo_problems and transform_bc_albers are Generic functions with methods for sf objects as well as Spatial objects
  • fix_self_intersect is now defunct

bcmaps 0.6.2

  • fix_self_intersect has been renamed to fix_geo_problems (but kept as an alias for now)
  • fix_geo_problems can often also fix orphaned holes in addition to self-intersections.

bcmaps 0.6.0

  • Added watersheds dataset (#15, @markjohnsonubc)
  • Added a file to track changes to the package.

bcmaps 0.5.0

Added two new functions to create and work with SpatailPolygonsDataFrames with nested data frames:

  • self_union performs a union on a single SpatialPolygons* object to take into account overlaps. Polygon attributes are combined in a nested dataframe.
  • get_poly_attribute allows you to easily parse a nested data frame column (created by self_union) to extract or calculate the attributes you want

bcmaps 0.4.0

Added a couple of convenience functions:

  • transform_bc_albers() transforms a Spatial object to BC Albers projection
  • fix_self_intersect() checks for and repairs self-intersecting polygons

bcmaps 0.3.0

Added 3 Natural Resource layers (areas, regions and districts)

bcmaps 0.2.0

Added high resolution BC boundaries (bc_bound_hres)

bcmaps 0.1.0

Added bc_area function

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.


0.17.1 by Andy Teucher, 10 months ago

Report a bug at

Browse source code at

Authors: Andy Teucher [aut, cre] , Stephanie Hazlitt [aut] , Sam Albers [aut] , Province of British Columbia [cph]

Documentation:   PDF Manual  

Apache License (== 2.0) | file LICENSE license

Imports httr, methods, rappdirs, sf, stats, utils

Suggests bcmaps.rdata, doMC, ggplot2, glue, knitr, lwgeom, plyr, raster, rgdal, rgeos, rmarkdown, sp, testthat

See at CRAN