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 'bcmapsdata' 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.18.0

dev License 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 bcmapsdata 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 bcmapsdata package, which holds all of the datasets.

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

install.packages('bcmapsdata', repos='')

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

#> Loading required package: sf
#> Linking to GEOS 3.6.1, GDAL 2.1.3, PROJ 4.9.3

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:

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 bcmapsdata 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)

It’s a beautiful day in the neighbourhood

A handy layer for creating maps for display is the bc_neighbours layer, accessible with the function by the same name. This example also illustrates using the popular ggplot2 package to plot maps in R using geom_sf:

ggplot() + 
  geom_sf(data = bc_neighbours(), mapping = aes(fill = name)) + 
  geom_sf(data = bc_cities()) +
  coord_sf(datum = NA) +
  scale_fill_discrete(name = "Jurisdiction") +

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:

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())

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)


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 0.18.0

  • Added bc_neighbours() function to call layers containing adjacent jurisdictions.
  • Ensured the geometry column in all layers is consistently named "geometry" (Thanks @boshek)
  • Moving sf package to Depends to take advantage of sf print methods.
  • Added bc_bbox() to get a bounding box for British Columbia (#40).
  • All references to external data package now point to bcmapsdata because of this R bug (

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 Municipalities 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-intersections 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.18.0 by Andy Teucher, a year 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, stats, utils

Depends on sf

Suggests bcmapsdata, doMC, ggplot2, glue, knitr, lwgeom, plyr, raster, rgdal, rgeos, rmarkdown, sp, testthat

See at CRAN