mountainMath / mountainMath/cangeocode

Attach StatCan geographies to geocode() / reverse_geocode() results

Open
#5 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
R
Stars
0
Forks
0
PR merge metrics
No merged PRs in 30d

Description

Split out of #1, which is closed: `Locations` is imported and carries `CSD_CODE`, `FED_CODE`/`FED_ENG_NAME`/`FED_FRE_NAME` and `ER_CODE`/`ER_ENG_NAME`/`ER_FRE_NAME`, joined to `Addresses` on `LOC_GUID`.

What is missing is a convenience layer. Today a user who wants the census subdivision or federal riding for a geocoded address has to know the schema and write the join themselves — the Querying NAR vignette shows how, but it is manual:

tbl(con, "Addresses") |>
  left_join(tbl(con, "Locations") |> select(LOC_GUID, FED_ENG_NAME, ER_ENG_NAME),
            by = "LOC_GUID")

Proposal: attach the geography for callers who never touch the database directly.

Open questions, roughly in the order they need answering:

  • Shape. An argument on the existing functions (`geocode(geographies = TRUE)`, `reverse_geocode(geographies = ...)`) or a standalone verb (`nar_geographies(x, con)`) that takes a result and adds columns? A standalone verb composes better and keeps the two entry points from growing a third mode each.
  • Which columns, and named how. All of CSD/FED/ER, or a selectable subset? NAR ships codes and both official-language names; returning nine columns by default is a lot.
  • Rows with no `ADDR_GUID`. Interpolated and `bc_*` rows have no NAR record to join through, so the geography would have to come from the point rather than the key — a spatial lookup against something the package does not currently carry. Simplest first cut is to fill `NA` for those and document it; anything better needs boundary files.
  • `geom_source`. A blockface-derived point can sit on the far side of a boundary from the building it stands for. Worth a note if the geography is ever derived spatially.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with geocode(), reverse_geocode(), the Querying NAR vignette, and the Addresses-to-Locations join on LOC_GUID. Resolve the proposed API shape, geography columns, handling of rows without ADDR_GUID, and geom_source semantics; done means the chosen interface attaches documented geography results without requiring callers to write the join.

Written by the indexing model from the issue text.

Assessment

Tech stack
r
Domain
api
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Active
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.