@mailwoman/resolver-wof-sqlite 11.0.0 → 11.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -6
- package/lib/address/duplicate.ts +133 -0
- package/lib/address/keys/attribution.ts +119 -0
- package/lib/address/keys/build.ts +768 -0
- package/lib/address/keys/layout.ts +166 -0
- package/lib/address/keys/local-runner.ts +18 -0
- package/lib/address/keys/lookup.ts +205 -0
- package/lib/address/keys/open.ts +33 -0
- package/lib/address/keys/point-lookup.ts +130 -0
- package/lib/address/keys/postcode.ts +27 -0
- package/lib/address/keys/schema.ts +264 -0
- package/lib/address/number-forms.ts +61 -0
- package/lib/address/point/interpolation.ts +28 -23
- package/lib/address/point/schema.ts +2 -5
- package/lib/address/point/spine-schema.ts +4 -4
- package/lib/address/point.ts +12 -79
- package/lib/address/record.ts +155 -0
- package/lib/address/stack.ts +20 -0
- package/lib/address/subdivision-bounds.ts +81 -0
- package/lib/address.ts +2 -5
- package/lib/ancestry/backfill.ts +18 -47
- package/lib/ancestry.ts +10 -10
- package/lib/build/candidate.ts +44 -48
- package/lib/build/population-corrections.ts +4 -4
- package/lib/build/slim.ts +3 -6
- package/lib/candidate/alias-bags.ts +58 -18
- package/lib/candidate/ancestors/schema.ts +63 -43
- package/lib/candidate/ancestors/sidecar.ts +3 -3
- package/lib/candidate/bare-admin-names.ts +3 -3
- package/lib/candidate/country-display-names.ts +2 -5
- package/lib/candidate/extract-fold.ts +2 -5
- package/lib/candidate/fts.ts +5 -5
- package/lib/candidate/importance.ts +30 -24
- package/lib/candidate/key-fold.ts +132 -0
- package/lib/candidate/lookup.ts +25 -18
- package/lib/candidate/name-roles.ts +4 -4
- package/lib/candidate/nickname-namesakes.ts +140 -0
- package/lib/candidate/own-name.ts +12 -10
- package/lib/candidate/place-attrs.ts +4 -4
- package/lib/candidate/schema.ts +2 -5
- package/lib/candidate/scoring.ts +3 -6
- package/lib/capital-schema.ts +11 -10
- package/lib/capitals.ts +15 -12
- package/lib/convention/schema.ts +7 -7
- package/lib/convention.ts +3 -3
- package/lib/coverage-manifest-schema.ts +4 -4
- package/lib/env.ts +7 -6
- package/lib/exact-match.ts +6 -7
- package/lib/extracts.ts +11 -9
- package/lib/fst/autocomplete.ts +19 -15
- package/lib/fst/binary-matcher.ts +36 -50
- package/lib/fst/builder.ts +32 -11
- package/lib/fst/deserialize-web.ts +9 -8
- package/lib/fst/format.ts +153 -14
- package/lib/fst/freshness.ts +3 -4
- package/lib/fst/matcher.ts +6 -6
- package/lib/fst/serialize.ts +94 -69
- package/lib/fst/types.ts +4 -4
- package/lib/fst.ts +2 -5
- package/lib/fts/query.ts +3 -4
- package/lib/fts.ts +2 -5
- package/lib/geonames/aliases.ts +189 -46
- package/lib/geonames/postal.ts +17 -15
- package/lib/geonames.ts +2 -5
- package/lib/importance-source.ts +210 -0
- package/lib/index.ts +4 -5
- package/lib/interpolation.ts +7 -6
- package/lib/landmark/rows.ts +5 -5
- package/lib/landmark.ts +6 -6
- package/lib/lookup.ts +8 -8
- package/lib/name-score.ts +7 -6
- package/lib/nsul/lookup.ts +19 -15
- package/lib/nsul/schema.ts +4 -5
- package/lib/nsul.ts +2 -5
- package/lib/paths.ts +7 -7
- package/lib/place-importance-schema.ts +5 -8
- package/lib/poi/lookup.ts +11 -10
- package/lib/poi/schema.ts +16 -10
- package/lib/poi.ts +2 -5
- package/lib/polygon-schema.ts +10 -9
- package/lib/postal/city/alias/lookup.ts +14 -13
- package/lib/postal/city/alias/schema.ts +12 -12
- package/lib/postal/city/candidate-schema.ts +15 -12
- package/lib/postal.ts +2 -5
- package/lib/postcode-point-lookup.ts +2 -5
- package/lib/primary-preference.ts +42 -7
- package/lib/proximity-rerank.ts +23 -19
- package/lib/ranking-weights.ts +8 -7
- package/lib/region-keys.ts +15 -14
- package/lib/reverse.ts +16 -17
- package/lib/schema.ts +20 -6
- package/lib/search-fetch.ts +15 -11
- package/lib/sqlite/convention-source.ts +2 -5
- package/lib/sqlite/utils.ts +4 -4
- package/lib/street/centroid/schema.ts +6 -6
- package/lib/street/centroid.ts +3 -3
- package/lib/street/locale.ts +64 -0
- package/lib/street/morphology/fst/builder.ts +21 -19
- package/lib/street/morphology/fst/loader.ts +15 -13
- package/lib/street/name-lookup.ts +15 -14
- package/lib/street/normalize.ts +62 -17
- package/lib/street/segment-schema.ts +16 -14
- package/lib/street/table.ts +276 -0
- package/lib/street.ts +3 -5
- package/lib/types.ts +3 -6
- package/lib/unified-schema.ts +31 -9
- package/lib/uprn/existence.ts +10 -10
- package/lib/uprn/lookup.ts +7 -8
- package/lib/uprn/schema.ts +5 -5
- package/lib/uprn.ts +2 -5
- package/lib/weights-overlay-linker.ts +5 -8
- package/out/address/duplicate.d.ts +74 -0
- package/out/address/duplicate.d.ts.map +1 -0
- package/out/address/duplicate.js +79 -0
- package/out/address/duplicate.js.map +1 -0
- package/out/address/keys/attribution.d.ts +56 -0
- package/out/address/keys/attribution.d.ts.map +1 -0
- package/out/address/keys/attribution.js +64 -0
- package/out/address/keys/attribution.js.map +1 -0
- package/out/address/keys/build.d.ts +154 -0
- package/out/address/keys/build.d.ts.map +1 -0
- package/out/address/keys/build.js +423 -0
- package/out/address/keys/build.js.map +1 -0
- package/out/address/keys/layout.d.ts +92 -0
- package/out/address/keys/layout.d.ts.map +1 -0
- package/out/address/keys/layout.js +87 -0
- package/out/address/keys/layout.js.map +1 -0
- package/out/address/keys/local-runner.d.ts +9 -0
- package/out/address/keys/local-runner.d.ts.map +1 -0
- package/out/address/keys/local-runner.js +13 -0
- package/out/address/keys/local-runner.js.map +1 -0
- package/out/address/keys/lookup.d.ts +80 -0
- package/out/address/keys/lookup.d.ts.map +1 -0
- package/out/address/keys/lookup.js +104 -0
- package/out/address/keys/lookup.js.map +1 -0
- package/out/address/keys/open.d.ts +10 -0
- package/out/address/keys/open.d.ts.map +1 -0
- package/out/address/keys/open.js +28 -0
- package/out/address/keys/open.js.map +1 -0
- package/out/address/keys/point-lookup.d.ts +25 -0
- package/out/address/keys/point-lookup.d.ts.map +1 -0
- package/out/address/keys/point-lookup.js +100 -0
- package/out/address/keys/point-lookup.js.map +1 -0
- package/out/address/keys/postcode.d.ts +9 -0
- package/out/address/keys/postcode.d.ts.map +1 -0
- package/out/address/keys/postcode.js +25 -0
- package/out/address/keys/postcode.js.map +1 -0
- package/out/address/keys/schema.d.ts +156 -0
- package/out/address/keys/schema.d.ts.map +1 -0
- package/out/address/keys/schema.js +119 -0
- package/out/address/keys/schema.js.map +1 -0
- package/out/address/number-forms.d.ts +19 -0
- package/out/address/number-forms.d.ts.map +1 -0
- package/out/address/number-forms.js +50 -0
- package/out/address/number-forms.js.map +1 -0
- package/out/address/point/interpolation.d.ts +24 -22
- package/out/address/point/interpolation.d.ts.map +1 -1
- package/out/address/point/interpolation.js +3 -31
- package/out/address/point/interpolation.js.map +1 -1
- package/out/address/point/schema.d.ts +0 -5
- package/out/address/point/schema.d.ts.map +1 -1
- package/out/address/point/schema.js +2 -5
- package/out/address/point/schema.js.map +1 -1
- package/out/address/point/spine-schema.d.ts +1 -4
- package/out/address/point/spine-schema.d.ts.map +1 -1
- package/out/address/point/spine-schema.js +3 -4
- package/out/address/point/spine-schema.js.map +1 -1
- package/out/address/point.d.ts +0 -3
- package/out/address/point.d.ts.map +1 -1
- package/out/address/point.js +12 -71
- package/out/address/point.js.map +1 -1
- package/out/address/record.d.ts +125 -0
- package/out/address/record.d.ts.map +1 -0
- package/out/address/record.js +49 -0
- package/out/address/record.js.map +1 -0
- package/out/address/stack.d.ts +14 -0
- package/out/address/stack.d.ts.map +1 -0
- package/out/address/stack.js +19 -0
- package/out/address/stack.js.map +1 -0
- package/out/address/subdivision-bounds.d.ts +32 -0
- package/out/address/subdivision-bounds.d.ts.map +1 -0
- package/out/address/subdivision-bounds.js +48 -0
- package/out/address/subdivision-bounds.js.map +1 -0
- package/out/address.d.ts +0 -5
- package/out/address.d.ts.map +1 -1
- package/out/address.js +2 -5
- package/out/address.js.map +1 -1
- package/out/ancestry/backfill.d.ts +11 -13
- package/out/ancestry/backfill.d.ts.map +1 -1
- package/out/ancestry/backfill.js +6 -44
- package/out/ancestry/backfill.js.map +1 -1
- package/out/ancestry.d.ts +0 -14
- package/out/ancestry.d.ts.map +1 -1
- package/out/ancestry.js +9 -10
- package/out/ancestry.js.map +1 -1
- package/out/build/candidate.d.ts +20 -22
- package/out/build/candidate.d.ts.map +1 -1
- package/out/build/candidate.js +16 -28
- package/out/build/candidate.js.map +1 -1
- package/out/build/population-corrections.d.ts +1 -4
- package/out/build/population-corrections.d.ts.map +1 -1
- package/out/build/population-corrections.js +2 -19
- package/out/build/population-corrections.js.map +1 -1
- package/out/build/slim.d.ts +0 -5
- package/out/build/slim.d.ts.map +1 -1
- package/out/build/slim.js +3 -6
- package/out/build/slim.js.map +1 -1
- package/out/candidate/alias-bags.d.ts +9 -4
- package/out/candidate/alias-bags.d.ts.map +1 -1
- package/out/candidate/alias-bags.js +46 -19
- package/out/candidate/alias-bags.js.map +1 -1
- package/out/candidate/ancestors/schema.d.ts +60 -43
- package/out/candidate/ancestors/schema.d.ts.map +1 -1
- package/out/candidate/ancestors/schema.js +62 -43
- package/out/candidate/ancestors/schema.js.map +1 -1
- package/out/candidate/ancestors/sidecar.d.ts +0 -3
- package/out/candidate/ancestors/sidecar.d.ts.map +1 -1
- package/out/candidate/ancestors/sidecar.js +2 -6
- package/out/candidate/ancestors/sidecar.js.map +1 -1
- package/out/candidate/bare-admin-names.d.ts +0 -6
- package/out/candidate/bare-admin-names.d.ts.map +1 -1
- package/out/candidate/bare-admin-names.js +2 -3
- package/out/candidate/bare-admin-names.js.map +1 -1
- package/out/candidate/country-display-names.d.ts +0 -5
- package/out/candidate/country-display-names.d.ts.map +1 -1
- package/out/candidate/country-display-names.js +2 -5
- package/out/candidate/country-display-names.js.map +1 -1
- package/out/candidate/extract-fold.d.ts +0 -5
- package/out/candidate/extract-fold.d.ts.map +1 -1
- package/out/candidate/extract-fold.js +2 -5
- package/out/candidate/extract-fold.js.map +1 -1
- package/out/candidate/fts.d.ts +2 -5
- package/out/candidate/fts.d.ts.map +1 -1
- package/out/candidate/fts.js +2 -7
- package/out/candidate/fts.js.map +1 -1
- package/out/candidate/importance.d.ts +3 -33
- package/out/candidate/importance.d.ts.map +1 -1
- package/out/candidate/importance.js +29 -24
- package/out/candidate/importance.js.map +1 -1
- package/out/candidate/key-fold.d.ts +55 -0
- package/out/candidate/key-fold.d.ts.map +1 -0
- package/out/candidate/key-fold.js +80 -0
- package/out/candidate/key-fold.js.map +1 -0
- package/out/candidate/lookup.d.ts +0 -5
- package/out/candidate/lookup.d.ts.map +1 -1
- package/out/candidate/lookup.js +24 -17
- package/out/candidate/lookup.js.map +1 -1
- package/out/candidate/name-roles.d.ts +0 -6
- package/out/candidate/name-roles.d.ts.map +1 -1
- package/out/candidate/name-roles.js +3 -4
- package/out/candidate/name-roles.js.map +1 -1
- package/out/candidate/nickname-namesakes.d.ts +32 -0
- package/out/candidate/nickname-namesakes.d.ts.map +1 -0
- package/out/candidate/nickname-namesakes.js +98 -0
- package/out/candidate/nickname-namesakes.js.map +1 -0
- package/out/candidate/own-name.d.ts +0 -18
- package/out/candidate/own-name.d.ts.map +1 -1
- package/out/candidate/own-name.js +11 -10
- package/out/candidate/own-name.js.map +1 -1
- package/out/candidate/place-attrs.d.ts +1 -4
- package/out/candidate/place-attrs.d.ts.map +1 -1
- package/out/candidate/place-attrs.js +2 -12
- package/out/candidate/place-attrs.js.map +1 -1
- package/out/candidate/schema.d.ts +0 -5
- package/out/candidate/schema.d.ts.map +1 -1
- package/out/candidate/schema.js +2 -5
- package/out/candidate/schema.js.map +1 -1
- package/out/candidate/scoring.d.ts +0 -5
- package/out/candidate/scoring.d.ts.map +1 -1
- package/out/candidate/scoring.js +3 -6
- package/out/candidate/scoring.js.map +1 -1
- package/out/capital-schema.d.ts +0 -14
- package/out/capital-schema.d.ts.map +1 -1
- package/out/capital-schema.js +10 -10
- package/out/capital-schema.js.map +1 -1
- package/out/capitals.d.ts +0 -16
- package/out/capitals.d.ts.map +1 -1
- package/out/capitals.js +14 -12
- package/out/capitals.js.map +1 -1
- package/out/convention/schema.d.ts +4 -7
- package/out/convention/schema.d.ts.map +1 -1
- package/out/convention/schema.js +2 -10
- package/out/convention/schema.js.map +1 -1
- package/out/convention.d.ts +0 -3
- package/out/convention.d.ts.map +1 -1
- package/out/convention.js +2 -8
- package/out/convention.js.map +1 -1
- package/out/coverage-manifest-schema.d.ts +1 -4
- package/out/coverage-manifest-schema.d.ts.map +1 -1
- package/out/coverage-manifest-schema.js +2 -3
- package/out/coverage-manifest-schema.js.map +1 -1
- package/out/env.d.ts +0 -8
- package/out/env.d.ts.map +1 -1
- package/out/env.js +6 -6
- package/out/env.js.map +1 -1
- package/out/exact-match.d.ts +2 -6
- package/out/exact-match.d.ts.map +1 -1
- package/out/exact-match.js +3 -9
- package/out/exact-match.js.map +1 -1
- package/out/extracts.d.ts +8 -9
- package/out/extracts.d.ts.map +1 -1
- package/out/extracts.js +9 -8
- package/out/extracts.js.map +1 -1
- package/out/fst/autocomplete.d.ts +1 -19
- package/out/fst/autocomplete.d.ts.map +1 -1
- package/out/fst/autocomplete.js +2 -18
- package/out/fst/autocomplete.js.map +1 -1
- package/out/fst/binary-matcher.d.ts +6 -8
- package/out/fst/binary-matcher.d.ts.map +1 -1
- package/out/fst/binary-matcher.js +12 -43
- package/out/fst/binary-matcher.js.map +1 -1
- package/out/fst/builder.d.ts +0 -12
- package/out/fst/builder.d.ts.map +1 -1
- package/out/fst/builder.js +23 -11
- package/out/fst/builder.js.map +1 -1
- package/out/fst/deserialize-web.d.ts +1 -12
- package/out/fst/deserialize-web.d.ts.map +1 -1
- package/out/fst/deserialize-web.js +8 -8
- package/out/fst/deserialize-web.js.map +1 -1
- package/out/fst/format.d.ts +66 -16
- package/out/fst/format.d.ts.map +1 -1
- package/out/fst/format.js +100 -16
- package/out/fst/format.js.map +1 -1
- package/out/fst/freshness.d.ts +0 -7
- package/out/fst/freshness.d.ts.map +1 -1
- package/out/fst/freshness.js +2 -4
- package/out/fst/freshness.js.map +1 -1
- package/out/fst/matcher.d.ts +3 -6
- package/out/fst/matcher.d.ts.map +1 -1
- package/out/fst/matcher.js +2 -9
- package/out/fst/matcher.js.map +1 -1
- package/out/fst/serialize.d.ts +0 -23
- package/out/fst/serialize.d.ts.map +1 -1
- package/out/fst/serialize.js +68 -60
- package/out/fst/serialize.js.map +1 -1
- package/out/fst/types.d.ts +1 -4
- package/out/fst/types.d.ts.map +1 -1
- package/out/fst/types.js +2 -6
- package/out/fst/types.js.map +1 -1
- package/out/fst.d.ts +0 -5
- package/out/fst.d.ts.map +1 -1
- package/out/fst.js +2 -5
- package/out/fst.js.map +1 -1
- package/out/fts/query.d.ts +0 -4
- package/out/fts/query.d.ts.map +1 -1
- package/out/fts/query.js +2 -7
- package/out/fts/query.js.map +1 -1
- package/out/fts.d.ts +0 -5
- package/out/fts.d.ts.map +1 -1
- package/out/fts.js +2 -5
- package/out/fts.js.map +1 -1
- package/out/geonames/aliases.d.ts +43 -5
- package/out/geonames/aliases.d.ts.map +1 -1
- package/out/geonames/aliases.js +108 -44
- package/out/geonames/aliases.js.map +1 -1
- package/out/geonames/postal.d.ts +1 -25
- package/out/geonames/postal.d.ts.map +1 -1
- package/out/geonames/postal.js +15 -14
- package/out/geonames/postal.js.map +1 -1
- package/out/geonames.d.ts +0 -5
- package/out/geonames.d.ts.map +1 -1
- package/out/geonames.js +2 -5
- package/out/geonames.js.map +1 -1
- package/out/importance-source.d.ts +90 -0
- package/out/importance-source.d.ts.map +1 -0
- package/out/importance-source.js +133 -0
- package/out/importance-source.js.map +1 -0
- package/out/index.d.ts +2 -5
- package/out/index.d.ts.map +1 -1
- package/out/index.js +4 -5
- package/out/index.js.map +1 -1
- package/out/interpolation.d.ts +0 -7
- package/out/interpolation.d.ts.map +1 -1
- package/out/interpolation.js +6 -6
- package/out/interpolation.js.map +1 -1
- package/out/landmark/rows.d.ts +2 -5
- package/out/landmark/rows.d.ts.map +1 -1
- package/out/landmark/rows.js +2 -8
- package/out/landmark/rows.js.map +1 -1
- package/out/landmark.d.ts +3 -6
- package/out/landmark.d.ts.map +1 -1
- package/out/landmark.js +2 -8
- package/out/landmark.js.map +1 -1
- package/out/lookup.d.ts +0 -7
- package/out/lookup.d.ts.map +1 -1
- package/out/lookup.js +7 -8
- package/out/lookup.js.map +1 -1
- package/out/name-score.d.ts +4 -6
- package/out/name-score.d.ts.map +1 -1
- package/out/name-score.js +6 -6
- package/out/name-score.js.map +1 -1
- package/out/nsul/lookup.d.ts +16 -15
- package/out/nsul/lookup.d.ts.map +1 -1
- package/out/nsul/lookup.js +2 -25
- package/out/nsul/lookup.js.map +1 -1
- package/out/nsul/schema.d.ts +1 -5
- package/out/nsul/schema.d.ts.map +1 -1
- package/out/nsul/schema.js +3 -8
- package/out/nsul/schema.js.map +1 -1
- package/out/nsul.d.ts +0 -5
- package/out/nsul.d.ts.map +1 -1
- package/out/nsul.js +2 -5
- package/out/nsul.js.map +1 -1
- package/out/paths.d.ts +1 -13
- package/out/paths.d.ts.map +1 -1
- package/out/paths.js +6 -7
- package/out/paths.js.map +1 -1
- package/out/place-importance-schema.d.ts +3 -8
- package/out/place-importance-schema.d.ts.map +1 -1
- package/out/place-importance-schema.js +3 -6
- package/out/place-importance-schema.js.map +1 -1
- package/out/poi/lookup.d.ts +0 -13
- package/out/poi/lookup.d.ts.map +1 -1
- package/out/poi/lookup.js +10 -10
- package/out/poi/lookup.js.map +1 -1
- package/out/poi/schema.d.ts +13 -10
- package/out/poi/schema.d.ts.map +1 -1
- package/out/poi/schema.js +2 -13
- package/out/poi/schema.js.map +1 -1
- package/out/poi.d.ts +0 -5
- package/out/poi.d.ts.map +1 -1
- package/out/poi.js +2 -5
- package/out/poi.js.map +1 -1
- package/out/polygon-schema.d.ts +7 -9
- package/out/polygon-schema.d.ts.map +1 -1
- package/out/polygon-schema.js +2 -12
- package/out/polygon-schema.js.map +1 -1
- package/out/postal/city/alias/lookup.d.ts +11 -13
- package/out/postal/city/alias/lookup.d.ts.map +1 -1
- package/out/postal/city/alias/lookup.js +13 -13
- package/out/postal/city/alias/lookup.js.map +1 -1
- package/out/postal/city/alias/schema.d.ts +9 -12
- package/out/postal/city/alias/schema.d.ts.map +1 -1
- package/out/postal/city/alias/schema.js +2 -17
- package/out/postal/city/alias/schema.js.map +1 -1
- package/out/postal/city/candidate-schema.d.ts +12 -12
- package/out/postal/city/candidate-schema.d.ts.map +1 -1
- package/out/postal/city/candidate-schema.js +14 -12
- package/out/postal/city/candidate-schema.js.map +1 -1
- package/out/postal.d.ts +0 -5
- package/out/postal.d.ts.map +1 -1
- package/out/postal.js +2 -5
- package/out/postal.js.map +1 -1
- package/out/postcode-point-lookup.d.ts +0 -5
- package/out/postcode-point-lookup.d.ts.map +1 -1
- package/out/postcode-point-lookup.js +2 -5
- package/out/postcode-point-lookup.js.map +1 -1
- package/out/primary-preference.d.ts +20 -6
- package/out/primary-preference.d.ts.map +1 -1
- package/out/primary-preference.js +33 -6
- package/out/primary-preference.js.map +1 -1
- package/out/proximity-rerank.d.ts +2 -26
- package/out/proximity-rerank.d.ts.map +1 -1
- package/out/proximity-rerank.js +22 -19
- package/out/proximity-rerank.js.map +1 -1
- package/out/ranking-weights.d.ts +5 -7
- package/out/ranking-weights.d.ts.map +1 -1
- package/out/ranking-weights.js +2 -9
- package/out/ranking-weights.js.map +1 -1
- package/out/region-keys.d.ts +0 -15
- package/out/region-keys.d.ts.map +1 -1
- package/out/region-keys.js +14 -14
- package/out/region-keys.js.map +1 -1
- package/out/reverse.d.ts +1 -24
- package/out/reverse.d.ts.map +1 -1
- package/out/reverse.js +14 -16
- package/out/reverse.js.map +1 -1
- package/out/schema.d.ts +17 -6
- package/out/schema.d.ts.map +1 -1
- package/out/schema.js +2 -15
- package/out/schema.js.map +1 -1
- package/out/search-fetch.d.ts +0 -13
- package/out/search-fetch.d.ts.map +1 -1
- package/out/search-fetch.js +14 -11
- package/out/search-fetch.js.map +1 -1
- package/out/sqlite/convention-source.d.ts +0 -5
- package/out/sqlite/convention-source.d.ts.map +1 -1
- package/out/sqlite/convention-source.js +2 -5
- package/out/sqlite/convention-source.js.map +1 -1
- package/out/sqlite/utils.d.ts +1 -7
- package/out/sqlite/utils.d.ts.map +1 -1
- package/out/sqlite/utils.js +3 -4
- package/out/sqlite/utils.js.map +1 -1
- package/out/street/centroid/schema.d.ts +3 -6
- package/out/street/centroid/schema.d.ts.map +1 -1
- package/out/street/centroid/schema.js +2 -7
- package/out/street/centroid/schema.js.map +1 -1
- package/out/street/centroid.d.ts +0 -3
- package/out/street/centroid.d.ts.map +1 -1
- package/out/street/centroid.js +2 -6
- package/out/street/centroid.js.map +1 -1
- package/out/street/locale.d.ts +12 -0
- package/out/street/locale.d.ts.map +1 -0
- package/out/street/locale.js +54 -0
- package/out/street/locale.js.map +1 -0
- package/out/street/morphology/fst/builder.d.ts +1 -26
- package/out/street/morphology/fst/builder.d.ts.map +1 -1
- package/out/street/morphology/fst/builder.js +19 -18
- package/out/street/morphology/fst/builder.js.map +1 -1
- package/out/street/morphology/fst/loader.d.ts +0 -20
- package/out/street/morphology/fst/loader.d.ts.map +1 -1
- package/out/street/morphology/fst/loader.js +14 -13
- package/out/street/morphology/fst/loader.js.map +1 -1
- package/out/street/name-lookup.d.ts +11 -13
- package/out/street/name-lookup.d.ts.map +1 -1
- package/out/street/name-lookup.js +14 -14
- package/out/street/name-lookup.js.map +1 -1
- package/out/street/normalize.d.ts +29 -12
- package/out/street/normalize.d.ts.map +1 -1
- package/out/street/normalize.js +53 -13
- package/out/street/normalize.js.map +1 -1
- package/out/street/segment-schema.d.ts +11 -12
- package/out/street/segment-schema.d.ts.map +1 -1
- package/out/street/segment-schema.js +13 -12
- package/out/street/segment-schema.js.map +1 -1
- package/out/street/table.d.ts +154 -0
- package/out/street/table.d.ts.map +1 -0
- package/out/street/table.js +122 -0
- package/out/street/table.js.map +1 -0
- package/out/street.d.ts +1 -5
- package/out/street.d.ts.map +1 -1
- package/out/street.js +3 -5
- package/out/street.js.map +1 -1
- package/out/types.d.ts +1 -6
- package/out/types.d.ts.map +1 -1
- package/out/types.js +2 -5
- package/out/types.js.map +1 -1
- package/out/unified-schema.d.ts +18 -7
- package/out/unified-schema.d.ts.map +1 -1
- package/out/unified-schema.js +14 -10
- package/out/unified-schema.js.map +1 -1
- package/out/uprn/existence.d.ts +7 -10
- package/out/uprn/existence.d.ts.map +1 -1
- package/out/uprn/existence.js +9 -10
- package/out/uprn/existence.js.map +1 -1
- package/out/uprn/lookup.d.ts +1 -8
- package/out/uprn/lookup.d.ts.map +1 -1
- package/out/uprn/lookup.js +6 -8
- package/out/uprn/lookup.js.map +1 -1
- package/out/uprn/schema.d.ts +2 -5
- package/out/uprn/schema.d.ts.map +1 -1
- package/out/uprn/schema.js +2 -7
- package/out/uprn/schema.js.map +1 -1
- package/out/uprn.d.ts +0 -5
- package/out/uprn.d.ts.map +1 -1
- package/out/uprn.js +2 -5
- package/out/uprn.js.map +1 -1
- package/out/weights-overlay-linker.d.ts +3 -8
- package/out/weights-overlay-linker.d.ts.map +1 -1
- package/out/weights-overlay-linker.js +5 -8
- package/out/weights-overlay-linker.js.map +1 -1
- package/package.json +12 -12
- package/lib/currency-backfill.ts +0 -289
- package/out/currency-backfill.d.ts +0 -68
- package/out/currency-backfill.d.ts.map +0 -1
- package/out/currency-backfill.js +0 -169
- package/out/currency-backfill.js.map +0 -1
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: Teffen Ellis and Mailwoman contributors
|
|
2
|
+
// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Commercial
|
|
3
|
+
import { sql } from "kysely";
|
|
4
|
+
/**
|
|
5
|
+
* The key tables scoped by a text value, in the order a reader falls back through them.
|
|
6
|
+
*/
|
|
7
|
+
export const ADDRESS_SCOPED_KEY_TABLES = ["key_postcode", "key_locality", "key_subregion"];
|
|
8
|
+
/**
|
|
9
|
+
* The street aggregate tables, one per scoped level a parse without a number can state.
|
|
10
|
+
*/
|
|
11
|
+
export const ADDRESS_STREET_TABLES = ["street_postcode", "street_locality"];
|
|
12
|
+
/**
|
|
13
|
+
* Creates the `source` table.
|
|
14
|
+
*/
|
|
15
|
+
export async function createAddressSourceTable(db) {
|
|
16
|
+
await db.schema
|
|
17
|
+
.createTable("source")
|
|
18
|
+
.addColumn("source_id", "integer", (c) => c.primaryKey())
|
|
19
|
+
.addColumn("name", "text", (c) => c.notNull().unique())
|
|
20
|
+
.addColumn("license", "text")
|
|
21
|
+
.addColumn("authority", "text")
|
|
22
|
+
.addColumn("records", "integer", (c) => c.notNull())
|
|
23
|
+
.execute();
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Creates one scoped key table, clustered on `(scope, street, number, address_id)`.
|
|
27
|
+
*/
|
|
28
|
+
export async function createAddressScopedKeyTable(db, table) {
|
|
29
|
+
await db.schema
|
|
30
|
+
.createTable(table)
|
|
31
|
+
.addColumn("scope", "text", (c) => c.notNull())
|
|
32
|
+
.addColumn("street", "text", (c) => c.notNull())
|
|
33
|
+
.addColumn("number", "text", (c) => c.notNull())
|
|
34
|
+
.addColumn("address_id", "integer", (c) => c.notNull())
|
|
35
|
+
.addColumn("lat", "real", (c) => c.notNull())
|
|
36
|
+
.addColumn("lon", "real", (c) => c.notNull())
|
|
37
|
+
.addColumn("source_id", "integer", (c) => c.notNull())
|
|
38
|
+
.addPrimaryKeyConstraint(`${table}_pk`, ["scope", "street", "number", "address_id"])
|
|
39
|
+
// `without rowid` has no first-class builder. The raw modifier is the idiomatic fallback.
|
|
40
|
+
.modifyEnd(sql `without rowid`)
|
|
41
|
+
.execute();
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Creates the place key table, clustered on `(wof_id, street, number, address_id)`.
|
|
45
|
+
*/
|
|
46
|
+
export async function createAddressPlaceKeyTable(db) {
|
|
47
|
+
await db.schema
|
|
48
|
+
.createTable("key_place")
|
|
49
|
+
.addColumn("wof_id", "integer", (c) => c.notNull())
|
|
50
|
+
.addColumn("street", "text", (c) => c.notNull())
|
|
51
|
+
.addColumn("number", "text", (c) => c.notNull())
|
|
52
|
+
.addColumn("address_id", "integer", (c) => c.notNull())
|
|
53
|
+
.addColumn("lat", "real", (c) => c.notNull())
|
|
54
|
+
.addColumn("lon", "real", (c) => c.notNull())
|
|
55
|
+
.addColumn("source_id", "integer", (c) => c.notNull())
|
|
56
|
+
.addPrimaryKeyConstraint("key_place_pk", ["wof_id", "street", "number", "address_id"])
|
|
57
|
+
.modifyEnd(sql `without rowid`)
|
|
58
|
+
.execute();
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Creates the region key table, clustered on `(street, number, address_id)`.
|
|
62
|
+
*/
|
|
63
|
+
export async function createAddressRegionKeyTable(db) {
|
|
64
|
+
await db.schema
|
|
65
|
+
.createTable("key_region")
|
|
66
|
+
.addColumn("street", "text", (c) => c.notNull())
|
|
67
|
+
.addColumn("number", "text", (c) => c.notNull())
|
|
68
|
+
.addColumn("address_id", "integer", (c) => c.notNull())
|
|
69
|
+
.addColumn("lat", "real", (c) => c.notNull())
|
|
70
|
+
.addColumn("lon", "real", (c) => c.notNull())
|
|
71
|
+
.addColumn("source_id", "integer", (c) => c.notNull())
|
|
72
|
+
.addPrimaryKeyConstraint("key_region_pk", ["street", "number", "address_id"])
|
|
73
|
+
.modifyEnd(sql `without rowid`)
|
|
74
|
+
.execute();
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Creates one street aggregate table, clustered on `(scope, street)`.
|
|
78
|
+
*/
|
|
79
|
+
export async function createAddressStreetTable(db, table) {
|
|
80
|
+
await db.schema
|
|
81
|
+
.createTable(table)
|
|
82
|
+
.addColumn("scope", "text", (c) => c.notNull())
|
|
83
|
+
.addColumn("street", "text", (c) => c.notNull())
|
|
84
|
+
.addColumn("lat", "real", (c) => c.notNull())
|
|
85
|
+
.addColumn("lon", "real", (c) => c.notNull())
|
|
86
|
+
.addColumn("min_lat", "real", (c) => c.notNull())
|
|
87
|
+
.addColumn("max_lat", "real", (c) => c.notNull())
|
|
88
|
+
.addColumn("min_lon", "real", (c) => c.notNull())
|
|
89
|
+
.addColumn("max_lon", "real", (c) => c.notNull())
|
|
90
|
+
.addColumn("points", "integer", (c) => c.notNull())
|
|
91
|
+
.addPrimaryKeyConstraint(`${table}_pk`, ["scope", "street"])
|
|
92
|
+
.modifyEnd(sql `without rowid`)
|
|
93
|
+
.execute();
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Creates the `address` detail table, keyed by `address_id`.
|
|
97
|
+
*
|
|
98
|
+
* The rows store their names as JSON and are read one at a time by id, so the table keeps its rowid.
|
|
99
|
+
*/
|
|
100
|
+
export async function createAddressDetailTable(db) {
|
|
101
|
+
await db.schema
|
|
102
|
+
.createTable("address")
|
|
103
|
+
.addColumn("address_id", "integer", (c) => c.primaryKey())
|
|
104
|
+
.addColumn("source_id", "integer", (c) => c.notNull())
|
|
105
|
+
.addColumn("source_record_id", "text", (c) => c.notNull())
|
|
106
|
+
.addColumn("country", "text", (c) => c.notNull())
|
|
107
|
+
.addColumn("number", "text", (c) => c.notNull())
|
|
108
|
+
.addColumn("unit", "text")
|
|
109
|
+
.addColumn("street_raw", "text", (c) => c.notNull())
|
|
110
|
+
.addColumn("postcode", "text")
|
|
111
|
+
.addColumn("names", "text", (c) => c.notNull())
|
|
112
|
+
.addColumn("admin_code", "text")
|
|
113
|
+
.addColumn("lat", "real", (c) => c.notNull())
|
|
114
|
+
.addColumn("lon", "real", (c) => c.notNull())
|
|
115
|
+
.addColumn("placement", "text")
|
|
116
|
+
.addColumn("authority", "text")
|
|
117
|
+
.execute();
|
|
118
|
+
}
|
|
119
|
+
//# sourceMappingURL=schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../lib/address/keys/schema.ts"],"names":[],"mappings":"AAAA,kEAA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MAAM,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC;SAC5C,SAAS,CAAC,WAAW,EAAE,MAAM,CAAC;SAC9B,SAAS,CAAC,WAAW,EAAE,MAAM,CAAC;SAC9B,OAAO,EAAE,CAAA;AACZ,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { StreetLocale } from "#street/normalize";
|
|
2
|
+
/**
|
|
3
|
+
* The forms a normalized house number is probed under, the written form first,
|
|
4
|
+
* each later form tried only after every earlier one missed.
|
|
5
|
+
*
|
|
6
|
+
* - A hyphenated number that cannot be a range is joined: Hawaii's `19-4074`
|
|
7
|
+
* is stored as `194074` by some sources.
|
|
8
|
+
* This runs ahead of the range form, because that form reads it as house number 19.
|
|
9
|
+
* - A grid number leads with a compass letter, and one writer's `n3971` is another source's `n 3971`.
|
|
10
|
+
* - A range such as `385-387` falls back to its low end, since a register stores one number per point.
|
|
11
|
+
* - A number with one letter retries the other spacing, then the bare number:
|
|
12
|
+
* BAN stores `3 a`, while G-NAF and most OpenAddresses sources store `3a`.
|
|
13
|
+
* - Under `zh`, `14之12` and `30附40` fall back to `14` and `30`, the number the Taiwanese register stores.
|
|
14
|
+
* That answer is approximate.
|
|
15
|
+
*
|
|
16
|
+
* Both address readers call this, so they try one number in one order.
|
|
17
|
+
*/
|
|
18
|
+
export declare function houseNumberForms(number: string, locale: StreetLocale): Generator<string>;
|
|
19
|
+
//# sourceMappingURL=number-forms.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"number-forms.d.ts","sourceRoot":"","sources":["../../lib/address/number-forms.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAErD;;;;;;;;;;;;;;;GAeG;AACH,wBAAiB,gBAAgB,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,YAAY,GAAG,SAAS,CAAC,MAAM,CAAC,CAqCzF"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: Teffen Ellis and Mailwoman contributors
|
|
2
|
+
// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Commercial
|
|
3
|
+
import { isJoinedHouseNumber } from "@mailwoman/match/address-point";
|
|
4
|
+
/**
|
|
5
|
+
* The forms a normalized house number is probed under, the written form first,
|
|
6
|
+
* each later form tried only after every earlier one missed.
|
|
7
|
+
*
|
|
8
|
+
* - A hyphenated number that cannot be a range is joined: Hawaii's `19-4074`
|
|
9
|
+
* is stored as `194074` by some sources.
|
|
10
|
+
* This runs ahead of the range form, because that form reads it as house number 19.
|
|
11
|
+
* - A grid number leads with a compass letter, and one writer's `n3971` is another source's `n 3971`.
|
|
12
|
+
* - A range such as `385-387` falls back to its low end, since a register stores one number per point.
|
|
13
|
+
* - A number with one letter retries the other spacing, then the bare number:
|
|
14
|
+
* BAN stores `3 a`, while G-NAF and most OpenAddresses sources store `3a`.
|
|
15
|
+
* - Under `zh`, `14之12` and `30附40` fall back to `14` and `30`, the number the Taiwanese register stores.
|
|
16
|
+
* That answer is approximate.
|
|
17
|
+
*
|
|
18
|
+
* Both address readers call this, so they try one number in one order.
|
|
19
|
+
*/
|
|
20
|
+
export function* houseNumberForms(number, locale) {
|
|
21
|
+
yield number;
|
|
22
|
+
if (isJoinedHouseNumber(number)) {
|
|
23
|
+
yield number.replace("-", "");
|
|
24
|
+
}
|
|
25
|
+
const grid = /^([nesw])(?:\s+)?(\d+)$/.exec(number);
|
|
26
|
+
if (grid) {
|
|
27
|
+
yield number.includes(" ") ? `${grid[1]}${grid[2]}` : `${grid[1]} ${grid[2]}`;
|
|
28
|
+
}
|
|
29
|
+
const low = /^(\d+[a-z]?)-\d+[a-z]?$/.exec(number)?.[1];
|
|
30
|
+
if (low) {
|
|
31
|
+
yield low;
|
|
32
|
+
}
|
|
33
|
+
const joined = /^(\d+)\s+([a-z])$/.exec(number);
|
|
34
|
+
const spaced = /^(\d+)([a-z])$/.exec(number);
|
|
35
|
+
if (joined) {
|
|
36
|
+
yield `${joined[1]}${joined[2]}`;
|
|
37
|
+
yield joined[1];
|
|
38
|
+
}
|
|
39
|
+
else if (spaced) {
|
|
40
|
+
yield `${spaced[1]} ${spaced[2]}`;
|
|
41
|
+
yield spaced[1];
|
|
42
|
+
}
|
|
43
|
+
if (locale === "zh") {
|
|
44
|
+
const base = /^(\d+)(?:[之附]\d+)+$/u.exec(number)?.[1];
|
|
45
|
+
if (base) {
|
|
46
|
+
yield base;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=number-forms.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"number-forms.js","sourceRoot":"","sources":["../../lib/address/number-forms.ts"],"names":[],"mappings":"AAAA,kEAAkE;AAClE,kEAAkE;AAElE,OAAO,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAA;AAIpE;;;;;;;;;;;;;;;GAeG;AACH,MAAM,SAAS,CAAC,CAAC,gBAAgB,CAAC,MAAc,EAAE,MAAoB;IACrE,MAAM,MAAM,CAAA;IAEZ,IAAI,mBAAmB,CAAC,MAAM,CAAC,EAAE,CAAC;QACjC,MAAM,MAAM,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC,CAAA;IAC9B,CAAC;IAED,MAAM,IAAI,GAAG,yBAAyB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;IAEnD,IAAI,IAAI,EAAE,CAAC;QACV,MAAM,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC,EAAE,CAAA;IAC9E,CAAC;IAED,MAAM,GAAG,GAAG,yBAAyB,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,CAAA;IAEvD,IAAI,GAAG,EAAE,CAAC;QACT,MAAM,GAAG,CAAA;IACV,CAAC;IAED,MAAM,MAAM,GAAG,mBAAmB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;IAC/C,MAAM,MAAM,GAAG,gBAAgB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;IAE5C,IAAI,MAAM,EAAE,CAAC;QACZ,MAAM,GAAG,MAAM,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,EAAE,CAAA;QAChC,MAAM,MAAM,CAAC,CAAC,CAAE,CAAA;IACjB,CAAC;SAAM,IAAI,MAAM,EAAE,CAAC;QACnB,MAAM,GAAG,MAAM,CAAC,CAAC,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,EAAE,CAAA;QACjC,MAAM,MAAM,CAAC,CAAC,CAAE,CAAA;IACjB,CAAC;IAED,IAAI,MAAM,KAAK,IAAI,EAAE,CAAC;QACrB,MAAM,IAAI,GAAG,sBAAsB,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,CAAA;QAErD,IAAI,IAAI,EAAE,CAAC;YACV,MAAM,IAAI,CAAA;QACX,CAAC;IACF,CAAC;AACF,CAAC"}
|
|
@@ -1,30 +1,32 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
* @license AGPL-3.0
|
|
4
|
-
* @author Teffen Ellis, et al.
|
|
2
|
+
* Address-point interpolation, the second method of the resolution ladder.
|
|
5
3
|
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* replaces the tiger range tier's uniform-spacing assumption. Tiger range interpolation
|
|
10
|
-
* (`StreetInterpolator`) is the fallback for streets too sparse to bracket.
|
|
4
|
+
* When the exact address-point tier misses a house number, bracket the number with real neighbor
|
|
5
|
+
* points on the same street and interpolate linearly in house-number space between them.
|
|
6
|
+
* Real occupancy replaces the tiger range tier's uniform-spacing assumption.
|
|
11
7
|
*
|
|
12
|
-
*
|
|
13
|
-
* (`canonicalizeRouteKey`), identical at build time (`mailwoman situs address-points`) and query
|
|
14
|
-
* time by construction. Scope is postcode-first like the segment tier. A query without a postcode
|
|
15
|
-
* goes straight to the fallback. The fallback has its own statewide-ambiguity abstention.
|
|
8
|
+
* Tiger range interpolation (`StreetInterpolator`) is the fallback for streets too sparse to bracket.
|
|
16
9
|
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
10
|
+
* The matching key is `street_key`, the shared normalizer plus the route fold (`canonicalizeRouteKey`),
|
|
11
|
+
* identical at build time (`mailwoman situs address-points`) and query time by construction.
|
|
12
|
+
* Scope is postcode-first like the segment tier.
|
|
19
13
|
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
* -
|
|
27
|
-
*
|
|
14
|
+
* A query without a postcode goes straight to the fallback.
|
|
15
|
+
* The fallback has its own statewide-ambiguity abstention.
|
|
16
|
+
*
|
|
17
|
+
* Neighbor candidates never include the queried number itself, so production never
|
|
18
|
+
* overrides an on-file number and grading against the same extract is non-circular.
|
|
19
|
+
*
|
|
20
|
+
* - Both-sided bracket (`bracket: "both"`): linear interpolation between the
|
|
21
|
+
* nearest known number below and above.
|
|
22
|
+
* `uncertaintyM` is half the distance between them.
|
|
23
|
+
* - Single-sided (`bracket: "single"`): linear extrapolation along the two nearest
|
|
24
|
+
* known numbers on that side, capped at one pair-span beyond the nearest point
|
|
25
|
+
* (`t ≤ 2`, past which the line provides no evidence and the query falls through).
|
|
26
|
+
* `uncertaintyM` is the pair distance plus the extrapolated overshoot,
|
|
27
|
+
* larger than the both-sided radius.
|
|
28
|
+
* - No bracket, meaning no neighbors, a single known number, or past the extrapolation cap:
|
|
29
|
+
* fall through to the tiger fallback when configured, else null.
|
|
28
30
|
*
|
|
29
31
|
* Standalone like the segment tier, wired through the ordered `spatialTiers` list.
|
|
30
32
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interpolation.d.ts","sourceRoot":"","sources":["../../../lib/address/point/interpolation.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"interpolation.d.ts","sourceRoot":"","sources":["../../../lib/address/point/interpolation.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAA;AAEnE,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAA;AAEzD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAA;AACjE,OAAO,KAAK,EAAE,eAAe,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAA;AA8B7F,qBAAa,wBAAwB,CACpC,EAAE,SAAS,oBAAoB,GAAG,oBAAoB,CACrD,YAAW,mBAAmB;;IAY/B,YAAY,IAAI,EAAE;QAAE,MAAM,CAAC,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,cAAc,CAAC,EAAE,CAAC,CAAC;QAAC,QAAQ,CAAC,EAAE,kBAAkB,CAAA;KAAE,EA2BlG;IAED,QAAQ,CAAC,iBAAiB,OAAO;IAEjC,IAAI,CAAC,KAAK,EAAE,kBAAkB,GAAG,eAAe,GAAG,IAAI,CAsBtD;IAED,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,IAAI,CAEvB;CACD"}
|
|
@@ -1,33 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
* @license AGPL-3.0
|
|
4
|
-
* @author Teffen Ellis, et al.
|
|
5
|
-
*
|
|
6
|
-
* Address-point interpolation, the second method of the resolution ladder. When the exact
|
|
7
|
-
* address-point tier misses a house number, bracket the number with real neighbor points on the
|
|
8
|
-
* same street and interpolate linearly in house-number space between them. Real occupancy
|
|
9
|
-
* replaces the tiger range tier's uniform-spacing assumption. Tiger range interpolation
|
|
10
|
-
* (`StreetInterpolator`) is the fallback for streets too sparse to bracket.
|
|
11
|
-
*
|
|
12
|
-
* The matching key is `street_key`, the shared normalizer plus the route fold
|
|
13
|
-
* (`canonicalizeRouteKey`), identical at build time (`mailwoman situs address-points`) and query
|
|
14
|
-
* time by construction. Scope is postcode-first like the segment tier. A query without a postcode
|
|
15
|
-
* goes straight to the fallback. The fallback has its own statewide-ambiguity abstention.
|
|
16
|
-
*
|
|
17
|
-
* Neighbor candidates never include the queried number itself, so production never overrides an
|
|
18
|
-
* on-file number and grading against the same extract is non-circular.
|
|
19
|
-
*
|
|
20
|
-
* - Both-sided bracket (`bracket: "both"`): linear interpolation between the nearest known number
|
|
21
|
-
* below and above. `uncertaintyM` is half the distance between them.
|
|
22
|
-
* - Single-sided (`bracket: "single"`): linear extrapolation along the two nearest known numbers
|
|
23
|
-
* on that side, capped at one pair-span beyond the nearest point (`t ≤ 2`, past which the line
|
|
24
|
-
* provides no evidence and the query falls through). `uncertaintyM` is the pair distance plus
|
|
25
|
-
* the extrapolated overshoot, larger than the both-sided radius.
|
|
26
|
-
* - No bracket, meaning no neighbors, a single known number, or past the extrapolation cap: fall
|
|
27
|
-
* through to the tiger fallback when configured, else null.
|
|
28
|
-
*
|
|
29
|
-
* Standalone like the segment tier, wired through the ordered `spatialTiers` list.
|
|
30
|
-
*/
|
|
1
|
+
// SPDX-FileCopyrightText: Teffen Ellis and Mailwoman contributors
|
|
2
|
+
// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Commercial
|
|
31
3
|
import { haversine } from "@mailwoman/spatial/geometries/point/distance";
|
|
32
4
|
import { DatabaseClient } from "@mailwoman/sqlite/client";
|
|
33
5
|
import { hasTable, prepareAll } from "#sqlite-utils";
|
|
@@ -44,7 +16,7 @@ export class AddressPointInterpolator {
|
|
|
44
16
|
/**
|
|
45
17
|
* Resources this instance opened.
|
|
46
18
|
*
|
|
47
|
-
* A connection handed in by a caller
|
|
19
|
+
* A connection handed in by a caller isn't in here, so disposal cannot reach it.
|
|
48
20
|
* Ownership is membership rather than a flag a later branch checks.
|
|
49
21
|
*/
|
|
50
22
|
#resources;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interpolation.js","sourceRoot":"","sources":["../../../lib/address/point/interpolation.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"interpolation.js","sourceRoot":"","sources":["../../../lib/address/point/interpolation.ts"],"names":[],"mappings":"AAAA,kEAAkE;AAClE,kEAAkE;AAoClE,OAAO,EAAE,SAAS,EAAE,MAAM,8CAA8C,CAAA;AACxE,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAA;AAIzD,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAoB,MAAM,eAAe,CAAA;AACtE,OAAO,EAAE,oBAAoB,EAAiB,iBAAiB,EAAE,MAAM,mBAAmB,CAAA;AAC1F;;;;;GAKG;AACH,MAAM,mBAAmB,GAAG,CAAC,CAAA;AAqB7B,MAAM,OAAO,wBAAwB;IAG3B,GAAG,CAAoB;IAChC;;;;;OAKG;IACM,UAAU,CAAiB;IAC3B,SAAS,CAAgC;IACzC,WAAW,CAAyF;IAE7G,YAAY,IAAuF;QAClG,MAAM,SAAS,GAAG,IAAI,eAAe,EAAE,CAAA;QAEvC,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;YACnB,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC,QAAQ,CAAA;QACzB,CAAC;aAAM,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;YACxB,IAAI,CAAC,GAAG,GAAG,SAAS,CAAC,GAAG,CAAC,IAAI,cAAc,CAAK,IAAI,CAAC,MAAM,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,CAAA;QAClF,CAAC;aAAM,CAAC;YACP,MAAM,IAAI,KAAK,CAAC,iEAAiE,CAAC,CAAA;QACnF,CAAC;QAED,IAAI,CAAC,SAAS,GAA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,EAAE,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,GAAG,CAAC,GAAG,IAAI,CAAA;IAEjE,OAAO;QACN,GAAG;QACH,GAAG;QACH,YAAY,EAAE,IAAI;QAClB,MAAM,EAAE,eAAe;QACvB,aAAa,EAAE,IAAI;QACnB,OAAO,EAAE,QAAQ;QACjB,wFAAwF;QACxF,YAAY,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,UAAU,CAAC;QAC5C,MAAM,EAAE,IAAI,CAAC,MAAM;QACnB,OAAO,EAAE,IAAI,CAAC,OAAO;KACrB,CAAA;AACF,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../lib/address/point/schema.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../lib/address/point/schema.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAEpC,OAAO,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAA;AAErE;;;GAGG;AACH,MAAM,WAAW,iBAAiB;IACjC;;OAEG;IACH,WAAW,EAAE,SAAS,CAAA;IACtB;;;OAGG;IACH,UAAU,EAAE,QAAQ,CAAA;IACpB;;OAEG;IACH,MAAM,EAAE,MAAM,CAAA;IACd,IAAI,EAAE,MAAM,GAAG,IAAI,CAAA;IACnB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAA;IACvB;;OAEG;IACH,aAAa,EAAE,OAAO,GAAG,IAAI,CAAA;IAE7B,UAAU,EAAE,MAAM,CAAA;IAClB,GAAG,EAAE,MAAM,CAAA;IACX,GAAG,EAAE,MAAM,CAAA;IACX;;OAEG;IACH,MAAM,EAAE,MAAM,CAAA;IAEd,OAAO,EAAE,MAAM,CAAA;IACf;;;OAGG;IACH,UAAU,EAAE,MAAM,GAAG,IAAI,CAAA;IACzB;;;OAGG;IACH,SAAS,EAAE,MAAM,GAAG,IAAI,CAAA;CACxB;AAED;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACpC,aAAa,EAAE,iBAAiB,CAAA;CAChC;AAED;;;GAGG;AACH,MAAM,MAAM,wBAAwB,GAAG,IAAI,CAAC,MAAM,CAAC,oBAAoB,CAAC,EAAE,QAAQ,CAAC,CAAA;AAEnF;;GAEG;AACH,eAAO,MAAM,qBAAqB,YACjC,aAAa,EACb,YAAY,EACZ,QAAQ,EACR,MAAM,EACN,UAAU,EACV,eAAe,EACf,YAAY,EACZ,KAAK,EACL,KAAK,EACL,QAAQ,EACR,SAAS,EACT,YAAY,EACZ,WAAW,CACF,CAAA;AAEV;;GAEG;AACH,wBAAsB,uBAAuB,CAAC,EAAE,EAAE,wBAAwB,GAAG,OAAO,CAAC,IAAI,CAAC,CAkBzF;AAED;;GAEG;AACH,wBAAsB,yBAAyB,CAAC,EAAE,EAAE,wBAAwB,GAAG,OAAO,CAAC,IAAI,CAAC,CAiB3F"}
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
* @license AGPL-3.0
|
|
4
|
-
* @author Teffen Ellis, et al.
|
|
5
|
-
*/
|
|
1
|
+
// SPDX-FileCopyrightText: Teffen Ellis and Mailwoman contributors
|
|
2
|
+
// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Commercial
|
|
6
3
|
/**
|
|
7
4
|
* The `address_point` columns in insert order, from which the builder derives its positional placeholders.
|
|
8
5
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../lib/address/point/schema.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../lib/address/point/schema.ts"],"names":[],"mappings":"AAAA,kEAAkE;AAClE,kEAAkE;AAiElE;;GAEG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG;IACpC,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AChD,SAAS,CAAC,YAAY,EAAE,MAAM,CAAC;SAC/B,SAAS,CAAC,WAAW,EAAE,SAAS,CAAC;SACjC,OAAO,EAAE,CAAA;AACZ,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,yBAAyB,CAAC,EAA4B;IAC3E,MAAM,EAAE,CAAC,MAAM;SACb,WAAW,CAAC,iBAAiB,CAAC;SAC9B,EAAE,CAAC,eAAe,CAAC;SACnB,OAAO,CAAC,CAAC,UAAU,EAAE,aAAa,EAAE,QAAQ,CAAC,CAAC;SAC9C,OAAO,EAAE,CAAA;IAEX,MAAM,EAAE,CAAC,MAAM;SACb,WAAW,CAAC,iBAAiB,CAAC;SAC9B,EAAE,CAAC,eAAe,CAAC;SACnB,OAAO,CAAC,CAAC,eAAe,EAAE,aAAa,EAAE,QAAQ,CAAC,CAAC;SACnD,OAAO,EAAE,CAAA;IAEX,MAAM,EAAE,CAAC,MAAM,CAAC,WAAW,CAAC,kBAAkB,CAAC,CAAC,EAAE,CAAC,eAAe,CAAC,CAAC,OAAO,CAAC,CAAC,UAAU,EAAE,YAAY,CAAC,CAAC,CAAC,OAAO,EAAE,CAAA;IACjH,uFAAuF;IACvF,wFAAwF;IACxF,MAAM,EAAE,CAAC,MAAM,CAAC,WAAW,CAAC,eAAe,CAAC,CAAC,EAAE,CAAC,eAAe,CAAC,CAAC,OAAO,CAAC,CAAC,aAAa,EAAE,QAAQ,CAAC,CAAC,CAAC,OAAO,EAAE,CAAA;AAC9G,CAAC"}
|
|
@@ -1,7 +1,4 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @copyright Sister Software.
|
|
3
|
-
* @license AGPL-3.0
|
|
4
|
-
* @author Teffen Ellis, et al.
|
|
5
2
|
* @file The shared rooftop schema with an H3 spine column and the layer-interface tables.
|
|
6
3
|
*
|
|
7
4
|
* The OpenStreetMap and G-NAF rooftop builders write this shape. Readers of existing address points
|
|
@@ -34,7 +31,7 @@ export declare const SPINE_ADDRESS_POINT_COLUMNS: readonly ["street_norm", "stre
|
|
|
34
31
|
*/
|
|
35
32
|
export declare function createSpineAddressPointTables(db: Kysely<SpineAddressPointDatabase>): Promise<void>;
|
|
36
33
|
/**
|
|
37
|
-
* Build after the bulk load so the spine index
|
|
34
|
+
* Build after the bulk load so the spine index isn't updated on every streaming insert.
|
|
38
35
|
*/
|
|
39
36
|
export declare function createSpineAddressPointIndexes(db: Kysely<SpineAddressPointDatabase>): Promise<void>;
|
|
40
37
|
//# sourceMappingURL=spine-schema.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spine-schema.d.ts","sourceRoot":"","sources":["../../../lib/address/point/spine-schema.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"spine-schema.d.ts","sourceRoot":"","sources":["../../../lib/address/point/spine-schema.ts"],"names":[],"mappings":"AAGA;;;;;;GAMG;AAEH,OAAO,EAAsD,KAAK,mBAAmB,EAAE,MAAM,wBAAwB,CAAA;AACrH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAEpC,OAAO,EAAyB,KAAK,iBAAiB,EAA2B,MAAM,uBAAuB,CAAA;AAE9G;;;GAGG;AACH,eAAO,MAAM,2BAA2B,IAAI,CAAA;AAE5C,MAAM,WAAW,sBAAuB,SAAQ,iBAAiB;IAChE;;OAEG;IACH,OAAO,EAAE,MAAM,CAAA;CACf;AAED,MAAM,WAAW,yBAA0B,SAAQ,mBAAmB;IACrE,aAAa,EAAE,sBAAsB,CAAA;CACrC;AAED;;GAEG;AACH,eAAO,MAAM,2BAA2B,8KAAiD,CAAA;AAEzF;;GAEG;AACH,wBAAsB,6BAA6B,CAAC,EAAE,EAAE,MAAM,CAAC,yBAAyB,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAUxG;AAED;;GAEG;AACH,wBAAsB,8BAA8B,CAAC,EAAE,EAAE,MAAM,CAAC,yBAAyB,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAEzG"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: Teffen Ellis and Mailwoman contributors
|
|
2
|
+
// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Commercial
|
|
1
3
|
/**
|
|
2
|
-
* @copyright Sister Software.
|
|
3
|
-
* @license AGPL-3.0
|
|
4
|
-
* @author Teffen Ellis, et al.
|
|
5
4
|
* @file The shared rooftop schema with an H3 spine column and the layer-interface tables.
|
|
6
5
|
*
|
|
7
6
|
* The OpenStreetMap and G-NAF rooftop builders write this shape. Readers of existing address points
|
|
@@ -32,7 +31,7 @@ export async function createSpineAddressPointTables(db) {
|
|
|
32
31
|
await createLayerCoverageTable(db);
|
|
33
32
|
}
|
|
34
33
|
/**
|
|
35
|
-
* Build after the bulk load so the spine index
|
|
34
|
+
* Build after the bulk load so the spine index isn't updated on every streaming insert.
|
|
36
35
|
*/
|
|
37
36
|
export async function createSpineAddressPointIndexes(db) {
|
|
38
37
|
await db.schema.createIndex("idx_ap_h3").on("address_point").column("h3_cell").execute();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spine-schema.js","sourceRoot":"","sources":["../../../lib/address/point/spine-schema.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"spine-schema.js","sourceRoot":"","sources":["../../../lib/address/point/spine-schema.ts"],"names":[],"mappings":"AAAA,kEAAkE;AAClE,kEAAkE;AAElE;;;;;;GAMG;AAEH,OAAO,EAAE,wBAAwB,EAAE,wBAAwB,EAA4B,MAAM,wBAAwB,CAAA;AAGrH,OAAO,EAAE,qBAAqB,EAA0B,uBAAuB,EAAE,MAAM,uBAAuB,CAAA;AAE9G;;;GAGG;AACH,MAAM,CAAC,MAAM,2BAA2B,GAAG,CAAC,CAAA;AAa5C;;GAEG;AACH,MAAM,CAAC,MAAM,2BAA2B,GAAG,CAAC,GAAG,qBAAqB,EAAE,SAAS,CAAU,CAAA;AAEzF;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,6BAA6B,CAAC,EAAqC;IACxF,MAAM,uBAAuB,CAAC,EAAE,CAAC,CAAA;IAEjC,MAAM,EAAE,CAAC,MAAM;SACb,UAAU,CAAC,eAAe,CAAC;SAC3B,SAAS,CAAC,SAAS,EAAE,SAAS,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;SAC7D,OAAO,EAAE,CAAA;IAEX,MAAM,wBAAwB,CAAC,EAAE,CAAC,CAAA;IAClC,MAAM,wBAAwB,CAAC,EAAE,CAAC,CAAA;AACnC,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,8BAA8B,CAAC,EAAqC;IACzF,MAAM,EAAE,CAAC,MAAM,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC,EAAE,CAAC,eAAe,CAAC,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,OAAO,EAAE,CAAA;AACzF,CAAC"}
|
package/out/address/point.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"point.d.ts","sourceRoot":"","sources":["../../lib/address/point.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"point.d.ts","sourceRoot":"","sources":["../../lib/address/point.ts"],"names":[],"mappings":"AAGA;;GAEG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAA;AAInF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAG9C,OAAO,KAAK,EAAE,oBAAoB,EAAqB,MAAM,uBAAuB,CAAA;AAEpF,OAAO,EASN,KAAK,YAAY,EACjB,MAAM,mBAAmB,CAAA;AAc1B;;;;;;;;;;GAUG;AACH,qBAAa,wBAAwB,CAAC,EAAE,SAAS,oBAAoB,GAAG,oBAAoB,CAC3F,YAAW,kBAAkB,EAAE,UAAU;;IAkCzC;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,YACC,MAAM,EAAE,eAAe,EACvB,IAAI,GAAE;QACL,YAAY,CAAC,EAAE,YAAY,CAAA;QAC3B,YAAY,CAAC,EAAE,MAAM,GAAG,aAAa,CAAA;QACrC,aAAa,CAAC,EAAE,OAAO,GAAG,QAAQ,CAAA;KAC7B,EA+CN;IAED,IAAI,CAAC,KAAK,EAAE;QACX,MAAM,EAAE,MAAM,CAAA;QACd,MAAM,EAAE,MAAM,CAAA;QACd,QAAQ,CAAC,EAAE,MAAM,CAAA;QACjB,QAAQ,CAAC,EAAE,MAAM,CAAA;QACjB,MAAM,CAAC,EAAE,MAAM,CAAA;QACf,SAAS,CAAC,EAAE,MAAM,CAAA;QAClB,IAAI,EAAE;YAAE,MAAM,EAAE,MAAM,CAAC;YAAC,MAAM,EAAE,MAAM,CAAC;YAAC,MAAM,EAAE,MAAM,CAAC;YAAC,MAAM,EAAE,MAAM,CAAA;SAAE,GAAG,IAAI,CAAA;KAC/E,GAAG,eAAe,GAAG,IAAI,CAsCzB;IA8JD,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,IAAI,CAEvB;CACD"}
|
package/out/address/point.js
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
* @author Teffen Ellis, et al.
|
|
5
|
-
* @file SQLite implementation of core's `AddressPointLookup`.
|
|
6
|
-
*/
|
|
1
|
+
// SPDX-FileCopyrightText: Teffen Ellis and Mailwoman contributors
|
|
2
|
+
// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Commercial
|
|
3
|
+
import { latLonBoundsContain } from "@mailwoman/spatial/bbox";
|
|
7
4
|
import { DatabaseClient } from "@mailwoman/sqlite/client";
|
|
8
5
|
import { indexExists } from "@mailwoman/sqlite/introspection";
|
|
6
|
+
import { houseNumberForms } from "#address/number-forms";
|
|
9
7
|
import { hasTable, prepareGet } from "#sqlite-utils";
|
|
10
8
|
import { normalizeHouseNumberForKey, normalizeLocalityForKey, normalizeLocalityForKeyLocale, streetKeyVariants, streetLocaleForSurface, stripArrondissement, } from "#street/normalize";
|
|
11
9
|
/**
|
|
@@ -13,23 +11,6 @@ import { normalizeHouseNumberForKey, normalizeLocalityForKey, normalizeLocalityF
|
|
|
13
11
|
* It must match the fields of `AddressPointRow`.
|
|
14
12
|
*/
|
|
15
13
|
const SELECT_COLS = "lat, lon, source, release, locality_norm, postcode";
|
|
16
|
-
/**
|
|
17
|
-
* The widest span of numbers a written range covers on one building or block.
|
|
18
|
-
*/
|
|
19
|
-
const WIDEST_HOUSE_NUMBER_RANGE = 200;
|
|
20
|
-
/**
|
|
21
|
-
* Returns whether two hyphenated numbers read as one number rather than a range of houses.
|
|
22
|
-
*
|
|
23
|
-
* `8-9 Upper St` is a range, and joining it would answer the different house at number 89.
|
|
24
|
-
* `19-4074` and Queens's `123-45` cannot be ranges, because a range climbs by a short step.
|
|
25
|
-
*/
|
|
26
|
-
function isJoinedHyphenNumber(number) {
|
|
27
|
-
const parts = /^(\d+)-(\d+)$/.exec(number);
|
|
28
|
-
if (!parts)
|
|
29
|
-
return false;
|
|
30
|
-
const span = Number(parts[2]) - Number(parts[1]);
|
|
31
|
-
return span < 0 || span > WIDEST_HOUSE_NUMBER_RANGE;
|
|
32
|
-
}
|
|
33
14
|
/**
|
|
34
15
|
* Finds an address point by exact normalized `(street, number)` within a postcode,
|
|
35
16
|
* a locality, or a bounding box.
|
|
@@ -145,52 +126,12 @@ export class AddressPointSqliteLookup {
|
|
|
145
126
|
* Each fallback runs only after the previous forms missed.
|
|
146
127
|
*/
|
|
147
128
|
#findForKey(streetNorm, number, query) {
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
if (!row && isJoinedHyphenNumber(number)) {
|
|
153
|
-
row = this.#probe(streetNorm, number.replace("-", ""), query);
|
|
154
|
-
}
|
|
155
|
-
// A grid number leads with a compass letter.
|
|
156
|
-
// One writer's `N3971` is another source's `n 3971`.
|
|
157
|
-
if (!row) {
|
|
158
|
-
const grid = /^([nesw])(?:\s+)?(\d+)$/.exec(number);
|
|
159
|
-
if (grid) {
|
|
160
|
-
row = this.#probe(streetNorm, number.includes(" ") ? `${grid[1]}${grid[2]}` : `${grid[1]} ${grid[2]}`, query);
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
// The registers store one number per point, so a range such as "385-387" falls back to its low end.
|
|
164
|
-
if (!row) {
|
|
165
|
-
const low = /^(\d+[a-z]?)-\d+[a-z]?$/.exec(number)?.[1];
|
|
166
|
-
if (low) {
|
|
167
|
-
row = this.#probe(streetNorm, low, query);
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
// BAN stores a letter suffix as "3 a", while G-NAF and most OA sources store "3a".
|
|
171
|
-
// For a number of digits plus one letter, the lookup retries the other spacing
|
|
172
|
-
// and then the bare number.
|
|
173
|
-
if (!row) {
|
|
174
|
-
const joined = /^(\d+)\s+([a-z])$/.exec(number);
|
|
175
|
-
const spaced = /^(\d+)([a-z])$/.exec(number);
|
|
176
|
-
if (joined) {
|
|
177
|
-
row = this.#probe(streetNorm, `${joined[1]}${joined[2]}`, query) ?? this.#probe(streetNorm, joined[1], query);
|
|
178
|
-
}
|
|
179
|
-
else if (spaced) {
|
|
180
|
-
row = this.#probe(streetNorm, `${spaced[1]} ${spaced[2]}`, query) ?? this.#probe(streetNorm, spaced[1], query);
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
// The Taiwanese register stores `14之12` and `30附40` as numbers `14` and `30`.
|
|
184
|
-
// It stores the rest in `unit`.
|
|
185
|
-
// A query number that still includes the sub-number falls back to the base number.
|
|
186
|
-
// That result is approximate.
|
|
187
|
-
if (!row && this.#locale === "zh") {
|
|
188
|
-
const base = /^(\d+)(?:[之附]\d+)+$/u.exec(number)?.[1];
|
|
189
|
-
if (base) {
|
|
190
|
-
row = this.#probe(streetNorm, base, query);
|
|
191
|
-
}
|
|
129
|
+
for (const form of houseNumberForms(number, this.#locale)) {
|
|
130
|
+
const row = this.#probe(streetNorm, form, query);
|
|
131
|
+
if (row)
|
|
132
|
+
return row;
|
|
192
133
|
}
|
|
193
|
-
return
|
|
134
|
+
return null;
|
|
194
135
|
}
|
|
195
136
|
/**
|
|
196
137
|
* Probes one (street, number) key by postcode, then locality, then locality suffix, then bounding box.
|
|
@@ -249,11 +190,11 @@ export class AddressPointSqliteLookup {
|
|
|
249
190
|
/**
|
|
250
191
|
* Returns whether the row's own postcode or locality differs from the query's.
|
|
251
192
|
*
|
|
252
|
-
* A row field that
|
|
193
|
+
* A row field that's empty never contradicts.
|
|
253
194
|
* The locality is compared only when the extract's `localityKeys` is `"full"`,
|
|
254
195
|
* because abbreviated keys would reject correct rows.
|
|
255
196
|
*
|
|
256
|
-
* Two locality keys agree when they
|
|
197
|
+
* Two locality keys agree when they're equal or when one is the leading words of the other.
|
|
257
198
|
* A German disambiguated name such as `Lauta b Hoyerswerda` or `Freiberg Sachs` begins with the place
|
|
258
199
|
* name that OSM's `addr:city` records, and a word boundary keeps `lauta` apart from `lautabach`.
|
|
259
200
|
*/
|
|
@@ -290,7 +231,7 @@ export class AddressPointSqliteLookup {
|
|
|
290
231
|
return false;
|
|
291
232
|
if (!bbox)
|
|
292
233
|
return true;
|
|
293
|
-
return
|
|
234
|
+
return latLonBoundsContain(bbox, row.lat, row.lon);
|
|
294
235
|
}
|
|
295
236
|
[Symbol.dispose]() {
|
|
296
237
|
this.#db[Symbol.dispose]();
|