
Package index
Geocoding
Resolve free-text Canadian addresses to coordinates, interpolating the civic numbers NAR does not carry. geocode() answers one row per address; geocode_matches() opens up the NAR records behind an answer, which is where the units of a multi-unit building are. geocode_accept() applies your own bar to a result that already exists, withdrawing the coordinates on the rows that do not clear it.
-
geocode() - Geocode Canadian addresses to coordinates
-
geocode_matches() - Every NAR record behind a geocoding answer
-
geocode_accept() - Withdraw the coordinates a result does not clear your bar
Address normalization
Parse free-text Canadian addresses into the components NAR is keyed on, sort them by the shape they parsed as, and put them back together as a match key or a readable line. Useful on its own for matching and deduplicating address lists, not only as a step towards a coordinate.
-
normalize_address() - Normalize Canadian address strings into NAR components
-
address_pattern() - Sort Canadian address strings into structural buckets
-
address_key() - Build a match key from parsed address components
-
format_address() - Render parsed address components back into one line
External geocoders
Online services that place an address without a local database: NRCan’s national geolocator, the Province of British Columbia’s Address Geocoder, Quebec’s geocoder over the Repertoire quebecois des adresses, the two provincial ones also a second source to check a result against, and the OpenStreetMap geocoder Natural Resources Canada hosts. All make network requests, and the OpenStreetMap one returns data under a share-alike licence – read osm_geocode() before using its results.
-
nrcan_geocode() - Geocode Canadian addresses with NRCan's geolocator
-
bc_geocode() - Geocode British Columbia addresses with the BC Address Geocoder
-
bc_validate() - Check NAR geocoding results against the BC Address Geocoder
-
qc_geocode() - Geocode Quebec addresses with the Quebec government geocoder
-
qc_validate() - Check NAR geocoding results against the Quebec government geocoder
-
osm_geocode() - Geocode Canadian addresses with OpenStreetMap data
Reverse geocoding
Find the addresses nearest a coordinate. reverse_geocode() is NAR-backed and local; qc_reverse_geocode() is the one online reverse geocoder here, and it covers Quebec only.
-
reverse_geocode() - Reverse Geocode Coordinates to Address
-
qc_reverse_geocode() - Reverse geocode Quebec coordinates with the Quebec government geocoder
The NAR database
Download and open a National Address Repository release, and get query results back as sf. geocode() and reverse_geocode() open a connection themselves when they are not given one, so these are for naming a release, querying the database directly, or controlling when the connection is held.
-
open_nar() - Open a NAR connection for the session to reuse
-
close_nar() - Close the session's NAR connection
-
nar_connection() - Get NAR data
-
nar_provinces() - Provinces a NAR database holds, as a user-facing value
-
available_nar_versions() - Scrape availabe NAR versions from the StatCan website
-
collect_nar() - Collect a NAR table as an sf object
The Quebec address register
Import the Repertoire quebecois des adresses into the same database alongside NAR, in tables of its own. Optional, Quebec only, and what the "rqa" tier of geocode() reads. The register is CC-BY 4.0 where the rest of this package’s data is OGL, so anything published from it has to carry rqa_attribution().
-
rqa_import() - Import Quebec's address register beside NAR
-
rqa_attribution() - Attribution required by the RQA licence
The road network file
Import Statistics Canada’s Road Network File into the same database alongside NAR, in tables of its own. Optional, national, and what the "rnf" tier of geocode() reads: it places a civic number along the street segment whose address range contains it, which reaches streets NAR does not carry at all.
-
rnf_import() - Import Statistics Canada's Road Network File beside NAR