NAR building coordinates in the City of Toronto are offset by ~18 m (16.5 m W, 6.5 m S)
まだ誰も着手していません。
評価
調査の方向性
Start by reading the NAR database build and metadata paths to find where building geometry and CSD_CODE are handled; those files are not named in the issue. Reproduce the Toronto offset with the supplied DuckDB and R code, then check earlier NAR releases and the Toronto blockface representative points. Done means the offset is verified and its scope and handling are documented, including whether a correction or flag is appropriate.
索引モデルが issue の本文から書いたものです。
説明
Summary
In the NAR 2026-06 release, building geometry (BG_X/BG_Y, and equivalently BG_LATITUDE/BG_LONGITUDE) for every address in the City of Toronto (CSD 3520005) is offset by a constant ≈18 m. The points are about 16.5 m too far west and 6.5 m too far south of the true building positions. No other municipality shows a comparable shift.
BG_X/BG_Y and BG_LATITUDE/BG_LONGITUDE agree to within 0.1 m, and our EPSG:4269 → 3347 handling is a pure projection change, so the offset is in the published NAR coordinates rather than introduced by cangeocode's transforms. Since cangeocode returns these coordinates as geocoding results, all Toronto geocodes inherit the shift. That is enough to put points on the neighbouring lot or in the street, and it can assign addresses to the wrong dissemination block where DB boundaries follow lot lines or streets.
Evidence
1. Internal to NAR: building points versus their own blockface representative points. The mean of (building − blockface) should be close to 0 over many addresses, because house-to-street directions point every way. Sample of 30k locations per CSD:
| CSD | mean east (m) | mean north (m) |
|---|---|---|
| 3520005 Toronto | −13.7 | −3.5 |
| 3521005 Mississauga | +0.8 | +2.6 |
| 3519036 Markham | +0.8 | −0.4 |
| 3518013 Oshawa | −1.2 | +1.6 |
| 3506008 Ottawa | +1.8 | −0.4 |
| 2466023 Montréal | +0.2 | −0.1 |
| 4806016 Calgary | +2.2 | −1.3 |
| 5915022 Vancouver | +0.1 | −0.2 |
2. OSM building footprints. We counted the share of NAR building points that fall inside an OSM building=* polygon, then searched for the shift that maximises it:
| area | inside as published | best shift (true E / N) | inside after shift |
|---|---|---|---|
| Toronto, East York (43.70, −79.30) | 0.28 | +16.8 m / +4.6 m | 0.91 |
| Toronto, west end (43.655, −79.47) | 0.19 | +14.9 m / +5.0 m | 0.82 |
| Vancouver (49.245, −123.10) | 0.57 | ≈ 0 | 0.57 |
Within 150 m of 43.7018, −79.3030 (Munford Cres / Glen Albert Dr), 25% of the 128 building locations fall inside an OSM footprint as published, and 99% after a +16.5 m E / +6.5 m N shift. For example, 18 Munford Cres is published at −79.30325, 43.70111 and lands on the lot line west of the house.
3. JRC EMC-BUILT (Copernicus, 10 m built-up surface, 2022). For 40k residential building anchors across Toronto, the share of built-up surface under the point rises from 26.1% as published to 45.3% at the best shift of +16.5 m E / +6.5 m N. Fitting each quarter of the city separately (west, east, south, north) gives +16–17 m E / +7 m N. The fitted vector has a gradient under 1 m across the city, so this is a pure translation, not a rotation or scale error.
Spatial extent
We fitted the best shift against EMC-BUILT per grid cell, using at most 300 residential building anchors per cell and a split-half consistency check:
- GTA, 1.5 km cells: 278 of 284 cells whose anchors are mostly in CSD 3520005 have the Toronto vector (16 ± 4 m E, 7 ± 4 m N). None of the 1,179 cells in the surrounding CSDs of Peel, York, Durham, Halton, Hamilton and Simcoe do. The shifted region coincides with the City of Toronto boundary.
- National, 3 km cells, per-CSD coherence over 711 CSDs with at least 4 cells: Toronto is the only CSD where most cells share one shift vector (99% of 78 cells). Some small New Brunswick CSDs show a weak, roughly 6 m eastward tendency (e.g. 1321004, 1332076, 1331065). That is below EMC's resolution and only partially coherent, so we don't consider it actionable for now.
Only the 2026-06 NAR release was checked. It would be worth checking whether earlier releases have the same offset, and reporting it to Statistics Canada.
Reproduction
con <- DBI::dbConnect(duckdb::duckdb(), "<nar>.duckdb", read_only = TRUE)
p <- DBI::dbGetQuery(con, "
SELECT CSD_CODE csd, x, y, BF_REPPOINT_LONGITUDE bl, BF_REPPOINT_LATITUDE bt FROM (
SELECT *, row_number() OVER (PARTITION BY CSD_CODE ORDER BY hash(LOC_GUID)) i FROM Locations
WHERE CSD_CODE IN ('3520005', '3521005', '3519036', '5915022') AND x IS NOT NULL
AND BF_REPPOINT_LATITUDE IS NOT NULL) WHERE i <= 30000")
ll <- sf::st_coordinates(sf::st_transform(sf::st_as_sf(p, coords = c("x", "y"), crs = 3347), 4269))
p$de <- (ll[, 1] - p$bl) * 111320 * cos(p$bt * pi / 180)
p$dn <- (ll[, 2] - p$bt) * 110574
p <- p[abs(p$de) < 200 & abs(p$dn) < 200, ]
aggregate(cbind(de, dn) ~ csd, p, mean)
#> (rounded)
#> csd de dn
#> 3519036 0.8 -0.4
#> 3520005 -13.7 -3.5 <- Toronto
#> 3521005 0.8 2.6
#> 5915022 0.1 -0.2
Suggested handling
- Apply a correction when building the NAR database: for locations with
CSD_CODE == '3520005', translate the building geometry by +16.5 m east, +6.5 m north. Apply it in true east/north metres (in lon/lat, or via a local tangent plane), not along EPSG:3347 axes, which are rotated about 10° at Toronto. Record the correction in the DB metadata and make it optional so users can turn it off. - Alternatively, or as well, flag affected geocodes, e.g. a
geom_notecolumn, so users know these points carry a known offset. - Check whether blockface representative points (
BF_REPPOINT_*) in Toronto have a smaller residual offset. The building − blockface mean of (−13.7, −3.5) against the external estimate of (−16.5, −6.5) suggests blockface points may be off by about 3 m in the same direction.
Found while building a dot-density map, where NAR building points are used to place dwellings, from census 2021 dissemination block counts.
- 主要言語
- R
- スター
- 0
- フォーク
- 0
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
mountainMath/cangeocode のほかの issue
-
enhancement
難易度 5/5 1週間以上 初心者へのやさしさ 35/100
-
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
-
enhancement
難易度 5/5 1週間以上 初心者へのやさしさ 35/100
mountainMath/cangeocode#3 · コメント 1 件 ·
-
NAR apiオープンenhancement
難易度 5/5 1週間以上 初心者へのやさしさ 35/100
mountainMath/cangeocode#2 · コメント 3 件 ·
mountainMath/cangeocode の issue をすべて見る
似ている issue
-
bug key bindings source editor
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信
-
REQ - Positron IDE guidance対応中かも @johannajokio が 2 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
-
get_procs() @return docs don't match returned columns, and pid column is the row index対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 67/100
posit-dev/connectapi#532 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
Huber-group-EMBL/Rarr#294 ·
メンテナーはふだん 1 日以内に返信