/bcmaps

An R package of map layers for British Columbia

Primary LanguageROtherNOASSERTION

bcmaps

In production, but maybe in Alpha or Beta. Intended to persist and be supported.Travis-CI Build Status

Overview

An R package of map layers for British Columbia.

Features

Various layers of British Columbia, such as administrative boundaries, natural resource management boundaries, watercourses 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 sixteen layers available:

  • bc_bound: Coarse provincial boundary of British Columbia (1:7.5M scale).

  • bc_bound_hres: Detailed provincial boundary of British Columbia from Statistics Canada.

  • regional_districts_analysis: Detailed B.C. Regional District boundaries based on Canadian Census boundaries. Suitable for situations where you need detailed boundaries (faithful to the original representation).

  • regional_districts_disp: Simplified B.C. Regional District boundaries. Much smaller file size than the analysis layer, suitable for situations where you don't need detailed boundaries, often useful when making maps for display.

  • ecoprovinces: Boundaries of British Columbia's 10 ecoprovinces.

  • ecoregions: Boundaries of British Columbia's 43 ecoregions.

  • airzones: Boundaries of British Columbia's 7 Air Zones.

  • nr_areas: Boundaries of British Columbia's 3 Natural Resource (NR) Areas.

  • nr_regions: Boundaries of British Columbia's 8 Natural Resource (NR) Regions.

  • nr_districts: Boundaries of British Columbia's 24 Natural Resource (NR) Districts.

  • watersheds: Boundaries of British Columbia's hydrometric watersheds, delineated for Canada-British Columbia hydrometric stations.

  • watercourses_15M: Watercourses for British Columbia at 1:15M scale.

  • watercourses_5M: Watercourses for British Columbia at 1:5M scale.

  • gw_aquifers: Boundaries of British Columbia's developed ground water aquifers (that have been mapped).

  • water_districts: Boundaries of British Columbia's Water Management Districts.

  • water_precincts: Boundaries of British Columbia's Water Management Precincts.

  • hydrozones: Hydrologic Zone Boundaries of British Columbia.

  • wsc_drainages: Water Survey of Canada Sub-Sub-Drainage Areas.

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)

Plot watercourses in British Columbia at a course scale

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

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

Further development of the bcmaps package is on hold until the enhancements outlined in Issue #2 and #21 are implemented. We are hoping to tackle these in 2018.

If you are using the new R package sf, you can convert the bcmaps sp objects to sf objects with sf::st_as_sf()

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

library(sf)
bc_bound_sf <- st_as_sf(bcmaps::bc_bound)

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.

License

The data and code in this repository is licenced under multiple licences.

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