@mailwoman/spatial 11.1.0 → 11.3.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/digipin.ts +282 -0
- package/lib/geometries/point/coordinates.ts +1 -1
- package/lib/geometries/point.ts +1 -1
- package/lib/geometries/ring-blob.ts +1 -1
- package/lib/geometries.ts +1 -1
- package/lib/h3/interior-cells.ts +5 -3
- package/lib/h3/polygon-cells.ts +4 -4
- package/lib/index.ts +2 -1
- package/lib/open-location-code.ts +45 -30
- package/lib/point/reading.ts +323 -0
- package/lib/point/text.ts +70 -0
- package/lib/polyline.ts +8 -6
- package/lib/position.ts +1 -1
- package/lib/projection/transform.ts +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/geometries/point/coordinates.js +1 -1
- package/out/geometries/point/coordinates.js.map +1 -1
- package/out/geometries/point.js +1 -1
- package/out/geometries/point.js.map +1 -1
- package/out/geometries/ring-blob.d.ts +1 -1
- package/out/geometries.d.ts +1 -1
- package/out/geometries.js +1 -1
- package/out/h3/interior-cells.d.ts.map +1 -1
- package/out/h3/interior-cells.js +5 -3
- package/out/h3/interior-cells.js.map +1 -1
- package/out/h3/polygon-cells.d.ts +3 -2
- package/out/h3/polygon-cells.d.ts.map +1 -1
- package/out/h3/polygon-cells.js +4 -4
- package/out/h3/polygon-cells.js.map +1 -1
- package/out/index.d.ts +2 -1
- package/out/index.d.ts.map +1 -1
- package/out/index.js +2 -1
- package/out/index.js.map +1 -1
- package/out/open-location-code.d.ts +24 -16
- package/out/open-location-code.d.ts.map +1 -1
- package/out/open-location-code.js +27 -27
- package/out/open-location-code.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.map +1 -1
- package/out/polyline.js +8 -6
- package/out/polyline.js.map +1 -1
- package/out/position.d.ts +1 -1
- package/out/projection/transform.js +1 -1
- package/out/projection/transform.js.map +1 -1
- package/out/tools/ogr/stream.js +2 -2
- package/out/tools/ogr/stream.js.map +1 -1
- package/out/tools/ogr.js +3 -3
- package/out/tools/ogr.js.map +1 -1
- package/out/tools/tsconfig.tsbuildinfo +1 -1
- package/out/tsconfig.test.tsbuildinfo +1 -1
- package/package.json +6 -5
- package/tools/ogr/stream.ts +2 -2
- package/tools/ogr.ts +3 -3
- package/lib/point-query.ts +0 -294
- package/out/point-query.d.ts +0 -71
- package/out/point-query.d.ts.map +0 -1
- package/out/point-query.js +0 -194
- package/out/point-query.js.map +0 -1
package/out/digipin.js
ADDED
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: Teffen Ellis and Mailwoman contributors
|
|
2
|
+
// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Commercial
|
|
3
|
+
/**
|
|
4
|
+
* @file DIGIPIN geographic encoding and decoding.
|
|
5
|
+
*
|
|
6
|
+
* Developed by India Post, Department of Posts.
|
|
7
|
+
*
|
|
8
|
+
* DIGIPIN uses a hierarchical 4×4 grid covering:
|
|
9
|
+
*
|
|
10
|
+
* - Latitude: 2.5° to 38.5°
|
|
11
|
+
* - Longitude: 63.5° to 99.5°
|
|
12
|
+
*
|
|
13
|
+
* Each character represents four bits of spatial information:
|
|
14
|
+
* two latitude bits and two longitude bits.
|
|
15
|
+
*
|
|
16
|
+
* A complete 10-character DIGIPIN represents 40 bits,
|
|
17
|
+
* providing 20-bit resolution along each axis.
|
|
18
|
+
*
|
|
19
|
+
* @see {@link https://en.wikipedia.org/wiki/National_Level_Addressing_Grid | National Level Addressing Grid}
|
|
20
|
+
*/
|
|
21
|
+
//#region Constants and Lookup Tables
|
|
22
|
+
/**
|
|
23
|
+
* DIGIPIN character alphabet, flattened in row-major order from the official 4×4 character grid.
|
|
24
|
+
*
|
|
25
|
+
* Rows are ordered north to south.
|
|
26
|
+
* Columns are ordered west to east.
|
|
27
|
+
*/
|
|
28
|
+
const ALPHABET = "FC98J327K456LMPT";
|
|
29
|
+
/**
|
|
30
|
+
* Southern boundary of the DIGIPIN coverage area, in degrees.
|
|
31
|
+
*/
|
|
32
|
+
const MIN_LAT = 2.5;
|
|
33
|
+
/**
|
|
34
|
+
* Northern boundary of the DIGIPIN coverage area, in degrees.
|
|
35
|
+
*/
|
|
36
|
+
const MAX_LAT = 38.5;
|
|
37
|
+
/**
|
|
38
|
+
* Western boundary of the DIGIPIN coverage area, in degrees.
|
|
39
|
+
*/
|
|
40
|
+
const MIN_LON = 63.5;
|
|
41
|
+
/**
|
|
42
|
+
* Eastern boundary of the DIGIPIN coverage area, in degrees.
|
|
43
|
+
*/
|
|
44
|
+
const MAX_LON = 99.5;
|
|
45
|
+
/**
|
|
46
|
+
* Geographic extent of each DIGIPIN axis, in degrees.
|
|
47
|
+
*/
|
|
48
|
+
const SPAN = 36;
|
|
49
|
+
/**
|
|
50
|
+
* Number of characters in a complete DIGIPIN.
|
|
51
|
+
*
|
|
52
|
+
* Each character contributes two bits per coordinate axis.
|
|
53
|
+
*/
|
|
54
|
+
const PRECISION = 10;
|
|
55
|
+
/**
|
|
56
|
+
* Number of subdivisions along each coordinate axis.
|
|
57
|
+
*
|
|
58
|
+
* Ten levels of four-way subdivision produce 4^10 cells along each axis, equivalent to 20 bits.
|
|
59
|
+
*/
|
|
60
|
+
const RESOLUTION = 1 << 20;
|
|
61
|
+
/**
|
|
62
|
+
* Maximum zero-based cell index along either axis.
|
|
63
|
+
*/
|
|
64
|
+
const MAX_INDEX = RESOLUTION - 1;
|
|
65
|
+
/**
|
|
66
|
+
* Conversion factor from geographic degrees to cell indices.
|
|
67
|
+
*/
|
|
68
|
+
const SCALE = RESOLUTION / SPAN;
|
|
69
|
+
/**
|
|
70
|
+
* Geographic width or height of one DIGIPIN cell, in degrees.
|
|
71
|
+
*
|
|
72
|
+
* It is the span of the cell whose center a decoded position is.
|
|
73
|
+
*/
|
|
74
|
+
export const DIGIPIN_CELL_DEGREES = SPAN / RESOLUTION;
|
|
75
|
+
/**
|
|
76
|
+
* ASCII character-to-grid-index lookup table.
|
|
77
|
+
*
|
|
78
|
+
* Each uppercase DIGIPIN character maps to its zero-based position in the flattened character grid.
|
|
79
|
+
* The decoders read only validated codes, so no other character reaches the table.
|
|
80
|
+
*
|
|
81
|
+
* Initialized once at module evaluation.
|
|
82
|
+
* It doesn't cache encoding or decoding results.
|
|
83
|
+
*/
|
|
84
|
+
const DECODE = buildDecodeTable();
|
|
85
|
+
/**
|
|
86
|
+
* Build the ASCII character-to-grid-index lookup table from {@link ALPHABET}.
|
|
87
|
+
*/
|
|
88
|
+
function buildDecodeTable() {
|
|
89
|
+
const table = new Uint8Array(128);
|
|
90
|
+
for (let i = 0; i < ALPHABET.length; i++) {
|
|
91
|
+
table[ALPHABET.charCodeAt(i)] = i;
|
|
92
|
+
}
|
|
93
|
+
return table;
|
|
94
|
+
}
|
|
95
|
+
// #endregion
|
|
96
|
+
// #region Public Functions
|
|
97
|
+
/**
|
|
98
|
+
* Validate geographic coordinates against DIGIPIN coverage bounds.
|
|
99
|
+
*
|
|
100
|
+
* Both coordinates must be finite numbers within the supported geographic region, including its boundaries.
|
|
101
|
+
*
|
|
102
|
+
* @param latitude - Latitude in WGS 84 degrees.
|
|
103
|
+
* @param longitude - Longitude in WGS 84 degrees.
|
|
104
|
+
*
|
|
105
|
+
* @throws {RangeError} If latitude or longitude is outside DIGIPIN bounds.
|
|
106
|
+
*/
|
|
107
|
+
export function validateDIGIPINCoordinates(latitude, longitude) {
|
|
108
|
+
if (!Number.isFinite(latitude) || latitude < MIN_LAT || latitude > MAX_LAT) {
|
|
109
|
+
throw new RangeError("Latitude out of range");
|
|
110
|
+
}
|
|
111
|
+
if (!Number.isFinite(longitude) || longitude < MIN_LON || longitude > MAX_LON) {
|
|
112
|
+
throw new RangeError("Longitude out of range");
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Encode geographic coordinates into a 10-character DIGIPIN.
|
|
117
|
+
*
|
|
118
|
+
* Coordinates are quantized into 20-bit integer cell indices.
|
|
119
|
+
* Each iteration extracts two bits from each coordinate and combines them into
|
|
120
|
+
* an index into the DIGIPIN alphabet.
|
|
121
|
+
*
|
|
122
|
+
* @param latitude - Latitude in WGS 84 degrees.
|
|
123
|
+
* @param longitude - Longitude in WGS 84 degrees.
|
|
124
|
+
* @returns Uppercase 10-character DIGIPIN.
|
|
125
|
+
*
|
|
126
|
+
* @throws {RangeError} If coordinates are outside DIGIPIN bounds.
|
|
127
|
+
*
|
|
128
|
+
* @example
|
|
129
|
+
* const pin = getDIGIPIN(13.11179621, 80.20264269)
|
|
130
|
+
*/
|
|
131
|
+
export function getDIGIPIN(latitude, longitude) {
|
|
132
|
+
validateDIGIPINCoordinates(latitude, longitude);
|
|
133
|
+
// The bounds are checked, so the code is ten characters of the alphabet.
|
|
134
|
+
return getDIGIPINUnsafe(latitude, longitude);
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Encode geographic coordinates without validating their bounds.
|
|
138
|
+
*
|
|
139
|
+
* Intended for performance-sensitive batch processing where coordinates have already been validated.
|
|
140
|
+
*
|
|
141
|
+
* Coordinates are quantized into 20-bit indices and encoded using bitwise operations.
|
|
142
|
+
*
|
|
143
|
+
* @param latitude - Latitude in WGS 84 degrees.
|
|
144
|
+
* @param longitude - Longitude in WGS 84 degrees.
|
|
145
|
+
* @returns Uppercase 10-character DIGIPIN.
|
|
146
|
+
*
|
|
147
|
+
* @remarks Inputs must be finite and inside DIGIPIN coverage bounds.
|
|
148
|
+
* Out-of-range inputs produce unspecified results.
|
|
149
|
+
*/
|
|
150
|
+
export function getDIGIPINUnsafe(latitude, longitude) {
|
|
151
|
+
/**
|
|
152
|
+
* Quantized latitude cell index.
|
|
153
|
+
*/
|
|
154
|
+
const lat = Math.min(MAX_INDEX, Math.floor((latitude - MIN_LAT) * SCALE));
|
|
155
|
+
/**
|
|
156
|
+
* Quantized longitude cell index.
|
|
157
|
+
*/
|
|
158
|
+
const lon = Math.min(MAX_INDEX, Math.floor((longitude - MIN_LON) * SCALE));
|
|
159
|
+
/**
|
|
160
|
+
* Encoded DIGIPIN string.
|
|
161
|
+
*/
|
|
162
|
+
let pin = "";
|
|
163
|
+
/**
|
|
164
|
+
* Extract two bits per axis, beginning with the highest-order bits.
|
|
165
|
+
*/
|
|
166
|
+
for (let shift = 18; shift >= 0; shift -= 2) {
|
|
167
|
+
const row = 3 - ((lat >>> shift) & 3);
|
|
168
|
+
const col = (lon >>> shift) & 3;
|
|
169
|
+
pin += ALPHABET[(row << 2) | col];
|
|
170
|
+
}
|
|
171
|
+
return pin;
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* Decode a DIGIPIN into the center coordinates of its cell.
|
|
175
|
+
*
|
|
176
|
+
* Returns a GeoJSON-compatible position in longitude-first order.
|
|
177
|
+
* Coordinates retain floating-point precision without decimal rounding.
|
|
178
|
+
*
|
|
179
|
+
* The parameter is the validated code of the `spatial` family of `@mailwoman/recognizer`:
|
|
180
|
+
* ten upper-case characters without hyphens.
|
|
181
|
+
* The validator accepts lower case and the display form `39J-49L-L8T4`
|
|
182
|
+
* and normalizes both, so this decoder skips every check.
|
|
183
|
+
*
|
|
184
|
+
* A caller that holds a string reads it through the recognizer.
|
|
185
|
+
*
|
|
186
|
+
* @param pin - Validated DIGIPIN.
|
|
187
|
+
* @returns Cell center as [longitude, latitude].
|
|
188
|
+
*
|
|
189
|
+
* @example
|
|
190
|
+
* const [longitude, latitude] = getLatLngFromDIGIPIN(getDIGIPIN(13.11179621, 80.20264269))
|
|
191
|
+
*/
|
|
192
|
+
export function getLatLngFromDIGIPIN(pin) {
|
|
193
|
+
/**
|
|
194
|
+
* Result position in GeoJSON coordinate order.
|
|
195
|
+
*/
|
|
196
|
+
const position = [0, 0];
|
|
197
|
+
getLatLngFromDIGIPINInto(pin, position);
|
|
198
|
+
return position;
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* Decode a DIGIPIN directly into an existing coordinate buffer.
|
|
202
|
+
*
|
|
203
|
+
* Avoids allocating intermediate coordinate tuples.
|
|
204
|
+
*
|
|
205
|
+
* The destination receives longitude followed by latitude.
|
|
206
|
+
* Supports both ordinary JavaScript arrays and Float64Array buffers.
|
|
207
|
+
*
|
|
208
|
+
* @param pin - Validated DIGIPIN, ten upper-case characters.
|
|
209
|
+
* @param output - Destination coordinate buffer.
|
|
210
|
+
* @param offset - Starting element offset.
|
|
211
|
+
* Defaults to zero.
|
|
212
|
+
*
|
|
213
|
+
* @example
|
|
214
|
+
* const pins = [getDIGIPIN(13.11179621, 80.20264269), getDIGIPIN(28.6139, 77.209)]
|
|
215
|
+
* const output = new Float64Array(pins.length * 2)
|
|
216
|
+
*
|
|
217
|
+
* for (let i = 0; i < pins.length; i++) {
|
|
218
|
+
* getLatLngFromDIGIPINInto(pins[i]!, output, i * 2)
|
|
219
|
+
* }
|
|
220
|
+
*/
|
|
221
|
+
export function getLatLngFromDIGIPINInto(pin, output, offset = 0) {
|
|
222
|
+
/**
|
|
223
|
+
* Accumulated 20-bit latitude cell index.
|
|
224
|
+
*/
|
|
225
|
+
let lat = 0;
|
|
226
|
+
/**
|
|
227
|
+
* Accumulated 20-bit longitude cell index.
|
|
228
|
+
*/
|
|
229
|
+
let lon = 0;
|
|
230
|
+
for (let i = 0; i < PRECISION; i++) {
|
|
231
|
+
/**
|
|
232
|
+
* Flattened DIGIPIN grid position.
|
|
233
|
+
*/
|
|
234
|
+
const index = DECODE[pin.charCodeAt(i)];
|
|
235
|
+
lat = (lat << 2) | (3 - (index >>> 2));
|
|
236
|
+
lon = (lon << 2) | (index & 3);
|
|
237
|
+
}
|
|
238
|
+
output[offset] = MIN_LON + (lon + 0.5) * DIGIPIN_CELL_DEGREES;
|
|
239
|
+
output[offset + 1] = MIN_LAT + (lat + 0.5) * DIGIPIN_CELL_DEGREES;
|
|
240
|
+
}
|
|
241
|
+
// #endregion
|
|
242
|
+
//# sourceMappingURL=digipin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"digipin.js","sourceRoot":"","sources":["../lib/digipin.ts"],"names":[],"mappings":"AAAA,kEAAkE;AAClE,kEAAkE;AAMlE;;;;;;;;;;;;;;;;;GAiBG;AAEH,qCAAqC;AAErC;;;;;GAKG;AACH,MAAM,QAAQ,GAAG,kBAAkB,CAAA;AAEnC;;GAEG;AACH,MAAM,OAAO,GAAG,GAAG,CAAA;AAEnB;;GAEG;AACH,MAAM,OAAO,GAAG,IAAI,CAAA;AAEpB;;GAEG;AACH,MAAM,OAAO,GAAG,IAAI,CAAA;AAEpB;;GAEG;AACH,MAAM,OAAO,GAAG,IAAI,CAAA;AAEpB;;GAEG;AACH,MAAM,IAAI,GAAG,EAAE,CAAA;AAEf;;;;GAIG;AACH,MAAM,SAAS,GAAG,EAAE,CAAA;AAEpB;;;;GAIG;AACH,MAAM,UAAU,GAAG,CAAC,IAAI,EAAE,CAAA;AAE1B;;GAEG;AACH,MAAM,SAAS,GAAG,UAAU,GAAG,CAAC,CAAA;AAEhC;;GAEG;AACH,MAAM,KAAK,GAAG,UAAU,GAAG,IAAI,CAAA;AAE/B;;;;GAIG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,IAAI,GAAG,UAAU,CAAA;AAErD;;;;;;;;GAQG;AACH,MAAM,MAAM,GAAG,gBAAgB,EAAE,CAAA;AAEjC;;GAEG;AACH,SAAS,gBAAgB;IACxB,MAAM,KAAK,GAAG,IAAI,UAAU,CAAC,GAAG,CAAC,CAAA;IAEjC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,QAAQ,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QAC1C,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CAAC,KAAK,GAAG,CAAC,CAAC,CAAA;IAC/B,CAAC;IAED,MAAM,CAAC,MAAM,CAAC,GAAG,OAAO,GAAG,CAAC,GAAG,GAAG,GAAG,CAAC,GAAG,oBAAoB,CAAA;IAC7D,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,GAAG,OAAO,GAAG,CAAC,GAAG,GAAG,GAAG,CAAC,GAAG,oBAAoB,CAAA;AAClE,CAAC;AACD,aAAa"}
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* the coordinates of a `GeoPointInput` mustn't load its embedded WebAssembly binary.
|
|
8
8
|
*/
|
|
9
9
|
/// <reference types="google.maps" />
|
|
10
|
-
import { tryParsingJSON } from "@mailwoman/core/json";
|
|
10
|
+
import { tryParsingJSON } from "@mailwoman/core/values/json";
|
|
11
11
|
import { isValidLatitude, isValidLongitude } from "#coordinate/bounds";
|
|
12
12
|
import { GeometryType } from "#objects";
|
|
13
13
|
import { isCoordPairLiteral, isGoogleMapsLatLngLiteral, isInterpolatedCoordinates, } from "#position";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"coordinates.js","sourceRoot":"","sources":["../../../lib/geometries/point/coordinates.ts"],"names":[],"mappings":"AAAA,kEAAkE;AAClE,kEAAkE;AAElE;;;;;GAKG;AAEH,qCAAqC;AAErC,OAAO,EAAE,cAAc,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"coordinates.js","sourceRoot":"","sources":["../../../lib/geometries/point/coordinates.ts"],"names":[],"mappings":"AAAA,kEAAkE;AAClE,kEAAkE;AAElE;;;;;GAKG;AAEH,qCAAqC;AAErC,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAA;AAE5D,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AACtE,OAAO,EAAyB,YAAY,EAAE,MAAM,UAAU,CAAA;AAC9D,OAAO,EAIN,kBAAkB,EAClB,yBAAyB,EACzB,yBAAyB,GACzB,MA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,EAAE,KAAK,CAAC,QAAQ,IAAI,CAAC,CAAC,CAAA;IAEtG,IAAI,yBAAyB,CAAC,KAAK,CAAC;QAAE,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,CAAA;IAE/D,OAAO,IAAI,CAAA;AACZ,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,oBAAoB,CAAC,KAAc;IAClD,IAAI,CAAC,KAAK;QAAE,OAAO,IAAI,CAAA;IAEvB,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC/B,KAAK,GAAG,cAAc,CAAgB,KAAK,CAAC,IAAI,cAAc,CAAgB,IAAI,KAAK,GAAG,CAAC,IAAI,KAAK,CAAA;IACrG,CAAC;IAED,MAAM,WAAW,GAAG,qBAAqB,CAAC,KAAK,CAAC,CAAA;IAEhD,IAAI,CAAC,WAAW;QAAE,OAAO,IAAI,CAAA;IAE7B,MAAM,CAAC,SAAS,EAAE,QAAQ,CAAC,GAAG,WAAW,CAAA;IAEzC,IAAI,CAAC,gBAAgB,CAAC,SAAS,CAAC,IAAI,CAAC,eAAe,CAAC,QAAQ,CAAC;QAAE,OAAO,IAAI,CAAA;IAE3E,IAAI,QAAQ,KAAK,CAAC,IAAI,SAAS,KAAK,CAAC;QAAE,OAAO,IAAI,CAAA;IAElD,OAAO,WAAW,CAAA;AACnB,CAAC"}
|
package/out/geometries/point.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// SPDX-FileCopyrightText: Teffen Ellis and Mailwoman contributors
|
|
2
2
|
// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Commercial
|
|
3
3
|
/// <reference types="google.maps" />
|
|
4
|
-
import { tryParsingJSON, stringifyJSON } from "@mailwoman/core/json";
|
|
4
|
+
import { tryParsingJSON, stringifyJSON } from "@mailwoman/core/values/json";
|
|
5
5
|
import { latLngToCell } from "@sister.software/h3";
|
|
6
6
|
import { convert as convertCoords } from "geo-coordinates-parser";
|
|
7
7
|
import { GeoBoundingBox, isBBox } from "#bbox";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"point.js","sourceRoot":"","sources":["../../lib/geometries/point.ts"],"names":[],"mappings":"AAAA,kEAAkE;AAClE,kEAAkE;AAElE,qCAAqC;AAErC,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"point.js","sourceRoot":"","sources":["../../lib/geometries/point.ts"],"names":[],"mappings":"AAAA,kEAAkE;AAClE,kEAAkE;AAElE,qCAAqC;AAErC,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAA;AAC3E,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAClD,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,wBAAwB,CAAA;AAEjE,OAAO,EAA0C,cAAc,EAAE,MAAM,EAAE,MAAM,OAAO,CAAA;AACtF,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AACtE,OAAO,EAIN,cAAc,EACd,qBAAqB,GACrB,MAAM,+BAA+B,CAAA;AACtC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AACxC,OAAO,EAAyB,YAAY,EAAE,MAAM,UAAU,CAAA;AAC9D,OAAO,EAIN,aAAa,EACb,aAAa,GACb,MAAM,WAAW,CAAA;AAElB,mBAAmB;AAEnB;;GAEG;AACH,MAAM,OAAO,QAAQ;IACpB,qBAAqB;IAErB;;OAEG;IACM,IAAI,GAAG,YAAY,CAAC,KAAK,CAAA;IAElC;;;;;OAKG;IACI,WAAW,GAA0B,IAAI,CAAA;IAEhD;;;;;;OAMG;IACH,IAAW,IAAI;QACd,OAAO,IAAI,CAAC,WAAW,EAAE,MAAM,EAAE,CAAA;IAClC,CAAC;IAED,IAAW,IAAI,CAAC,IAA+C;QAC9D,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,CAAC,CAAC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IAAI,GAAG,YAAY,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,UAAU,EAAE,UAAU,CAAC,CAAA;QAEtE,OAAO,IAAI,CAAA;IACZ,CAAC;IAED;;OAEG;IACI,aAAa,CAAC,UAAU,GAAG,EAAE;QACnC,MAAM,IAAI,GAAG,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAA;QAEtC,OAAO,aAAa,CAAC,IAAI,CAAC,CAAA;IAC3B,CAAC;IAEM,QAAQ;QACd,OAAO,aAAa,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,CAAA;IACpC,CAAC;IACD,aAAa;IAEN,CAAC,MAAM,CAAC,QAAQ,CAAC;QACvB,OAAO,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAA;IAC3C,CAAC;CACD"}
|
|
@@ -49,7 +49,7 @@ export declare function ringAreaReadings(polygons: MultiPolygonRings): {
|
|
|
49
49
|
*/
|
|
50
50
|
export declare function assertRingsInsideExtent(polygons: MultiPolygonRings, label: string, extent: LatLonBounds, marginDegrees: number, context?: string): void;
|
|
51
51
|
/**
|
|
52
|
-
* One stored polygon's bounding box and geometry, as
|
|
52
|
+
* One stored polygon's bounding box and geometry, as stored in each polygon layer's row.
|
|
53
53
|
*/
|
|
54
54
|
export interface EncodedArea {
|
|
55
55
|
min_lat: number;
|
package/out/geometries.d.ts
CHANGED
package/out/geometries.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// SPDX-FileCopyrightText: Teffen Ellis and Mailwoman contributors
|
|
2
2
|
// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Commercial
|
|
3
3
|
/**
|
|
4
|
-
* GeoJSON
|
|
4
|
+
* This module exports the GeoJSON geometry types and utilities.
|
|
5
5
|
*/
|
|
6
6
|
export * from "#geometries/collection";
|
|
7
7
|
export * from "#geometries/line-string";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interior-cells.d.ts","sourceRoot":"","sources":["../../lib/h3/interior-cells.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"interior-cells.d.ts","sourceRoot":"","sources":["../../lib/h3/interior-cells.ts"],"names":[],"mappings":"AAWA,OAAO,EAA4C,KAAK,MAAM,EAAE,MAAM,qBAAqB,CAAA;AAE3F,OAAO,EAAmC,KAAK,cAAc,EAAqB,MAAM,qBAAqB,CAAA;AAiB7G;;;GAGG;AACH,wBAAgB,YAAY,CAAC,QAAQ,EAAE,cAAc,GAAG;IACvD,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,EAAE,MAAM,CAAA;CACd,CA+BA;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,GAAG,MAAM,EAAE,CAa1F;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,GAAG,MAAM,EAAE,CAe5F;AAED;;;GAGG;AACH,wBAAgB,uBAAuB,CAAC,QAAQ,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC,CAEjG"}
|
package/out/h3/interior-cells.js
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
// SPDX-FileCopyrightText: Teffen Ellis and Mailwoman contributors
|
|
2
2
|
// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Commercial
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
5
|
-
*
|
|
4
|
+
* This module turns an outline into the H3 cell set used by a coverage claim.
|
|
5
|
+
*
|
|
6
|
+
* It admits a cell only when its whole `gridDisk(cell, 1)` and all six boundary
|
|
7
|
+
* vertices lie inside the outline.
|
|
6
8
|
*/
|
|
7
|
-
import { stringifyJSON } from "@mailwoman/core/json";
|
|
9
|
+
import { stringifyJSON } from "@mailwoman/core/values/json";
|
|
8
10
|
import { cellToBoundary, gridDisk, polygonToCells } from "@sister.software/h3";
|
|
9
11
|
import { arealPolygons, geometryContains } from "#geometries/polygon";
|
|
10
12
|
import { shortCellToInt } from "#h3/cell";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interior-cells.js","sourceRoot":"","sources":["../../lib/h3/interior-cells.ts"],"names":[],"mappings":"AAAA,kEAAkE;AAClE,kEAAkE;AAElE
|
|
1
|
+
{"version":3,"file":"interior-cells.js","sourceRoot":"","sources":["../../lib/h3/interior-cells.ts"],"names":[],"mappings":"AAAA,kEAAkE;AAClE,kEAAkE;AAElE;;;;;GAKG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAA;AAC3D,OAAO,EAAE,cAAc,EAAE,QAAQ,EAAE,cAAc,EAAe,MAAM,qBAAqB,CAAA;AAE3F,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAA0C,MAAM,qBAAqB,CAAA;AAC7G,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AAEzC;;;GAGG;AACH,SAAS,UAAU,CAAC,QAAwB;IAC3C,MAAM,QAAQ,GAAG,aAAa,CAAC,QAAQ,CAAC,CAAA;IAExC,IAAI,CAAC,QAAQ,EAAE,CAAC;QACf,MAAM,IAAI,KAAK,CAAC,qEAAqE,aAAa,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;IACrH,CAAC;IAED,OAAO,QAAQ,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,CAAC,CAAE,CAAC,CAAA;AAC1E,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,YAAY,CAAC,QAAwB;IAMpD,IAAI,MAAM,GAAG,QAAQ,CAAA;IACrB,IAAI,MAAM,GAAG,QAAQ,CAAA;IACrB,IAAI,MA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|
+
*
|
|
4
|
+
* Runtime queries then inspect the cell structure instead of reading the geometry.
|
|
4
5
|
*/
|
|
5
6
|
import { type H3Cell } from "@sister.software/h3";
|
|
6
7
|
import type { MultiPolygonRings } from "#geometries/polygon";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"polygon-cells.d.ts","sourceRoot":"","sources":["../../lib/h3/polygon-cells.ts"],"names":[],"mappings":"AAGA
|
|
1
|
+
{"version":3,"file":"polygon-cells.d.ts","sourceRoot":"","sources":["../../lib/h3/polygon-cells.ts"],"names":[],"mappings":"AAGA;;;;GAIG;AAEH,OAAO,EAUN,KAAK,MAAM,EACX,MAAM,qBAAqB,CAAA;AAI5B,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAA;AAG5D;;;GAGG;AACH,eAAO,MAAM,oBAAoB,UAAY,CAAA;AAE7C;;;GAGG;AACH,eAAO,MAAM,oBAAoB,IAAI,CAAA;AAgDrC;;;GAGG;AACH,MAAM,WAAW,YAAY;IAC5B;;;OAGG;IACH,UAAU,EAAE,MAAM,CAAA;IAClB;;OAEG;IACH,KAAK,EAAE,MAAM,EAAE,CAAA;IACf;;OAEG;IACH,OAAO,EAAE,MAAM,EAAE,CAAA;CACjB;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,GAAG,MAAM,CAUzF;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,iBAAiB,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAMxF;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CACnC,QAAQ,EAAE,iBAAiB,EAC3B,gBAAgB,EAAE,MAAM,EACxB,SAAS,EAAE,MAAM,EACjB,UAAU,SAAkB,GAC1B,YAAY,CA8Fd;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC,GAAG,MAAM,EAAE,EAAE,CAe1E;AAED;;;;GAIG;AACH,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC,GAAG,MAAM,EAAE,CAQ1E;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CACjC,SAAS,EAAE,MAAM,EACjB,eAAe,EAAE,MAAM,EACvB,WAAW,EAAE,SAAS,MAAM,EAAE,GAC5B,MAAM,EAAE,CAIV;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,YAAY,GAAG,KAAK,CAAC;IAC3D,MAAM,EAAE,MAAM,CAAA;IACd,UAAU,EAAE,MAAM,CAAA;IAClB,WAAW,EAAE,OAAO,GAAG,SAAS,CAAA;CAChC,CAAC,CAuBD;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,kBAAkB,EAAE,MAAM,GAAG,MAAM,CAEhF;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAC/B,IAAI,EAAE,GAAG,CAAC,MAAM,CAAC,EACjB,IAAI,EAAE,MAAM,EACZ,cAAc,EAAE,MAAM,EACtB,kBAAkB,EAAE,MAAM,GACxB,IAAI,CAgBN"}
|
package/out/h3/polygon-cells.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
// SPDX-FileCopyrightText: Teffen Ellis and Mailwoman contributors
|
|
2
2
|
// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Commercial
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
5
|
-
*
|
|
4
|
+
* This module turns one authority polygon into H3 cells at build time.
|
|
5
|
+
*
|
|
6
|
+
* Runtime queries then inspect the cell structure instead of reading the geometry.
|
|
6
7
|
*/
|
|
7
8
|
import { cellToChildren, cellToParent, compactCells, getHexagonAreaAvg, getHexagonEdgeLengthAvg, getResolution, latLngToCell, polygonToCellsExperimental, POLYGON_TO_CELLS_FLAGS, } from "@sister.software/h3";
|
|
8
9
|
import { METRES_PER_DEGREE } from "#distance";
|
|
@@ -204,8 +205,7 @@ export function featureCellRows(cells) {
|
|
|
204
205
|
for (const cell of cells.partial) {
|
|
205
206
|
const short = shortCellToInt(cell);
|
|
206
207
|
// A cell cannot be both for one polygon.
|
|
207
|
-
// This subtraction
|
|
208
|
-
// parent the partial set also names.
|
|
208
|
+
// This subtraction handles a compaction that produced a parent the partial set also names.
|
|
209
209
|
if (wholeShort.has(short))
|
|
210
210
|
continue;
|
|
211
211
|
rows.push({ h3Cell: short, resolution: cells.resolution, containment: "partial" });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"polygon-cells.js","sourceRoot":"","sources":["../../lib/h3/polygon-cells.ts"],"names":[],"mappings":"AAAA,kEAAkE;AAClE,kEAAkE;AAElE
|
|
1
|
+
{"version":3,"file":"polygon-cells.js","sourceRoot":"","sources":["../../lib/h3/polygon-cells.ts"],"names":[],"mappings":"AAAA,kEAAkE;AAClE,kEAAkE;AAElE;;;;GAIG;AAEH,OAAO,EACN,cAAc,EACd,YAAY,EACZ,YAAY,EACZ,iBAAiB,EACjB,uBAAuB,EACvB,aAAa,EACb,YAAY,EACZ,0BAA0B,EAC1B,sBAAsB,GAEtB,MAAM,qBAAqB,CAAA;AAG5B,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAA;AAE7C,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AACxD,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AACzC;;;GAGG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,SAAS,CAAA;AAE7C;;;GAGG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAA;AAErC;;;GAGG;AACH,SAAS,eAAe,CAAC,GAAiB;IACzC,MAAM,MAAM,GAAG,CAAC,CAAC,GAAG,CAAC,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,GAAG,GAAG,C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from "#google";
|
|
|
10
10
|
export * from "#h3";
|
|
11
11
|
export * from "#objects";
|
|
12
12
|
export * from "#osgb36";
|
|
13
|
-
export * from "#point
|
|
13
|
+
export * from "#point/reading";
|
|
14
|
+
export * from "#point/text";
|
|
14
15
|
export * from "#polyline";
|
|
15
16
|
export * from "#position";
|
|
16
17
|
export { isValidLatitude, isValidLongitude } from "#coordinate/bounds";
|
package/out/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../lib/index.ts"],"names":[],"mappings":"AAGA,cAAc,OAAO,CAAA;AACrB,cAAc,qBAAqB,CAAA;AACnC,cAAc,oBAAoB,CAAA;AAClC,cAAc,kBAAkB,CAAA;AAChC,cAAc,WAAW,CAAA;AACzB,cAAc,UAAU,CAAA;AACxB,cAAc,qBAAqB,CAAA;AACnC,cAAc,aAAa,CAAA;AAC3B,cAAc,SAAS,CAAA;AACvB,cAAc,KAAK,CAAA;AACnB,cAAc,UAAU,CAAA;AACxB,cAAc,SAAS,CAAA;AACvB,cAAc,cAAc,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../lib/index.ts"],"names":[],"mappings":"AAGA,cAAc,OAAO,CAAA;AACrB,cAAc,qBAAqB,CAAA;AACnC,cAAc,oBAAoB,CAAA;AAClC,cAAc,kBAAkB,CAAA;AAChC,cAAc,WAAW,CAAA;AACzB,cAAc,UAAU,CAAA;AACxB,cAAc,qBAAqB,CAAA;AACnC,cAAc,aAAa,CAAA;AAC3B,cAAc,SAAS,CAAA;AACvB,cAAc,KAAK,CAAA;AACnB,cAAc,UAAU,CAAA;AACxB,cAAc,SAAS,CAAA;AACvB,cAAc,gBAAgB,CAAA;AAC9B,cAAc,aAAa,CAAA;AAC3B,cAAc,WAAW,CAAA;AACzB,cAAc,WAAW,CAAA;AACzB,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AACtE,cAAc,aAAa,CAAA;AAC3B,cAAc,UAAU,CAAA"}
|
package/out/index.js
CHANGED
|
@@ -12,7 +12,8 @@ export * from "#google";
|
|
|
12
12
|
export * from "#h3";
|
|
13
13
|
export * from "#objects";
|
|
14
14
|
export * from "#osgb36";
|
|
15
|
-
export * from "#point
|
|
15
|
+
export * from "#point/reading";
|
|
16
|
+
export * from "#point/text";
|
|
16
17
|
export * from "#polyline";
|
|
17
18
|
export * from "#position";
|
|
18
19
|
export { isValidLatitude, isValidLongitude } from "#coordinate/bounds";
|
package/out/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../lib/index.ts"],"names":[],"mappings":"AAAA,kEAAkE;AAClE,kEAAkE;AAElE,cAAc,OAAO,CAAA;AACrB,cAAc,qBAAqB,CAAA;AACnC,cAAc,oBAAoB,CAAA;AAClC,cAAc,kBAAkB,CAAA;AAChC,cAAc,WAAW,CAAA;AACzB,cAAc,UAAU,CAAA;AACxB,cAAc,qBAAqB,CAAA;AACnC,cAAc,aAAa,CAAA;AAC3B,cAAc,SAAS,CAAA;AACvB,cAAc,KAAK,CAAA;AACnB,cAAc,UAAU,CAAA;AACxB,cAAc,SAAS,CAAA;AACvB,cAAc,cAAc,CAAA;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../lib/index.ts"],"names":[],"mappings":"AAAA,kEAAkE;AAClE,kEAAkE;AAElE,cAAc,OAAO,CAAA;AACrB,cAAc,qBAAqB,CAAA;AACnC,cAAc,oBAAoB,CAAA;AAClC,cAAc,kBAAkB,CAAA;AAChC,cAAc,WAAW,CAAA;AACzB,cAAc,UAAU,CAAA;AACxB,cAAc,qBAAqB,CAAA;AACnC,cAAc,aAAa,CAAA;AAC3B,cAAc,SAAS,CAAA;AACvB,cAAc,KAAK,CAAA;AACnB,cAAc,UAAU,CAAA;AACxB,cAAc,SAAS,CAAA;AACvB,cAAc,gBAAgB,CAAA;AAC9B,cAAc,aAAa,CAAA;AAC3B,cAAc,WAAW,CAAA;AACzB,cAAc,WAAW,CAAA;AACzB,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AACtE,cAAc,aAAa,CAAA;AAC3B,cAAc,UAAU,CAAA"}
|
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file Open Location Code arithmetic.
|
|
3
|
+
*
|
|
4
|
+
* A code is read by the `spatial` family of `@mailwoman/recognizer`, which owns the alphabet, the separator
|
|
5
|
+
* and the digit counts. The decoders here take the validated, branded `Validated.FullPlusCode` and `Validated.ShortPlusCode` the family returns,
|
|
6
|
+
* so a caller cannot pass an unchecked string. A test or a tool that holds a string reads it through the recognizer.
|
|
7
|
+
*/
|
|
8
|
+
import type { Validated } from "@mailwoman/recognizer/types";
|
|
1
9
|
import type { DegreeCell } from "#coordinate/cell";
|
|
2
10
|
/**
|
|
3
11
|
* A decoded plus-code cell by its center and its span in degrees, from
|
|
@@ -5,35 +13,35 @@ import type { DegreeCell } from "#coordinate/cell";
|
|
|
5
13
|
*/
|
|
6
14
|
export type DecodedPlusCode = DegreeCell;
|
|
7
15
|
/**
|
|
8
|
-
*
|
|
16
|
+
* Decodes a full code to its cell.
|
|
9
17
|
*
|
|
10
|
-
*
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Returns true for a short plus code with 2, 4 or 6 digits before the `+`,
|
|
15
|
-
* such as the `VFQ6+92P` form Google prints on place cards.
|
|
18
|
+
* The validator guarantees the alphabet and the digit counts, and the brand guarantees
|
|
19
|
+
* the eight digits before the separator, so no input to this function fails.
|
|
20
|
+
* A short code has its own brand and decodes through {@link recoverNearestPlusCode}.
|
|
16
21
|
*/
|
|
17
|
-
export declare function
|
|
18
|
-
/**
|
|
19
|
-
* Decodes a full plus code to its cell, returning null for anything {@link isFullPlusCode} rejects.
|
|
20
|
-
*/
|
|
21
|
-
export declare function decodePlusCode(code: string): DecodedPlusCode | null;
|
|
22
|
+
export declare function decodePlusCode(code: Validated.FullPlusCode): DecodedPlusCode;
|
|
22
23
|
/**
|
|
23
24
|
* The code lengths this encoder writes: the ten-digit code Google prints,
|
|
24
25
|
* or the eleven-digit code with one grid refinement digit.
|
|
25
26
|
*/
|
|
26
27
|
export type PlusCodeLength = 10 | 11;
|
|
27
28
|
/**
|
|
28
|
-
* Encodes a coordinate as a full plus code of 10 or 11 digits, the forms
|
|
29
|
+
* Encodes a coordinate as a full plus code of 10 or 11 digits, the forms an address holds.
|
|
29
30
|
*
|
|
30
31
|
* The eleventh digit refines the last pair's cell on the 4 × 5 grid the spec defines.
|
|
32
|
+
* The digits come from the specification's alphabet and the separator follows the eighth,
|
|
33
|
+
* so the code has the form the validator accepts and the decoders take.
|
|
31
34
|
*/
|
|
32
|
-
export declare function encodePlusCode(lat: number, lon: number, length?: PlusCodeLength):
|
|
35
|
+
export declare function encodePlusCode(lat: number, lon: number, length?: PlusCodeLength): Validated.FullPlusCode;
|
|
33
36
|
/**
|
|
34
37
|
* Recovers a short plus code to the matching cell nearest a reference coordinate,
|
|
35
38
|
* following the spec's `recoverNearest`.
|
|
36
|
-
*
|
|
39
|
+
*
|
|
40
|
+
* The brand guarantees two, four or six digits before the separator, so every short code recovers to a cell.
|
|
41
|
+
* The reference must be a finite coordinate.
|
|
42
|
+
*
|
|
43
|
+
* Every caller already holds one.
|
|
44
|
+
* A full code has its own brand and decodes through {@link decodePlusCode}.
|
|
37
45
|
*/
|
|
38
|
-
export declare function recoverNearestPlusCode(shortCode:
|
|
46
|
+
export declare function recoverNearestPlusCode(shortCode: Validated.ShortPlusCode, refLat: number, refLon: number): DecodedPlusCode;
|
|
39
47
|
//# sourceMappingURL=open-location-code.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"open-location-code.d.ts","sourceRoot":"","sources":["../lib/open-location-code.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"open-location-code.d.ts","sourceRoot":"","sources":["../lib/open-location-code.ts"],"names":[],"mappings":"AAGA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAA;AAE5D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAkBlD;;;GAGG;AACH,MAAM,MAAM,eAAe,GAAG,UAAU,CAAA;AAExC;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,SAAS,CAAC,YAAY,GAAG,eAAe,CAE5E;AAyED;;;GAGG;AACH,MAAM,MAAM,cAAc,GAAG,EAAE,GAAG,EAAE,CAAA;AAEpC;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,GAAE,cAAmB,GAAG,SAAS,CAAC,YAAY,CAW5G;AAED;;;;;;;;;GASG;AACH,wBAAgB,sBAAsB,CACrC,SAAS,EAAE,SAAS,CAAC,aAAa,EAClC,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,GACZ,eAAe,CAuBjB"}
|