@mailwoman/spatial 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 +2 -1
- package/lib/bbox.ts +3 -4
- package/lib/coordinate/bounds.ts +3 -4
- package/lib/coordinate/cell.ts +42 -0
- package/lib/coordinate/formats.ts +61 -5
- package/lib/digipin.ts +282 -0
- package/lib/distance.ts +5 -5
- package/lib/feature.ts +2 -5
- package/lib/gb/codepoint.ts +6 -7
- package/lib/gb/os-downloads.ts +6 -6
- package/lib/geometries/collection.ts +3 -4
- package/lib/geometries/line-string.ts +3 -4
- package/lib/geometries/point/coordinates.ts +8 -8
- package/lib/geometries/point/distance.ts +4 -4
- package/lib/geometries/point.ts +10 -17
- package/lib/geometries/polygon.ts +3 -6
- package/lib/geometries/ring-blob.ts +9 -10
- package/lib/geometries/round.ts +73 -0
- package/lib/geometries/simplify.ts +126 -0
- package/lib/geometries.ts +3 -4
- package/lib/google/place-id.ts +3 -4
- package/lib/google.ts +2 -5
- package/lib/h3/cell.ts +5 -5
- package/lib/h3/coverage.ts +8 -9
- package/lib/h3/interior-cells.ts +5 -6
- package/lib/h3/polygon-cells.ts +9 -10
- package/lib/h3.ts +2 -5
- package/lib/index.ts +5 -5
- package/lib/objects.ts +2 -5
- package/lib/open-location-code.ts +85 -39
- package/lib/osgb36.ts +2 -5
- package/lib/point/reading.ts +323 -0
- package/lib/point/text.ts +70 -0
- package/lib/polyline.ts +9 -10
- package/lib/position.ts +8 -7
- package/lib/projection/transform.ts +36 -21
- package/lib/projection.ts +2 -5
- package/lib/regions/codes.ts +2 -5
- package/lib/regions/names.ts +2 -5
- package/lib/regions.ts +2 -5
- package/lib/well-known-text.ts +3 -4
- package/out/bbox.d.ts +0 -7
- package/out/bbox.d.ts.map +1 -1
- package/out/bbox.js +2 -4
- package/out/bbox.js.map +1 -1
- package/out/coordinate/bounds.d.ts +0 -4
- package/out/coordinate/bounds.d.ts.map +1 -1
- package/out/coordinate/bounds.js +2 -4
- package/out/coordinate/bounds.js.map +1 -1
- package/out/coordinate/cell.d.ts +23 -0
- package/out/coordinate/cell.d.ts.map +1 -0
- package/out/coordinate/cell.js +24 -0
- package/out/coordinate/cell.js.map +1 -0
- package/out/coordinate/formats.d.ts +12 -5
- package/out/coordinate/formats.d.ts.map +1 -1
- package/out/coordinate/formats.js +50 -5
- package/out/coordinate/formats.js.map +1 -1
- package/out/digipin.d.ts +94 -0
- package/out/digipin.d.ts.map +1 -0
- package/out/digipin.js +242 -0
- package/out/digipin.js.map +1 -0
- package/out/distance.d.ts +1 -11
- package/out/distance.d.ts.map +1 -1
- package/out/distance.js +4 -5
- package/out/distance.js.map +1 -1
- package/out/feature.d.ts +0 -5
- package/out/feature.d.ts.map +1 -1
- package/out/feature.js +2 -5
- package/out/feature.js.map +1 -1
- package/out/gb/codepoint.d.ts +1 -9
- package/out/gb/codepoint.d.ts.map +1 -1
- package/out/gb/codepoint.js +5 -7
- package/out/gb/codepoint.js.map +1 -1
- package/out/gb/os-downloads.d.ts +3 -6
- package/out/gb/os-downloads.d.ts.map +1 -1
- package/out/gb/os-downloads.js +5 -6
- package/out/gb/os-downloads.js.map +1 -1
- package/out/geometries/collection.d.ts +0 -4
- package/out/geometries/collection.d.ts.map +1 -1
- package/out/geometries/collection.js +2 -7
- package/out/geometries/collection.js.map +1 -1
- package/out/geometries/line-string.d.ts +0 -4
- package/out/geometries/line-string.d.ts.map +1 -1
- package/out/geometries/line-string.js +2 -7
- package/out/geometries/line-string.js.map +1 -1
- package/out/geometries/point/coordinates.d.ts +2 -12
- package/out/geometries/point/coordinates.d.ts.map +1 -1
- package/out/geometries/point/coordinates.js +5 -5
- package/out/geometries/point/coordinates.js.map +1 -1
- package/out/geometries/point/distance.d.ts +1 -4
- package/out/geometries/point/distance.d.ts.map +1 -1
- package/out/geometries/point/distance.js +3 -4
- package/out/geometries/point/distance.js.map +1 -1
- package/out/geometries/point.d.ts +6 -17
- package/out/geometries/point.d.ts.map +1 -1
- package/out/geometries/point.js +6 -8
- package/out/geometries/point.js.map +1 -1
- package/out/geometries/polygon.d.ts +1 -6
- package/out/geometries/polygon.d.ts.map +1 -1
- package/out/geometries/polygon.js +3 -6
- package/out/geometries/polygon.js.map +1 -1
- package/out/geometries/ring-blob.d.ts +3 -7
- package/out/geometries/ring-blob.d.ts.map +1 -1
- package/out/geometries/ring-blob.js +6 -13
- package/out/geometries/ring-blob.js.map +1 -1
- package/out/geometries/round.d.ts +25 -0
- package/out/geometries/round.d.ts.map +1 -0
- package/out/geometries/round.js +47 -0
- package/out/geometries/round.js.map +1 -0
- package/out/geometries/simplify.d.ts +22 -0
- package/out/geometries/simplify.d.ts.map +1 -0
- package/out/geometries/simplify.js +93 -0
- package/out/geometries/simplify.js.map +1 -0
- package/out/geometries.d.ts +0 -4
- package/out/geometries.d.ts.map +1 -1
- package/out/geometries.js +2 -4
- package/out/geometries.js.map +1 -1
- package/out/google/place-id.d.ts +0 -4
- package/out/google/place-id.d.ts.map +1 -1
- package/out/google/place-id.js +2 -7
- package/out/google/place-id.js.map +1 -1
- package/out/google.d.ts +0 -5
- package/out/google.d.ts.map +1 -1
- package/out/google.js +2 -5
- package/out/google.js.map +1 -1
- package/out/h3/cell.d.ts +1 -4
- package/out/h3/cell.d.ts.map +1 -1
- package/out/h3/cell.js +4 -5
- package/out/h3/cell.js.map +1 -1
- package/out/h3/coverage.d.ts +5 -9
- package/out/h3/coverage.d.ts.map +1 -1
- package/out/h3/coverage.js +7 -9
- package/out/h3/coverage.js.map +1 -1
- package/out/h3/interior-cells.d.ts +0 -8
- package/out/h3/interior-cells.d.ts.map +1 -1
- package/out/h3/interior-cells.js +4 -6
- package/out/h3/interior-cells.js.map +1 -1
- package/out/h3/polygon-cells.d.ts +6 -10
- package/out/h3/polygon-cells.d.ts.map +1 -1
- package/out/h3/polygon-cells.js +6 -8
- package/out/h3/polygon-cells.js.map +1 -1
- package/out/h3.d.ts +0 -5
- package/out/h3.d.ts.map +1 -1
- package/out/h3.js +2 -5
- package/out/h3.js.map +1 -1
- package/out/index.d.ts +3 -5
- package/out/index.d.ts.map +1 -1
- package/out/index.js +5 -5
- package/out/index.js.map +1 -1
- package/out/objects.d.ts +0 -5
- package/out/objects.d.ts.map +1 -1
- package/out/objects.js +2 -5
- package/out/objects.js.map +1 -1
- package/out/open-location-code.d.ts +30 -20
- package/out/open-location-code.d.ts.map +1 -1
- package/out/open-location-code.js +47 -32
- package/out/open-location-code.js.map +1 -1
- package/out/osgb36.d.ts +0 -5
- package/out/osgb36.d.ts.map +1 -1
- package/out/osgb36.js +2 -5
- package/out/osgb36.js.map +1 -1
- package/out/point/reading.d.ts +144 -0
- package/out/point/reading.d.ts.map +1 -0
- package/out/point/reading.js +167 -0
- package/out/point/reading.js.map +1 -0
- package/out/point/text.d.ts +117 -0
- package/out/point/text.d.ts.map +1 -0
- package/out/point/text.js +44 -0
- package/out/point/text.js.map +1 -0
- package/out/polyline.d.ts +1 -14
- package/out/polyline.d.ts.map +1 -1
- package/out/polyline.js +8 -10
- package/out/polyline.js.map +1 -1
- package/out/position.d.ts +3 -7
- package/out/position.d.ts.map +1 -1
- package/out/position.js +4 -8
- package/out/position.js.map +1 -1
- package/out/projection/transform.d.ts +33 -21
- package/out/projection/transform.d.ts.map +1 -1
- package/out/projection/transform.js +4 -2
- package/out/projection/transform.js.map +1 -1
- package/out/projection.d.ts +0 -5
- package/out/projection.d.ts.map +1 -1
- package/out/projection.js +2 -5
- package/out/projection.js.map +1 -1
- package/out/regions/codes.d.ts +0 -5
- package/out/regions/codes.d.ts.map +1 -1
- package/out/regions/codes.js +2 -5
- package/out/regions/codes.js.map +1 -1
- package/out/regions/names.d.ts +0 -5
- package/out/regions/names.d.ts.map +1 -1
- package/out/regions/names.js +2 -5
- package/out/regions/names.js.map +1 -1
- package/out/regions.d.ts +0 -5
- package/out/regions.d.ts.map +1 -1
- package/out/regions.js +2 -5
- package/out/regions.js.map +1 -1
- package/out/tools/ogr/stream.d.ts +0 -6
- package/out/tools/ogr/stream.d.ts.map +1 -1
- package/out/tools/ogr/stream.js +2 -3
- package/out/tools/ogr/stream.js.map +1 -1
- package/out/tools/ogr.d.ts +0 -14
- package/out/tools/ogr.d.ts.map +1 -1
- package/out/tools/ogr.js +10 -12
- package/out/tools/ogr.js.map +1 -1
- package/out/tools/tsconfig.tsbuildinfo +1 -1
- package/out/tsconfig.test.tsbuildinfo +1 -1
- package/out/well-known-text.d.ts +0 -7
- package/out/well-known-text.d.ts.map +1 -1
- package/out/well-known-text.js +2 -4
- package/out/well-known-text.js.map +1 -1
- package/package.json +7 -10
- package/tools/ogr/stream.ts +3 -3
- package/tools/ogr.ts +11 -12
|
@@ -0,0 +1,323 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: Teffen Ellis and Mailwoman contributors
|
|
2
|
+
// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Commercial
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* @file What a typed query resolves to when it is a point rather than an address, read from recognitions.
|
|
6
|
+
*
|
|
7
|
+
* A search field receives coordinates in a dozen spellings, a plus code, an H3 cell, a geohash or a
|
|
8
|
+
* Who's On First id beside ordinary addresses. {@link recognizePointQuery} runs one recognizer over the `coordinates`,
|
|
9
|
+
* `spatial` and `identifiers` families of `@mailwoman/recognizer` and answers from the recognition that spans the text.
|
|
10
|
+
* It decodes no cell: decoding a code to a coordinate belongs to the module that owns the format,
|
|
11
|
+
* and the H3 reader loads a WebAssembly binary that a text test shouldn't pay for.
|
|
12
|
+
*
|
|
13
|
+
* # What makes a recognition a reading
|
|
14
|
+
*
|
|
15
|
+
* A recognition is trusted when the engine's validator accepted it and its span is the whole text.
|
|
16
|
+
* An embedded span or a rejected recognition never becomes a reading: `Apt 4, 12 Main St` holds the valid pair `4, 12`.
|
|
17
|
+
*
|
|
18
|
+
* The grammars admit no white space around a value, so **the caller trims** the text before it is read.
|
|
19
|
+
* The earth app trims where it takes the typed input.
|
|
20
|
+
*
|
|
21
|
+
* # One handler for every kind
|
|
22
|
+
*
|
|
23
|
+
* `handlers` has an entry for each kind of the three families, and the object is checked against
|
|
24
|
+
* `HandlerMap<typeof families>`. A kind added to any family fails the TypeScript build until it has a handler.
|
|
25
|
+
* A handler returns a point reading, or a {@link NotAPointQuery} with the recognized kind and the reason it isn't a point.
|
|
26
|
+
*/
|
|
27
|
+
|
|
28
|
+
import {
|
|
29
|
+
createRecognizer,
|
|
30
|
+
type HandlerMap,
|
|
31
|
+
type KindsOf,
|
|
32
|
+
type Recognition,
|
|
33
|
+
type RecognitionsOf,
|
|
34
|
+
} from "@mailwoman/recognizer"
|
|
35
|
+
import { coordinates } from "@mailwoman/recognizer/coordinates"
|
|
36
|
+
import { isDeterministicSpatial } from "@mailwoman/recognizer/deterministic/spatial"
|
|
37
|
+
import { identifiers } from "@mailwoman/recognizer/identifiers"
|
|
38
|
+
import { spatial } from "@mailwoman/recognizer/spatial"
|
|
39
|
+
import type { AxisOrder, Validated } from "@mailwoman/recognizer/types"
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* The families a point query is read from, composed once.
|
|
43
|
+
*/
|
|
44
|
+
const families = [coordinates, spatial, identifiers] as const
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Every kind of recognition a point query reads, one per shape of the three families.
|
|
48
|
+
*/
|
|
49
|
+
export type PointQueryKind = KindsOf<typeof families>
|
|
50
|
+
|
|
51
|
+
const recognizer = createRecognizer(families)
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* A point reading is the point a text resolves to.
|
|
55
|
+
*
|
|
56
|
+
* `recognized` is the generated kind of the recognition the reading came from.
|
|
57
|
+
*/
|
|
58
|
+
export type PointReading = {
|
|
59
|
+
readonly recognized: PointQueryKind
|
|
60
|
+
} & (
|
|
61
|
+
| {
|
|
62
|
+
/**
|
|
63
|
+
* A coordinate pair in decimal, degrees-minutes-seconds, labeled, `geo:`
|
|
64
|
+
* or Google Maps form, latitude and longitude as the validator branded them.
|
|
65
|
+
*
|
|
66
|
+
* `lon_lat` is reported when the first number is out of latitude range,
|
|
67
|
+
* so it can only be a longitude.
|
|
68
|
+
*/
|
|
69
|
+
readonly kind: "coordinates"
|
|
70
|
+
readonly latitude: Validated.Latitude
|
|
71
|
+
readonly longitude: Validated.Longitude
|
|
72
|
+
readonly order: AxisOrder
|
|
73
|
+
}
|
|
74
|
+
| {
|
|
75
|
+
/**
|
|
76
|
+
* A GeoJSON `Point`.
|
|
77
|
+
* Its position is already latitude first in the payload.
|
|
78
|
+
*/
|
|
79
|
+
readonly kind: "geojson_point"
|
|
80
|
+
readonly latitude: Validated.Latitude
|
|
81
|
+
readonly longitude: Validated.Longitude
|
|
82
|
+
}
|
|
83
|
+
| {
|
|
84
|
+
/**
|
|
85
|
+
* A full Open Location Code, upper-cased.
|
|
86
|
+
* It decodes to a cell with no further input.
|
|
87
|
+
*/
|
|
88
|
+
readonly kind: "plus_code"
|
|
89
|
+
readonly full: true
|
|
90
|
+
readonly code: Validated.FullPlusCode
|
|
91
|
+
}
|
|
92
|
+
| {
|
|
93
|
+
/**
|
|
94
|
+
* A short Open Location Code, upper-cased.
|
|
95
|
+
* It decodes only beside a reference position.
|
|
96
|
+
*/
|
|
97
|
+
readonly kind: "plus_code"
|
|
98
|
+
readonly full: false
|
|
99
|
+
readonly code: Validated.ShortPlusCode
|
|
100
|
+
}
|
|
101
|
+
| {
|
|
102
|
+
/**
|
|
103
|
+
* A DIGIPIN, ten upper-case characters without hyphens.
|
|
104
|
+
*/
|
|
105
|
+
readonly kind: "digipin"
|
|
106
|
+
readonly code: Validated.Digipin
|
|
107
|
+
}
|
|
108
|
+
| {
|
|
109
|
+
/**
|
|
110
|
+
* An H3 cell index in its hexadecimal form, lower-cased.
|
|
111
|
+
*
|
|
112
|
+
* The validator checks the shape, and the H3 library decides validity when it decodes the cell.
|
|
113
|
+
*/
|
|
114
|
+
readonly kind: "h3"
|
|
115
|
+
readonly cell: string
|
|
116
|
+
}
|
|
117
|
+
| {
|
|
118
|
+
/**
|
|
119
|
+
* A geohash behind its `geohash:` or `gh:` prefix, lower-cased.
|
|
120
|
+
*/
|
|
121
|
+
readonly kind: "geohash"
|
|
122
|
+
readonly hash: string
|
|
123
|
+
}
|
|
124
|
+
| {
|
|
125
|
+
/**
|
|
126
|
+
* A Who's On First id, from `wof:85633793`, `wof 85633793` or a Spelunker link.
|
|
127
|
+
*/
|
|
128
|
+
readonly kind: "wof"
|
|
129
|
+
readonly id: Validated.Integer
|
|
130
|
+
}
|
|
131
|
+
)
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* Lists why a recognized text isn't a point query.
|
|
135
|
+
*
|
|
136
|
+
* - `names_no_position`: the text is an identifier or a document with no single position,
|
|
137
|
+
* such as a Census GEOID, a GNIS feature id or a GeoJSON `LineString`.
|
|
138
|
+
* - `ambiguous_without_prefix`: the text is a valid code whose spelling is also a phone number
|
|
139
|
+
* or a count, so no prefix or separator makes it a position.
|
|
140
|
+
* - `digit_group`: the text is a well-formed code made only of digits in a grouped form.
|
|
141
|
+
* A phone number is written the same way.
|
|
142
|
+
*/
|
|
143
|
+
export type NotAPointReason = "names_no_position" | "ambiguous_without_prefix" | "digit_group"
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* The text is a recognized shape and not a point query: a caller sends it to the address classifier.
|
|
147
|
+
*/
|
|
148
|
+
export interface NotAPointQuery {
|
|
149
|
+
readonly kind: "not_a_point"
|
|
150
|
+
readonly recognized: PointQueryKind
|
|
151
|
+
readonly reason: NotAPointReason
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* A text that's a whole recognition resolves to a point or to a shape that isn't a point.
|
|
156
|
+
*/
|
|
157
|
+
export type PointQueryReading = PointReading | NotAPointQuery
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* The payload of a recognition the reader has already checked is validated.
|
|
161
|
+
*
|
|
162
|
+
* A recognition without one is a defect in the reader, so it throws rather than answering with an absence.
|
|
163
|
+
*/
|
|
164
|
+
function payloadOf<Payload>(recognition: {
|
|
165
|
+
readonly kind: string
|
|
166
|
+
readonly validation:
|
|
167
|
+
| { readonly status: "validated"; readonly payload: Payload }
|
|
168
|
+
| { readonly status: "rejected" | "unvalidated" }
|
|
169
|
+
}): Payload {
|
|
170
|
+
const { validation } = recognition
|
|
171
|
+
|
|
172
|
+
if (validation.status !== "validated") {
|
|
173
|
+
throw new RangeError(`${recognition.kind} reached its point handler without a validated payload`)
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
return validation.payload
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
interface PairPayload {
|
|
180
|
+
readonly latitude: Validated.Latitude
|
|
181
|
+
readonly longitude: Validated.Longitude
|
|
182
|
+
readonly order: AxisOrder
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
function coordinatePair(recognition: Recognition<PointQueryKind, PairPayload, string>): PointReading {
|
|
186
|
+
const { latitude, longitude, order } = payloadOf(recognition)
|
|
187
|
+
|
|
188
|
+
return { kind: "coordinates", recognized: recognition.kind, latitude, longitude, order }
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
function noPosition(recognition: { readonly kind: PointQueryKind }): NotAPointQuery {
|
|
192
|
+
return { kind: "not_a_point", recognized: recognition.kind, reason: "names_no_position" }
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
function wofID(recognition: Recognition<PointQueryKind, { readonly id: Validated.Integer }, string>): PointReading {
|
|
196
|
+
return { kind: "wof", recognized: recognition.kind, id: payloadOf(recognition).id }
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
function h3Cell(recognition: Recognition<PointQueryKind, { readonly cell: string }, string>): PointReading {
|
|
200
|
+
return { kind: "h3", recognized: recognition.kind, cell: payloadOf(recognition).cell.toLowerCase() }
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
/**
|
|
204
|
+
* One handler per kind.
|
|
205
|
+
*
|
|
206
|
+
* A new kind in any composed family fails this object's `satisfies` clause.
|
|
207
|
+
*
|
|
208
|
+
* The second clause fixes each handler's return type.
|
|
209
|
+
* `HandlerMap` leaves it open.
|
|
210
|
+
*/
|
|
211
|
+
const handlers = {
|
|
212
|
+
"coordinate.decimal_pair": coordinatePair,
|
|
213
|
+
"coordinate.decimal_pair_spaced": coordinatePair,
|
|
214
|
+
"coordinate.dms_pair": coordinatePair,
|
|
215
|
+
"coordinate.dms_pair_spaced": coordinatePair,
|
|
216
|
+
"coordinate.labeled_pair": coordinatePair,
|
|
217
|
+
"coordinate.maps_segment": coordinatePair,
|
|
218
|
+
// RFC 5870 fixes the order as latitude, longitude, altitude, and the payload has no order of its own.
|
|
219
|
+
"coordinate.geo_uri": (recognition): PointReading => {
|
|
220
|
+
const { latitude, longitude } = payloadOf(recognition)
|
|
221
|
+
|
|
222
|
+
return { kind: "coordinates", recognized: recognition.kind, latitude, longitude, order: "lat_lon" }
|
|
223
|
+
},
|
|
224
|
+
|
|
225
|
+
"plus_code.token": (recognition): PointReading => {
|
|
226
|
+
const { full_code, short_code } = payloadOf(recognition)
|
|
227
|
+
|
|
228
|
+
if (full_code != null) return { kind: "plus_code", recognized: recognition.kind, full: true, code: full_code }
|
|
229
|
+
|
|
230
|
+
if (short_code != null) return { kind: "plus_code", recognized: recognition.kind, full: false, code: short_code }
|
|
231
|
+
|
|
232
|
+
// The validator fills exactly one of the two fields, so a validated payload with neither is a defect in the engine.
|
|
233
|
+
throw new RangeError(`${recognition.kind} validated with neither a full code nor a short code`)
|
|
234
|
+
},
|
|
235
|
+
// The validator accepts the all-digit form.
|
|
236
|
+
// A phone number is written the same way.
|
|
237
|
+
// The trust rule decides.
|
|
238
|
+
"digipin.display": (recognition): PointQueryReading =>
|
|
239
|
+
isDeterministicSpatial(recognition, recognition.text)
|
|
240
|
+
? { kind: "digipin", recognized: recognition.kind, code: payloadOf(recognition).code }
|
|
241
|
+
: { kind: "not_a_point", recognized: recognition.kind, reason: "digit_group" },
|
|
242
|
+
// Ten characters from `2` to `9` and `C F J K L M P T` are also a phone number, a count or a postcode.
|
|
243
|
+
"digipin.compact": (recognition): NotAPointQuery => ({
|
|
244
|
+
kind: "not_a_point",
|
|
245
|
+
recognized: recognition.kind,
|
|
246
|
+
reason: "ambiguous_without_prefix",
|
|
247
|
+
}),
|
|
248
|
+
// A GeoJSON `Point` is the point.
|
|
249
|
+
// Every other GeoJSON type is a document with no single position.
|
|
250
|
+
"geojson.object": (recognition): PointQueryReading => {
|
|
251
|
+
const { type, latitude, longitude } = payloadOf(recognition)
|
|
252
|
+
|
|
253
|
+
if (type === "Point" && latitude != null && longitude != null) {
|
|
254
|
+
return { kind: "geojson_point", recognized: recognition.kind, latitude, longitude }
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
return noPosition(recognition)
|
|
258
|
+
},
|
|
259
|
+
|
|
260
|
+
// A Census GEOID is a run of digits, and the state code is the only part the validator can check.
|
|
261
|
+
"census.geoid_block": noPosition,
|
|
262
|
+
"census.geoid_block_group": noPosition,
|
|
263
|
+
"census.geoid_county": noPosition,
|
|
264
|
+
"census.geoid_state": noPosition,
|
|
265
|
+
"census.geoid_tract": noPosition,
|
|
266
|
+
"gnis.reference": noPosition,
|
|
267
|
+
"gnis.summary_url": noPosition,
|
|
268
|
+
|
|
269
|
+
"geohash.prefixed": (recognition): PointReading => ({
|
|
270
|
+
kind: "geohash",
|
|
271
|
+
recognized: recognition.kind,
|
|
272
|
+
hash: payloadOf(recognition).hash.toLowerCase(),
|
|
273
|
+
}),
|
|
274
|
+
// A bare H3 cell is read as a point here: the map's copy menu writes one,
|
|
275
|
+
// and a search field that reads back what the map copied is the contract.
|
|
276
|
+
// `isDeterministicIdentifier` withholds a bare cell from an address parse,
|
|
277
|
+
// because 15 hexadecimal digits are also a count.
|
|
278
|
+
"h3.cell": h3Cell,
|
|
279
|
+
"h3.prefixed_cell": h3Cell,
|
|
280
|
+
"wof.reference": wofID,
|
|
281
|
+
"wof.spelunker_url": wofID,
|
|
282
|
+
} satisfies HandlerMap<typeof families> & Record<PointQueryKind, (recognition: never) => PointQueryReading>
|
|
283
|
+
|
|
284
|
+
/**
|
|
285
|
+
* Reads a trimmed text as a point, or as a recognized shape that isn't a point query.
|
|
286
|
+
*
|
|
287
|
+
* Returns `null` when no recognition of the three families is validated and covers the whole text.
|
|
288
|
+
* Every address is such a text.
|
|
289
|
+
*
|
|
290
|
+
* A coordinate out of range in both axis orders is a rejected recognition,
|
|
291
|
+
* so it reads as `null`, never clamped.
|
|
292
|
+
*
|
|
293
|
+
* @param text The text the caller already trimmed, because the grammars admit no outer white space.
|
|
294
|
+
*/
|
|
295
|
+
export function recognizePointQuery(text: string): PointQueryReading | null {
|
|
296
|
+
let notAPoint: NotAPointQuery | null = null
|
|
297
|
+
|
|
298
|
+
for (const recognition of recognizer.recognize(text).recognitions) {
|
|
299
|
+
if (recognition.validation.status !== "validated" || recognition.start !== 0 || recognition.end !== text.length) {
|
|
300
|
+
continue
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
const handler = handlers[recognition.kind] as (recognition: RecognitionsOf<typeof families>) => PointQueryReading
|
|
304
|
+
const reading = handler(recognition)
|
|
305
|
+
|
|
306
|
+
// Two shapes may cover one text, such as a Census GEOID and an H3 cell.
|
|
307
|
+
// The point wins.
|
|
308
|
+
if (reading.kind !== "not_a_point") return reading
|
|
309
|
+
|
|
310
|
+
notAPoint ??= reading
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
return notAPoint
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
/**
|
|
317
|
+
* Reads a trimmed text as a point, or `null` when it is an address or a recognized shape with no position.
|
|
318
|
+
*/
|
|
319
|
+
export function pointFromText(text: string): PointReading | null {
|
|
320
|
+
const reading = recognizePointQuery(text)
|
|
321
|
+
|
|
322
|
+
return reading && reading.kind !== "not_a_point" ? reading : null
|
|
323
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: Teffen Ellis and Mailwoman contributors
|
|
2
|
+
// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Commercial
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* @file The text that writes and labels a point query, apart from the reader.
|
|
6
|
+
*
|
|
7
|
+
* The reader in `reading.ts` imports the recognition engine and three artifacts.
|
|
8
|
+
* A page that only writes a coordinate pair or labels a kind in a sentence imports this module.
|
|
9
|
+
* This module holds none of the engine, because its one import is a type and the build erases it.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
import type { PointQueryKind } from "#point/reading"
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* A coordinate pair as text, latitude first, in the form `pointFromText` reads back.
|
|
16
|
+
*
|
|
17
|
+
* Six decimals place a point within about 11 cm.
|
|
18
|
+
*/
|
|
19
|
+
export function coordinatePairText(lat: number, lon: number, decimals = 6): string {
|
|
20
|
+
return `${lat.toFixed(decimals)}, ${lon.toFixed(decimals)}`
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Labels a recognized shape in a result panel and in a sentence.
|
|
25
|
+
*/
|
|
26
|
+
export interface PointQueryDescription {
|
|
27
|
+
/**
|
|
28
|
+
* The name a result is shown under, such as the tag column of a parse.
|
|
29
|
+
*/
|
|
30
|
+
readonly label: string
|
|
31
|
+
/**
|
|
32
|
+
* The same name as a noun phrase with its article: "this is a plus code".
|
|
33
|
+
*/
|
|
34
|
+
readonly phrase: string
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const COORDINATE_PAIR = { label: "coordinates", phrase: "a coordinate pair" } as const
|
|
38
|
+
const CENSUS_GEOID = { label: "Census GEOID", phrase: "a Census GEOID" } as const
|
|
39
|
+
const GNIS_ID = { label: "GNIS id", phrase: "a GNIS feature id" } as const
|
|
40
|
+
const H3_CELL = { label: "H3 cell", phrase: "an H3 cell" } as const
|
|
41
|
+
const WOF_ID = { label: "Who's On First id", phrase: "a Who's On First id" } as const
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* The description of every kind, so a new kind in any composed family fails the build until it has one.
|
|
45
|
+
*/
|
|
46
|
+
export const POINT_QUERY_DESCRIPTIONS = {
|
|
47
|
+
"coordinate.decimal_pair": COORDINATE_PAIR,
|
|
48
|
+
"coordinate.decimal_pair_spaced": COORDINATE_PAIR,
|
|
49
|
+
"coordinate.dms_pair": COORDINATE_PAIR,
|
|
50
|
+
"coordinate.dms_pair_spaced": COORDINATE_PAIR,
|
|
51
|
+
"coordinate.geo_uri": COORDINATE_PAIR,
|
|
52
|
+
"coordinate.labeled_pair": COORDINATE_PAIR,
|
|
53
|
+
"coordinate.maps_segment": COORDINATE_PAIR,
|
|
54
|
+
"plus_code.token": { label: "plus code", phrase: "a plus code" },
|
|
55
|
+
"digipin.compact": { label: "DIGIPIN", phrase: "a DIGIPIN" },
|
|
56
|
+
"digipin.display": { label: "DIGIPIN", phrase: "a DIGIPIN" },
|
|
57
|
+
"geojson.object": { label: "GeoJSON", phrase: "a GeoJSON object" },
|
|
58
|
+
"census.geoid_block": CENSUS_GEOID,
|
|
59
|
+
"census.geoid_block_group": CENSUS_GEOID,
|
|
60
|
+
"census.geoid_county": CENSUS_GEOID,
|
|
61
|
+
"census.geoid_state": CENSUS_GEOID,
|
|
62
|
+
"census.geoid_tract": CENSUS_GEOID,
|
|
63
|
+
"geohash.prefixed": { label: "geohash", phrase: "a geohash" },
|
|
64
|
+
"gnis.reference": GNIS_ID,
|
|
65
|
+
"gnis.summary_url": GNIS_ID,
|
|
66
|
+
"h3.cell": H3_CELL,
|
|
67
|
+
"h3.prefixed_cell": H3_CELL,
|
|
68
|
+
"wof.reference": WOF_ID,
|
|
69
|
+
"wof.spelunker_url": WOF_ID,
|
|
70
|
+
} satisfies Readonly<Record<PointQueryKind, PointQueryDescription>>
|
package/lib/polyline.ts
CHANGED
|
@@ -1,15 +1,14 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: Teffen Ellis and Mailwoman contributors
|
|
2
|
+
// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Commercial
|
|
3
|
+
|
|
1
4
|
/**
|
|
2
|
-
* @copyright Sister Software
|
|
3
|
-
* @license AGPL-3.0
|
|
4
|
-
* @author Teffen Ellis, et al.
|
|
5
|
-
*
|
|
6
5
|
* Position along a polyline, by arc length.
|
|
7
6
|
*
|
|
8
|
-
* This is what house-number interpolation stands on: given a street segment's geometry
|
|
9
|
-
* along its house-number range an address sits, it answers where that
|
|
10
|
-
* reader (`resolver-wof-sqlite/interpolation.ts`) and the browser twin
|
|
11
|
-
* (`resolver-wof-wasm/httpvfs/street.ts`) both call it: the geometry never
|
|
12
|
-
* only the I/O around it does.
|
|
7
|
+
* This is what house-number interpolation stands on: given a street segment's geometry
|
|
8
|
+
* and how far along its house-number range an address sits, it answers where that's on the ground.
|
|
9
|
+
* The node reader (`resolver-wof-sqlite/interpolation.ts`) and the browser twin
|
|
10
|
+
* (`resolver-wof-wasm/httpvfs/street.ts`) both call it: the geometry never
|
|
11
|
+
* differs between them, only the I/O around it does.
|
|
13
12
|
*/
|
|
14
13
|
|
|
15
14
|
import { centralAngle, EARTH_RADII } from "#distance"
|
|
@@ -18,7 +17,7 @@ import { centralAngle, EARTH_RADII } from "#distance"
|
|
|
18
17
|
* Clamp a fraction into `[0, 1]`.
|
|
19
18
|
*
|
|
20
19
|
* NaN passes through deliberately.
|
|
21
|
-
* An interpolation whose inputs
|
|
20
|
+
* An interpolation whose inputs weren't numbers should produce NaN coordinates a
|
|
22
21
|
* caller can detect rather than silently snap to a segment's start.
|
|
23
22
|
*/
|
|
24
23
|
export function clampFraction(t: number): number {
|
package/lib/position.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: Teffen Ellis and Mailwoman contributors
|
|
2
|
+
// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Commercial
|
|
3
|
+
|
|
1
4
|
/**
|
|
2
|
-
* @copyright Sister Software.
|
|
3
|
-
* @license AGPL-3.0
|
|
4
|
-
* @author Teffen Ellis, et al.
|
|
5
|
-
*
|
|
6
5
|
* This file contains types and utilities for working with geographic positions.
|
|
7
6
|
*/
|
|
8
7
|
|
|
9
|
-
|
|
8
|
+
/// <reference types="google.maps" />
|
|
9
|
+
|
|
10
10
|
import type { PlanarPoint } from "@mailwoman/annotations"
|
|
11
11
|
|
|
12
12
|
import { isValidLatitude, isValidLongitude } from "#coordinate/bounds"
|
|
@@ -180,13 +180,14 @@ export function isCoordPairLiteral(input: unknown): input is [number, number] |
|
|
|
180
180
|
}
|
|
181
181
|
|
|
182
182
|
/**
|
|
183
|
-
* Type-predicate to determine if the given input is a
|
|
183
|
+
* Type-predicate to determine if the given input is a
|
|
184
|
+
* {@linkcode google.maps.LatLngLiteral | LatLngLiteral} object.
|
|
184
185
|
*
|
|
185
186
|
* @category Position
|
|
186
187
|
* @category Type Predicates
|
|
187
188
|
* @see {@link https://developers.google.com/maps/documentation/javascript/reference/coordinates#LatLngLiteral Google Maps API Documentation}
|
|
188
189
|
*/
|
|
189
|
-
export function isGoogleMapsLatLngLiteral(input: unknown): input is LatLngLiteral {
|
|
190
|
+
export function isGoogleMapsLatLngLiteral(input: unknown): input is google.maps.LatLngLiteral {
|
|
190
191
|
if (!input || typeof input !== "object") return false
|
|
191
192
|
|
|
192
193
|
if (!Object.hasOwn(input, "lat") || !Object.hasOwn(input, "lng")) return false
|
|
@@ -1,32 +1,47 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: Teffen Ellis and Mailwoman contributors
|
|
2
|
+
// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Commercial
|
|
3
|
+
|
|
1
4
|
import { runFile } from "@mailwoman/core/process"
|
|
2
5
|
import { TextSpliterator } from "spliterator"
|
|
3
6
|
|
|
4
7
|
/**
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
+
* Ask PROJ which datum transformation it would choose.
|
|
9
|
+
* Refuse a ballpark operation.
|
|
10
|
+
*
|
|
11
|
+
* PROJ silently substitutes a ballpark datum shift when the accurate grid is absent.
|
|
12
|
+
* On the EA flood product, `ogr2ogr` placed the first feature's first vertex at
|
|
13
|
+
* `1.698151293, 52.648130027` without the OSGB36→WGS84 grid.
|
|
14
|
+
*
|
|
15
|
+
* With `uk_os_OSTN15_NTv2_OSGBtoETRS.tif` present, it placed the vertex at
|
|
16
|
+
* `1.698174628, 52.648157259`, a distance of 3.4 m.
|
|
17
|
+
* Both coordinates look like ordinary WGS84 values and pass a bounding-box check.
|
|
8
18
|
*
|
|
9
|
-
*
|
|
19
|
+
* The layer is offset.
|
|
20
|
+
* The check found eight disagreements among 59 points against the authority's OGC service.
|
|
21
|
+
* Each point fell into a neighboring sliver.
|
|
10
22
|
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
* With `uk_os_OSTN15_NTv2_OSGBtoETRS.tif` present, it placed the vertex at `1.698174628, 52.648157259`, a distance
|
|
14
|
-
* of 3.4 m. Both coordinates look like ordinary WGS84 values and pass a bounding-box check. The layer is offset.
|
|
15
|
-
* The check found eight disagreements among 59 points against the authority's OGC service. Each point fell into a
|
|
16
|
-
* neighboring sliver.
|
|
23
|
+
* GDAL 3.8 doesn't pass `--config PROJ_NETWORK on` through to PROJ.
|
|
24
|
+
* Tests also showed that `PROJ_ONLY_BEST=on` doesn't refuse a ballpark shift.
|
|
17
25
|
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
26
|
+
* `projinfo` provides the usable check.
|
|
27
|
+
* Its output identifies the best candidate operation and reports a missing grid.
|
|
28
|
+
*
|
|
29
|
+
* The check runs even when a source needs no transformation.
|
|
30
|
+
* A source already in EPSG:4326 returns `Null geographic offset from WGS 84 to WGS 84, 0 m, World.`
|
|
31
|
+
*
|
|
32
|
+
* This operation is usable.
|
|
33
|
+
* The check costs one process.
|
|
21
34
|
*
|
|
22
|
-
* The check runs even when a source needs no transformation. A source already in EPSG:4326 returns
|
|
23
|
-
* `Null geographic offset from WGS 84 to WGS 84, 0 m, World.` This operation is usable. The check costs one process.
|
|
24
35
|
* A skipped case would leave a later source's required grid unchecked.
|
|
25
36
|
*
|
|
26
|
-
* Every vector ingest shares this check because the failure comes from PROJ
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
37
|
+
* Every vector ingest shares this check because the failure comes from PROJ
|
|
38
|
+
* rather than from a particular product.
|
|
39
|
+
* Output parsing is separate from process execution so tests can use captured output.
|
|
40
|
+
*
|
|
41
|
+
* The two output states came from the same command on the same machine before
|
|
42
|
+
* and after grid installation.
|
|
43
|
+
* One produced a meter-accurate layer.
|
|
44
|
+
* The other produced a 3 m offset.
|
|
30
45
|
*/
|
|
31
46
|
|
|
32
47
|
/**
|
|
@@ -87,8 +102,8 @@ export interface AssertDatumTransformationOptions {
|
|
|
87
102
|
/**
|
|
88
103
|
* Refuse an ingest whose best available datum transformation is a ballpark one, or is missing its grid.
|
|
89
104
|
*
|
|
90
|
-
* @throws {Error} When proj
|
|
91
|
-
* or would use an operation whose grid
|
|
105
|
+
* @throws {Error} When proj identifies no candidate, would use a ballpark offset,
|
|
106
|
+
* or would use an operation whose grid isn't installed.
|
|
92
107
|
*/
|
|
93
108
|
export async function assertDatumTransformationAvailable(
|
|
94
109
|
sourceEPSG: number,
|
package/lib/projection.ts
CHANGED
|
@@ -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
|
/**
|
|
8
5
|
* A coordinate system used to represent the Earth's surface.
|
package/lib/regions/codes.ts
CHANGED
|
@@ -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
|
import type { RegionName } from "#regions/names"
|
|
8
5
|
|
package/lib/regions/names.ts
CHANGED
|
@@ -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
|
/**
|
|
8
5
|
* A list of geographic regions, i.e. continents.
|
package/lib/regions.ts
CHANGED
|
@@ -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
|
export * from "#regions/codes"
|
|
8
5
|
export * from "#regions/names"
|
package/lib/well-known-text.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: Teffen Ellis and Mailwoman contributors
|
|
2
|
+
// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Commercial
|
|
3
|
+
|
|
1
4
|
/**
|
|
2
|
-
* @copyright Sister Software.
|
|
3
|
-
* @license AGPL-3.0
|
|
4
|
-
* @author Teffen Ellis, et al.
|
|
5
|
-
*
|
|
6
5
|
* Provides functions for parsing and converting extended Well-Known text and binary data.
|
|
7
6
|
*/
|
|
8
7
|
|
package/out/bbox.d.ts
CHANGED
package/out/bbox.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bbox.d.ts","sourceRoot":"","sources":["../lib/bbox.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"bbox.d.ts","sourceRoot":"","sources":["../lib/bbox.ts"],"names":[],"mappings":"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"}
|
package/out/bbox.js
CHANGED
|
@@ -1,8 +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
|
-
*
|
|
6
4
|
* GeoJSON Bounding Boxes
|
|
7
5
|
*/
|
|
8
6
|
import { toRad } from "#coordinate/formats";
|