@accelint/geo 0.1.2 → 0.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 +3 -0
- package/dist/cartesian.d.ts +21 -0
- package/dist/cartesian.js +11 -0
- package/dist/cartesian.js.map +1 -0
- package/dist/coordinates/coordinate.d.ts +72 -0
- package/dist/coordinates/coordinate.js +87 -0
- package/dist/coordinates/coordinate.js.map +1 -0
- package/dist/coordinates/latlon/decimal-degrees/parser.d.ts +8 -0
- package/dist/coordinates/latlon/decimal-degrees/parser.js +77 -0
- package/dist/coordinates/latlon/decimal-degrees/parser.js.map +1 -0
- package/dist/coordinates/latlon/decimal-degrees/system.d.ts +8 -0
- package/dist/coordinates/latlon/decimal-degrees/system.js +21 -0
- package/dist/coordinates/latlon/decimal-degrees/system.js.map +1 -0
- package/dist/coordinates/latlon/degrees-decimal-minutes/parser.d.ts +8 -0
- package/dist/coordinates/latlon/degrees-decimal-minutes/parser.js +86 -0
- package/dist/coordinates/latlon/degrees-decimal-minutes/parser.js.map +1 -0
- package/dist/coordinates/latlon/degrees-decimal-minutes/system.d.ts +8 -0
- package/dist/coordinates/latlon/degrees-decimal-minutes/system.js +26 -0
- package/dist/coordinates/latlon/degrees-decimal-minutes/system.js.map +1 -0
- package/dist/coordinates/latlon/degrees-minutes-seconds/parser.d.ts +8 -0
- package/dist/coordinates/latlon/degrees-minutes-seconds/parser.js +85 -0
- package/dist/coordinates/latlon/degrees-minutes-seconds/parser.js.map +1 -0
- package/dist/coordinates/latlon/degrees-minutes-seconds/system.d.ts +8 -0
- package/dist/coordinates/latlon/degrees-minutes-seconds/system.js +28 -0
- package/dist/coordinates/latlon/degrees-minutes-seconds/system.js.map +1 -0
- package/dist/coordinates/latlon/internal/coordinate-system.d.ts +12 -0
- package/dist/coordinates/latlon/internal/coordinate-system.js +3 -0
- package/dist/coordinates/latlon/internal/coordinate-system.js.map +1 -0
- package/dist/coordinates/latlon/internal/create-cache.d.ts +12 -0
- package/dist/coordinates/latlon/internal/create-cache.js +15 -0
- package/dist/coordinates/latlon/internal/create-cache.js.map +1 -0
- package/dist/coordinates/latlon/internal/exhaustive-errors.d.ts +9 -0
- package/dist/coordinates/latlon/internal/exhaustive-errors.js +72 -0
- package/dist/coordinates/latlon/internal/exhaustive-errors.js.map +1 -0
- package/dist/coordinates/latlon/internal/in-range.d.ts +7 -0
- package/dist/coordinates/latlon/internal/in-range.js +14 -0
- package/dist/coordinates/latlon/internal/in-range.js.map +1 -0
- package/dist/coordinates/latlon/internal/index.d.ts +59 -0
- package/dist/coordinates/latlon/internal/index.js +117 -0
- package/dist/coordinates/latlon/internal/index.js.map +1 -0
- package/dist/coordinates/latlon/internal/lexer.d.ts +20 -0
- package/dist/coordinates/latlon/internal/lexer.js +46 -0
- package/dist/coordinates/latlon/internal/lexer.js.map +1 -0
- package/dist/coordinates/latlon/internal/parse-format.d.ts +15 -0
- package/dist/coordinates/latlon/internal/parse-format.js +63 -0
- package/dist/coordinates/latlon/internal/parse-format.js.map +1 -0
- package/dist/coordinates/latlon/internal/parse.d.ts +41 -0
- package/dist/coordinates/latlon/internal/parse.js +16 -0
- package/dist/coordinates/latlon/internal/parse.js.map +1 -0
- package/dist/coordinates/latlon/internal/pipes/check-ambiguous.d.ts +10 -0
- package/dist/coordinates/latlon/internal/pipes/check-ambiguous.js +23 -0
- package/dist/coordinates/latlon/internal/pipes/check-ambiguous.js.map +1 -0
- package/dist/coordinates/latlon/internal/pipes/check-numbers.d.ts +8 -0
- package/dist/coordinates/latlon/internal/pipes/check-numbers.js +35 -0
- package/dist/coordinates/latlon/internal/pipes/check-numbers.js.map +1 -0
- package/dist/coordinates/latlon/internal/pipes/fix-bearings.d.ts +12 -0
- package/dist/coordinates/latlon/internal/pipes/fix-bearings.js +68 -0
- package/dist/coordinates/latlon/internal/pipes/fix-bearings.js.map +1 -0
- package/dist/coordinates/latlon/internal/pipes/fix-dividers.d.ts +15 -0
- package/dist/coordinates/latlon/internal/pipes/fix-dividers.js +34 -0
- package/dist/coordinates/latlon/internal/pipes/fix-dividers.js.map +1 -0
- package/dist/coordinates/latlon/internal/pipes/genome.d.ts +9 -0
- package/dist/coordinates/latlon/internal/pipes/genome.js +37 -0
- package/dist/coordinates/latlon/internal/pipes/genome.js.map +1 -0
- package/dist/coordinates/latlon/internal/pipes/index.d.ts +24 -0
- package/dist/coordinates/latlon/internal/pipes/index.js +46 -0
- package/dist/coordinates/latlon/internal/pipes/index.js.map +1 -0
- package/dist/coordinates/latlon/internal/pipes/simpler.d.ts +15 -0
- package/dist/coordinates/latlon/internal/pipes/simpler.js +6 -0
- package/dist/coordinates/latlon/internal/pipes/simpler.js.map +1 -0
- package/dist/coordinates/latlon/internal/violation.d.ts +3 -0
- package/dist/coordinates/latlon/internal/violation.js +6 -0
- package/dist/coordinates/latlon/internal/violation.js.map +1 -0
- package/dist/coordinates/mgrs/parser.d.ts +7 -0
- package/dist/coordinates/mgrs/parser.js +45 -0
- package/dist/coordinates/mgrs/parser.js.map +1 -0
- package/dist/coordinates/mgrs/system.d.ts +8 -0
- package/dist/coordinates/mgrs/system.js +25 -0
- package/dist/coordinates/mgrs/system.js.map +1 -0
- package/dist/coordinates/utm/parser.d.ts +7 -0
- package/dist/coordinates/utm/parser.js +38 -0
- package/dist/coordinates/utm/parser.js.map +1 -0
- package/dist/coordinates/utm/system.d.ts +8 -0
- package/dist/coordinates/utm/system.js +25 -0
- package/dist/coordinates/utm/system.js.map +1 -0
- package/dist/index.d.ts +10 -5
- package/dist/index.js +7 -5
- package/dist/index.js.map +1 -1
- package/dist/patterning.d.ts +63 -0
- package/dist/patterning.js +16 -0
- package/dist/patterning.js.map +1 -0
- package/package.json +17 -11
- package/dist/coordinates/configurations.d.ts +0 -6
- package/dist/coordinates/configurations.js +0 -15
- package/dist/coordinates/configurations.js.map +0 -1
- package/dist/coordinates/index.d.ts +0 -11
- package/dist/coordinates/index.js +0 -23
- package/dist/coordinates/index.js.map +0 -1
- package/dist/coordinates/match.d.ts +0 -34
- package/dist/coordinates/match.js +0 -35
- package/dist/coordinates/match.js.map +0 -1
- package/dist/coordinates/normalize.d.ts +0 -1
- package/dist/coordinates/normalize.js +0 -28
- package/dist/coordinates/normalize.js.map +0 -1
- package/dist/coordinates/regex.d.ts +0 -126
- package/dist/coordinates/regex.js +0 -142
- package/dist/coordinates/regex.js.map +0 -1
- package/dist/coordinates/utils.d.ts +0 -5
- package/dist/coordinates/utils.js +0 -27
- package/dist/coordinates/utils.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/coordinates/mgrs/system.ts"],"names":[],"mappings":";;;;;;AAsBO,IAAM,UAA+B,GAAA;AAAA,EAC1C,IAAM,EAAA,gCAAA;AAAA,EAEN,KAAO,EAAA,SAAA;AAAA,EAEP,QAAQ,GAAK,EAAA;AACX,IAAM,MAAA,CAAC,GAAK,EAAA,IAAI,CAAI,GAAA,GAAA;AAEpB,IACE,OAAA,MAAA,CAAO,WAAW,GAAG,CAAA,IACpB,gBAAgB,iBAAkB,CAAA,IAAA,CAAK,IAAI,CAAA,GAAI,EAAK,GAAA,CAAA,CAAA;AAAA,GAEzD;AAAA,EAEA,QAAS,CAAA,MAAA,EAAgB,CAAC,IAAA,EAAM,KAAK,CAAqB,EAAA;AACxD,IAAA,MAAM,EAAE,GAAA,EAAK,GAAI,EAAA,GAAI,OAAO,WAAY,CAAA;AAAA,MACtC,CAAC,MAAO,CAAA,KAAA,CAAM,CAAG,EAAA,CAAC,GAAG,IAAI,CAAA;AAAA,MACzB,CAAC,MAAA,CAAO,KAAM,CAAA,CAAC,GAAG,KAAK;AAAA,KACxB,CAAA;AAED,IAAO,OAAA,IAAA,CAAK,KAAK,KAAM,CAAA,KAAA,CAAM,KAAK,GAAG,CAAC,EAAE,QAAS,EAAA;AAAA;AAErD","file":"system.js","sourcesContent":["// __private-exports\n/*\n * Copyright 2024 Hypergiant Galactic Systems Inc. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport { Point } from '@ngageoint/grid-js';\nimport { MGRS } from '@ngageoint/mgrs-js';\n\nimport { type Compass, type Format, SYMBOL_PATTERNS } from '../latlon/internal';\nimport type { CoordinateSystem } from '../latlon/internal/coordinate-system';\n\nimport { parseMGRS } from './parser';\n\n// biome-ignore lint/style/useNamingConvention: acronym\nexport const systemMGRS: CoordinateSystem = {\n name: 'Military Grid Reference System',\n\n parse: parseMGRS,\n\n toFloat(arg) {\n const [num, bear] = arg as [string, Compass];\n\n return (\n Number.parseFloat(num) *\n (SYMBOL_PATTERNS.NEGATIVE_BEARINGS.test(bear) ? -1 : 1)\n );\n },\n\n toFormat(format: Format, [left, right]: [number, number]) {\n const { LAT, LON } = Object.fromEntries([\n [format.slice(0, 3), left],\n [format.slice(3), right],\n ]) as Record<'LAT' | 'LON', number>;\n\n return MGRS.from(Point.point(LON, LAT)).toString();\n },\n};\n"]}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { UTM } from '@ngageoint/mgrs-js';
|
|
2
|
+
import { parse } from '../latlon/internal/parse.js';
|
|
3
|
+
import { violation } from '../latlon/internal/violation.js';
|
|
4
|
+
|
|
5
|
+
// src/coordinates/utm/parser.ts
|
|
6
|
+
var PATTERN_PARTS = /^((?:..)?)\s*(\w?)\s*(?:(\d+(?:\.\d*)?)?)\s*(?:(\d+(?:\.\d*)?)?)$/i;
|
|
7
|
+
var error = (message) => [
|
|
8
|
+
[],
|
|
9
|
+
[`${violation(message)}; expected format ZZ N|S DDD DDD.`]
|
|
10
|
+
];
|
|
11
|
+
function detailedErrors(input) {
|
|
12
|
+
const [zone, band, east, north] = (input.trim().replace(/\s+/g, " ").match(PATTERN_PARTS) ?? []).slice(1);
|
|
13
|
+
if (!zone || +zone > 60 || +zone < 1) {
|
|
14
|
+
return error(`Invalid Zone number (${zone}) found`);
|
|
15
|
+
}
|
|
16
|
+
if (!/[NS]/i.test(band)) {
|
|
17
|
+
return error(`Invalid Latitude band letter (${band}) found`);
|
|
18
|
+
}
|
|
19
|
+
if (!(east || +east >= 0)) {
|
|
20
|
+
return error(`Invalid Easting number (${east ?? ""}) found`);
|
|
21
|
+
}
|
|
22
|
+
if (!(north || +north >= 0)) {
|
|
23
|
+
return error(`Invalid Northing number (${north ?? ""}) found`);
|
|
24
|
+
}
|
|
25
|
+
return error("Uncaught error condition.");
|
|
26
|
+
}
|
|
27
|
+
function parseUTM(_format, input) {
|
|
28
|
+
try {
|
|
29
|
+
const point = UTM.parse(input).toPoint();
|
|
30
|
+
return parse(`${point.getLatitude()} / ${point.getLongitude()}`, "LATLON");
|
|
31
|
+
} catch (_) {
|
|
32
|
+
return detailedErrors(input);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export { parseUTM };
|
|
37
|
+
//# sourceMappingURL=parser.js.map
|
|
38
|
+
//# sourceMappingURL=parser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/coordinates/utm/parser.ts"],"names":[],"mappings":";;;;;AAmBA,IAAM,aACJ,GAAA,oEAAA;AAEF,IAAM,KAAA,GAAQ,CAAC,OACb,KAAA;AAAA,EACE,EAAC;AAAA,EACD,CAAC,CAAA,EAAG,SAAU,CAAA,OAAO,CAAC,CAAmC,iCAAA,CAAA;AAC3D,CAAA;AAEF,SAAS,eAAe,KAAe,EAAA;AACrC,EAAA,MAAM,CAAC,IAAM,EAAA,IAAA,EAAM,MAAM,KAAK,CAAA,GAAA,CAC5B,MAAM,IAAK,EAAA,CAAE,QAAQ,MAAQ,EAAA,GAAG,EAAE,KAAM,CAAA,aAAa,KAAK,EAAC,EAC3D,MAAM,CAAC,CAAA;AAET,EAAA,IAAI,CAAC,IAAQ,IAAA,CAAC,OAAO,EAAM,IAAA,CAAC,OAAO,CAAG,EAAA;AACpC,IAAO,OAAA,KAAA,CAAM,CAAwB,qBAAA,EAAA,IAAI,CAAS,OAAA,CAAA,CAAA;AAAA;AAGpD,EAAA,IAAI,CAAC,OAAA,CAAQ,IAAK,CAAA,IAAI,CAAG,EAAA;AACvB,IAAO,OAAA,KAAA,CAAM,CAAiC,8BAAA,EAAA,IAAI,CAAS,OAAA,CAAA,CAAA;AAAA;AAG7D,EAAA,IAAI,EAAE,IAAA,IAAQ,CAAC,IAAA,IAAQ,CAAI,CAAA,EAAA;AACzB,IAAA,OAAO,KAAM,CAAA,CAAA,wBAAA,EAA2B,IAAQ,IAAA,EAAE,CAAS,OAAA,CAAA,CAAA;AAAA;AAG7D,EAAA,IAAI,EAAE,KAAA,IAAS,CAAC,KAAA,IAAS,CAAI,CAAA,EAAA;AAC3B,IAAA,OAAO,KAAM,CAAA,CAAA,yBAAA,EAA4B,KAAS,IAAA,EAAE,CAAS,OAAA,CAAA,CAAA;AAAA;AAG/D,EAAA,OAAO,MAAM,2BAA2B,CAAA;AAC1C;AAIO,SAAS,QAAA,CAAS,SAAc,KAAe,EAAA;AACpD,EAAI,IAAA;AACF,IAAA,MAAM,KAAQ,GAAA,GAAA,CAAI,KAAM,CAAA,KAAK,EAAE,OAAQ,EAAA;AAEvC,IAAO,OAAA,KAAA,CAAM,CAAG,EAAA,KAAA,CAAM,WAAY,EAAC,MAAM,KAAM,CAAA,YAAA,EAAc,CAAA,CAAA,EAAI,QAAQ,CAAA;AAAA,WAClE,CAAG,EAAA;AACV,IAAA,OAAO,eAAe,KAAK,CAAA;AAAA;AAE/B","file":"parser.js","sourcesContent":["/*\n * Copyright 2024 Hypergiant Galactic Systems Inc. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport { UTM } from '@ngageoint/mgrs-js';\n\nimport { type ParseResults, parse } from '../latlon/internal/parse';\nimport { violation } from '../latlon/internal/violation';\n\ntype Match = [string, string, string, string];\n\nconst PATTERN_PARTS =\n /^((?:..)?)\\s*(\\w?)\\s*(?:(\\d+(?:\\.\\d*)?)?)\\s*(?:(\\d+(?:\\.\\d*)?)?)$/i;\n\nconst error = (message: string) =>\n [\n [],\n [`${violation(message)}; expected format ZZ N|S DDD DDD.`],\n ] as ParseResults;\n\nfunction detailedErrors(input: string) {\n const [zone, band, east, north] = (\n input.trim().replace(/\\s+/g, ' ').match(PATTERN_PARTS) ?? []\n ).slice(1) as Match;\n\n if (!zone || +zone > 60 || +zone < 1) {\n return error(`Invalid Zone number (${zone}) found`);\n }\n\n if (!/[NS]/i.test(band)) {\n return error(`Invalid Latitude band letter (${band}) found`);\n }\n\n if (!(east || +east >= 0)) {\n return error(`Invalid Easting number (${east ?? ''}) found`);\n }\n\n if (!(north || +north >= 0)) {\n return error(`Invalid Northing number (${north ?? ''}) found`);\n }\n\n return error('Uncaught error condition.');\n}\n\n// biome-ignore lint/style/useNamingConvention: <explanation>\n// biome-ignore lint/suspicious/noExplicitAny: <explanation>\nexport function parseUTM(_format: any, input: string) {\n try {\n const point = UTM.parse(input).toPoint();\n\n return parse(`${point.getLatitude()} / ${point.getLongitude()}`, 'LATLON');\n } catch (_) {\n return detailedErrors(input);\n }\n}\n"]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { CoordinateSystem } from '../latlon/internal/coordinate-system.js';
|
|
2
|
+
import '../latlon/internal/index.js';
|
|
3
|
+
import '../latlon/internal/parse.js';
|
|
4
|
+
import '../latlon/internal/lexer.js';
|
|
5
|
+
|
|
6
|
+
declare const systemUTM: CoordinateSystem;
|
|
7
|
+
|
|
8
|
+
export { systemUTM };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Point } from '@ngageoint/grid-js';
|
|
2
|
+
import { UTM } from '@ngageoint/mgrs-js';
|
|
3
|
+
import { SYMBOL_PATTERNS } from '../latlon/internal/index.js';
|
|
4
|
+
import { parseUTM } from './parser.js';
|
|
5
|
+
|
|
6
|
+
// src/coordinates/utm/system.ts
|
|
7
|
+
var systemUTM = {
|
|
8
|
+
name: "Military Grid Reference System",
|
|
9
|
+
parse: parseUTM,
|
|
10
|
+
toFloat(arg) {
|
|
11
|
+
const [num, bear] = arg;
|
|
12
|
+
return Number.parseFloat(num) * (SYMBOL_PATTERNS.NEGATIVE_BEARINGS.test(bear) ? -1 : 1);
|
|
13
|
+
},
|
|
14
|
+
toFormat(format, [left, right]) {
|
|
15
|
+
const { LAT, LON } = Object.fromEntries([
|
|
16
|
+
[format.slice(0, 3), left],
|
|
17
|
+
[format.slice(3), right]
|
|
18
|
+
]);
|
|
19
|
+
return UTM.from(Point.point(LON, LAT)).toString();
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export { systemUTM };
|
|
24
|
+
//# sourceMappingURL=system.js.map
|
|
25
|
+
//# sourceMappingURL=system.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/coordinates/utm/system.ts"],"names":[],"mappings":";;;;;;AAsBO,IAAM,SAA8B,GAAA;AAAA,EACzC,IAAM,EAAA,gCAAA;AAAA,EAEN,KAAO,EAAA,QAAA;AAAA,EAEP,QAAQ,GAAK,EAAA;AACX,IAAM,MAAA,CAAC,GAAK,EAAA,IAAI,CAAI,GAAA,GAAA;AAEpB,IACE,OAAA,MAAA,CAAO,WAAW,GAAG,CAAA,IACpB,gBAAgB,iBAAkB,CAAA,IAAA,CAAK,IAAI,CAAA,GAAI,EAAK,GAAA,CAAA,CAAA;AAAA,GAEzD;AAAA,EAEA,QAAS,CAAA,MAAA,EAAgB,CAAC,IAAA,EAAM,KAAK,CAAqB,EAAA;AACxD,IAAA,MAAM,EAAE,GAAA,EAAK,GAAI,EAAA,GAAI,OAAO,WAAY,CAAA;AAAA,MACtC,CAAC,MAAO,CAAA,KAAA,CAAM,CAAG,EAAA,CAAC,GAAG,IAAI,CAAA;AAAA,MACzB,CAAC,MAAA,CAAO,KAAM,CAAA,CAAC,GAAG,KAAK;AAAA,KACxB,CAAA;AAED,IAAO,OAAA,GAAA,CAAI,KAAK,KAAM,CAAA,KAAA,CAAM,KAAK,GAAG,CAAC,EAAE,QAAS,EAAA;AAAA;AAEpD","file":"system.js","sourcesContent":["// __private-exports\n/*\n * Copyright 2024 Hypergiant Galactic Systems Inc. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport { Point } from '@ngageoint/grid-js';\nimport { UTM } from '@ngageoint/mgrs-js';\n\nimport { type Compass, type Format, SYMBOL_PATTERNS } from '../latlon/internal';\nimport type { CoordinateSystem } from '../latlon/internal/coordinate-system';\n\nimport { parseUTM } from './parser';\n\n// biome-ignore lint/style/useNamingConvention: acronym\nexport const systemUTM: CoordinateSystem = {\n name: 'Military Grid Reference System',\n\n parse: parseUTM,\n\n toFloat(arg) {\n const [num, bear] = arg as [string, Compass];\n\n return (\n Number.parseFloat(num) *\n (SYMBOL_PATTERNS.NEGATIVE_BEARINGS.test(bear) ? -1 : 1)\n );\n },\n\n toFormat(format: Format, [left, right]: [number, number]) {\n const { LAT, LON } = Object.fromEntries([\n [format.slice(0, 3), left],\n [format.slice(3), right],\n ]) as Record<'LAT' | 'LON', number>;\n\n return UTM.from(Point.point(LON, LAT)).toString();\n },\n};\n"]}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
export {
|
|
5
|
-
export {
|
|
1
|
+
export { coordinateSystems, createCoordinate } from './coordinates/coordinate.js';
|
|
2
|
+
export { parseDecimalDegrees } from './coordinates/latlon/decimal-degrees/parser.js';
|
|
3
|
+
export { parseDegreesDecimalMinutes } from './coordinates/latlon/degrees-decimal-minutes/parser.js';
|
|
4
|
+
export { parseDegreesMinutesSeconds } from './coordinates/latlon/degrees-minutes-seconds/parser.js';
|
|
5
|
+
export { parseMGRS } from './coordinates/mgrs/parser.js';
|
|
6
|
+
export { parseUTM } from './coordinates/utm/parser.js';
|
|
7
|
+
import './coordinates/latlon/internal/index.js';
|
|
8
|
+
import './coordinates/latlon/internal/coordinate-system.js';
|
|
9
|
+
import './coordinates/latlon/internal/parse.js';
|
|
10
|
+
import './coordinates/latlon/internal/lexer.js';
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
export {
|
|
5
|
-
export {
|
|
1
|
+
export { coordinateSystems, createCoordinate } from './coordinates/coordinate.js';
|
|
2
|
+
export { parseDecimalDegrees } from './coordinates/latlon/decimal-degrees/parser.js';
|
|
3
|
+
export { parseDegreesDecimalMinutes } from './coordinates/latlon/degrees-decimal-minutes/parser.js';
|
|
4
|
+
export { parseDegreesMinutesSeconds } from './coordinates/latlon/degrees-minutes-seconds/parser.js';
|
|
5
|
+
export { parseMGRS } from './coordinates/mgrs/parser.js';
|
|
6
|
+
export { parseUTM } from './coordinates/utm/parser.js';
|
|
7
|
+
//# sourceMappingURL=index.js.map
|
|
6
8
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"index.js","sourcesContent":[]}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Create a "capturing" group with the pattern provided by all arguments
|
|
3
|
+
* merged into a single regex.
|
|
4
|
+
*
|
|
5
|
+
* @remarks
|
|
6
|
+
* pure function
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* capture(/a/, /b/, /c/) === /(abc)/
|
|
10
|
+
*/
|
|
11
|
+
declare const capture: (...p: RegExp[]) => RegExp;
|
|
12
|
+
/**
|
|
13
|
+
* Create a pattern using a template string and dict(ionary) of terms.
|
|
14
|
+
*
|
|
15
|
+
* @param dict an object with keys/properties that are RegExp objects that will
|
|
16
|
+
* be used in the template string
|
|
17
|
+
* @param template the definition of the pattern to build using the dict(ionary)
|
|
18
|
+
* patterns
|
|
19
|
+
*
|
|
20
|
+
* @remarks
|
|
21
|
+
* pure function
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* fromTemplate({ a: /alpha/, b: /beta/, ' ': / / }, 'a b') === /^alpha beta$/
|
|
25
|
+
*
|
|
26
|
+
*/
|
|
27
|
+
declare const fromTemplate: (dict: Record<string, RegExp>, template: string) => RegExp;
|
|
28
|
+
/**
|
|
29
|
+
* Create a "non-capturing" group with the pattern provided by all arguments
|
|
30
|
+
* merged into a single regex.
|
|
31
|
+
*
|
|
32
|
+
* @remarks
|
|
33
|
+
* pure function
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* capture(/a/, /b/, /c/) === /(?:abc)/
|
|
37
|
+
*/
|
|
38
|
+
declare const group: (...p: RegExp[]) => RegExp;
|
|
39
|
+
/**
|
|
40
|
+
* Concatenate all of the provided patterns into a single pattern; each
|
|
41
|
+
* subsequent argument is joined with the previous with no "qualifier" between
|
|
42
|
+
* them.
|
|
43
|
+
*
|
|
44
|
+
* @remarks
|
|
45
|
+
* pure function
|
|
46
|
+
*
|
|
47
|
+
* @example
|
|
48
|
+
* merge(/a/, /b/, /c/) === /abc/
|
|
49
|
+
*/
|
|
50
|
+
declare const merge: (...all: RegExp[]) => RegExp;
|
|
51
|
+
/**
|
|
52
|
+
* Create an "optional" "non-capturing" group with the pattern provided by all
|
|
53
|
+
* arguments merged into a single regex.
|
|
54
|
+
*
|
|
55
|
+
* @remarks
|
|
56
|
+
* pure function
|
|
57
|
+
*
|
|
58
|
+
* @example
|
|
59
|
+
* capture(/a/, /b/, /c/) === /(?:abc)?/
|
|
60
|
+
*/
|
|
61
|
+
declare const optional: (...p: RegExp[]) => RegExp;
|
|
62
|
+
|
|
63
|
+
export { capture, fromTemplate, group, merge, optional };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// src/patterning.ts
|
|
2
|
+
var capture = (...p) => new RegExp(`(${merge(...p).source})`);
|
|
3
|
+
var fromTemplate = (dict, template) => merge(
|
|
4
|
+
/^/,
|
|
5
|
+
...(template.match(/(\s+)|([^\s]+)/g) ?? []).map(
|
|
6
|
+
(t) => dict[t] ?? new RegExp(`_MISS_${t}_MISS_`)
|
|
7
|
+
),
|
|
8
|
+
/$/
|
|
9
|
+
);
|
|
10
|
+
var group = (...p) => new RegExp(`(?:${merge(...p).source})`);
|
|
11
|
+
var merge = (...all) => all.reduce((acc, next) => new RegExp(acc?.source + next.source));
|
|
12
|
+
var optional = (...p) => new RegExp(`(?:${merge(...p).source})?`);
|
|
13
|
+
|
|
14
|
+
export { capture, fromTemplate, group, merge, optional };
|
|
15
|
+
//# sourceMappingURL=patterning.js.map
|
|
16
|
+
//# sourceMappingURL=patterning.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/patterning.ts"],"names":[],"mappings":";AAuBa,IAAA,OAAA,GAAU,CAAI,GAAA,CAAA,KACzB,IAAI,MAAA,CAAO,CAAI,CAAA,EAAA,KAAA,CAAM,GAAG,CAAC,CAAE,CAAA,MAAM,CAAG,CAAA,CAAA;AAiBzB,IAAA,YAAA,GAAe,CAAC,IAAA,EAA8B,QACzD,KAAA,KAAA;AAAA,EACE,GAAA;AAAA,EACA,IAAI,QAAS,CAAA,KAAA,CAAM,iBAAiB,CAAA,IAAK,EAAI,EAAA,GAAA;AAAA,IAC3C,CAAC,MAAM,IAAK,CAAA,CAAsB,KAAK,IAAI,MAAA,CAAO,CAAS,MAAA,EAAA,CAAC,CAAQ,MAAA,CAAA;AAAA,GACtE;AAAA,EACA;AACF;AAYW,IAAA,KAAA,GAAQ,CAAI,GAAA,CAAA,KACvB,IAAI,MAAA,CAAO,CAAM,GAAA,EAAA,KAAA,CAAM,GAAG,CAAC,CAAE,CAAA,MAAM,CAAG,CAAA,CAAA;AAajC,IAAM,KAAQ,GAAA,CAAA,GAAI,GACvB,KAAA,GAAA,CAAI,OAAO,CAAC,GAAA,EAAK,IAAS,KAAA,IAAI,MAAO,CAAA,GAAA,EAAK,MAAS,GAAA,IAAA,CAAK,MAAM,CAAC;AAYpD,IAAA,QAAA,GAAW,CAAI,GAAA,CAAA,KAC1B,IAAI,MAAA,CAAO,CAAM,GAAA,EAAA,KAAA,CAAM,GAAG,CAAC,CAAE,CAAA,MAAM,CAAI,EAAA,CAAA","file":"patterning.js","sourcesContent":["// __private-exports\n/*\n * Copyright 2024 Hypergiant Galactic Systems Inc. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\n/**\n * Create a \"capturing\" group with the pattern provided by all arguments\n * merged into a single regex.\n *\n * @remarks\n * pure function\n *\n * @example\n * capture(/a/, /b/, /c/) === /(abc)/\n */\nexport const capture = (...p: RegExp[]) =>\n new RegExp(`(${merge(...p).source})`);\n\n/**\n * Create a pattern using a template string and dict(ionary) of terms.\n *\n * @param dict an object with keys/properties that are RegExp objects that will\n * be used in the template string\n * @param template the definition of the pattern to build using the dict(ionary)\n * patterns\n *\n * @remarks\n * pure function\n *\n * @example\n * fromTemplate({ a: /alpha/, b: /beta/, ' ': / / }, 'a b') === /^alpha beta$/\n *\n */\nexport const fromTemplate = (dict: Record<string, RegExp>, template: string) =>\n merge(\n /^/,\n ...(template.match(/(\\s+)|([^\\s]+)/g) ?? []).map(\n (t) => dict[t as keyof typeof dict] ?? new RegExp(`_MISS_${t}_MISS_`),\n ),\n /$/,\n );\n\n/**\n * Create a \"non-capturing\" group with the pattern provided by all arguments\n * merged into a single regex.\n *\n * @remarks\n * pure function\n *\n * @example\n * capture(/a/, /b/, /c/) === /(?:abc)/\n */\nexport const group = (...p: RegExp[]) =>\n new RegExp(`(?:${merge(...p).source})`);\n\n/**\n * Concatenate all of the provided patterns into a single pattern; each\n * subsequent argument is joined with the previous with no \"qualifier\" between\n * them.\n *\n * @remarks\n * pure function\n *\n * @example\n * merge(/a/, /b/, /c/) === /abc/\n */\nexport const merge = (...all: RegExp[]) =>\n all.reduce((acc, next) => new RegExp(acc?.source + next.source));\n\n/**\n * Create an \"optional\" \"non-capturing\" group with the pattern provided by all\n * arguments merged into a single regex.\n *\n * @remarks\n * pure function\n *\n * @example\n * capture(/a/, /b/, /c/) === /(?:abc)?/\n */\nexport const optional = (...p: RegExp[]) =>\n new RegExp(`(?:${merge(...p).source})?`);\n"]}
|
package/package.json
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@accelint/geo",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "https://github.com/gohypergiant/standard-toolkit"
|
|
9
|
+
},
|
|
6
10
|
"type": "module",
|
|
7
11
|
"files": [
|
|
8
12
|
"dist/**"
|
|
@@ -14,21 +18,23 @@
|
|
|
14
18
|
"types": "./dist/index.d.ts",
|
|
15
19
|
"default": "./dist/index.js"
|
|
16
20
|
},
|
|
17
|
-
"default": "./dist/index.js"
|
|
18
|
-
"module": "./dist/index.js"
|
|
21
|
+
"default": "./dist/index.js"
|
|
19
22
|
},
|
|
20
23
|
"./package.json": "./package.json"
|
|
21
24
|
},
|
|
22
25
|
"devDependencies": {
|
|
23
|
-
"
|
|
24
|
-
"
|
|
26
|
+
"esbuild-plugin-file-path-extensions": "2.1.3",
|
|
27
|
+
"tsup": "8.3.0",
|
|
28
|
+
"vitest": "2.1.3",
|
|
25
29
|
"@accelint/typescript-config": "0.1.2",
|
|
26
|
-
"@accelint/vitest-config": "0.1.
|
|
30
|
+
"@accelint/vitest-config": "0.1.3"
|
|
27
31
|
},
|
|
28
32
|
"dependencies": {
|
|
29
|
-
"
|
|
30
|
-
"@
|
|
31
|
-
"
|
|
33
|
+
"@ngageoint/grid-js": "2.1.0",
|
|
34
|
+
"@ngageoint/mgrs-js": "1.0.0",
|
|
35
|
+
"typescript": "5.6.3",
|
|
36
|
+
"@accelint/math": "0.1.3",
|
|
37
|
+
"@accelint/predicates": "0.2.0"
|
|
32
38
|
},
|
|
33
39
|
"$schema": "https://json.schemastore.org/package",
|
|
34
40
|
"author": "https://hypergiant.com",
|
|
@@ -38,10 +44,10 @@
|
|
|
38
44
|
"sideEffects": false,
|
|
39
45
|
"scripts": {
|
|
40
46
|
"bench": "pnpm vitest bench --run --dir src",
|
|
41
|
-
"build": "pnpm
|
|
47
|
+
"build": "pnpm tsup",
|
|
42
48
|
"dev": "pnpm tsc --watch",
|
|
43
49
|
"index": "pnpm zx ../../scripts/indexer.mjs packages/geo",
|
|
44
50
|
"lint": "pnpm biome lint ./",
|
|
45
|
-
"test": "pnpm vitest --
|
|
51
|
+
"test": "pnpm vitest --dir=src"
|
|
46
52
|
}
|
|
47
53
|
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
// __private-exports
|
|
2
|
-
import { DD_LAT, DD_LON, SEPARATORS, DMS_LAT, DMS_LON } from './regex';
|
|
3
|
-
/**
|
|
4
|
-
* NOTE: these pairs are setup to support different lon/lat ordering
|
|
5
|
-
* 0 = latitude first, 1 = longitude first
|
|
6
|
-
*/
|
|
7
|
-
export const dd = [
|
|
8
|
-
new RegExp(DD_LAT + SEPARATORS + DD_LON, 'i'),
|
|
9
|
-
new RegExp(DD_LON + SEPARATORS + DD_LAT, 'i'),
|
|
10
|
-
];
|
|
11
|
-
export const dms = [
|
|
12
|
-
new RegExp(DMS_LAT + SEPARATORS + DMS_LON, 'i'),
|
|
13
|
-
new RegExp(DMS_LON + SEPARATORS + DMS_LAT, 'i'),
|
|
14
|
-
];
|
|
15
|
-
//# sourceMappingURL=configurations.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"configurations.js","sourceRoot":"","sources":["../../src/coordinates/configurations.ts"],"names":[],"mappings":"AAAA,oBAAoB;AAEpB,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAEvE;;;GAGG;AAEH,MAAM,CAAC,MAAM,EAAE,GAAG;IAChB,IAAI,MAAM,CAAC,MAAM,GAAG,UAAU,GAAG,MAAM,EAAE,GAAG,CAAC;IAC7C,IAAI,MAAM,CAAC,MAAM,GAAG,UAAU,GAAG,MAAM,EAAE,GAAG,CAAC;CACrC,CAAC;AAEX,MAAM,CAAC,MAAM,GAAG,GAAG;IACjB,IAAI,MAAM,CAAC,OAAO,GAAG,UAAU,GAAG,OAAO,EAAE,GAAG,CAAC;IAC/C,IAAI,MAAM,CAAC,OAAO,GAAG,UAAU,GAAG,OAAO,EAAE,GAAG,CAAC;CACvC,CAAC"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* TODOs:
|
|
3
|
-
*
|
|
4
|
-
* - Auto detect lon/lat ordering?
|
|
5
|
-
* - Some tricks we can
|
|
6
|
-
* - Regex for NS as first few chars
|
|
7
|
-
* - Regex for 3 digits
|
|
8
|
-
* - Regex for first digit > 90
|
|
9
|
-
*/
|
|
10
|
-
export { matchDD, matchDMS } from './match';
|
|
11
|
-
export { normalizeDD } from './normalize';
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright 2024 Hypergiant Galactic Systems Inc. All rights reserved.
|
|
3
|
-
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
-
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
-
* of the License at https://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
-
*
|
|
7
|
-
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
-
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
-
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
-
* governing permissions and limitations under the License.
|
|
11
|
-
*/
|
|
12
|
-
/**
|
|
13
|
-
* TODOs:
|
|
14
|
-
*
|
|
15
|
-
* - Auto detect lon/lat ordering?
|
|
16
|
-
* - Some tricks we can
|
|
17
|
-
* - Regex for NS as first few chars
|
|
18
|
-
* - Regex for 3 digits
|
|
19
|
-
* - Regex for first digit > 90
|
|
20
|
-
*/
|
|
21
|
-
export { matchDD, matchDMS } from './match';
|
|
22
|
-
export { normalizeDD } from './normalize';
|
|
23
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/coordinates/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH;;;;;;;;GAQG;AAEH,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC"}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
type Nullish<T> = T | undefined | null | '';
|
|
2
|
-
type PlusMinus = '+' | '-';
|
|
3
|
-
type Directions = 'N' | 'S' | 'E' | 'W';
|
|
4
|
-
type DDMatches = [
|
|
5
|
-
Nullish<Directions>,
|
|
6
|
-
Nullish<PlusMinus>,
|
|
7
|
-
Nullish<string>,
|
|
8
|
-
Nullish<string>,
|
|
9
|
-
Nullish<Directions>,
|
|
10
|
-
Nullish<Directions>,
|
|
11
|
-
Nullish<PlusMinus>,
|
|
12
|
-
Nullish<string>,
|
|
13
|
-
Nullish<string>,
|
|
14
|
-
Nullish<Directions>
|
|
15
|
-
];
|
|
16
|
-
export declare function matchDD(val: unknown): DDMatches;
|
|
17
|
-
type DMSMatches = [
|
|
18
|
-
Nullish<Directions>,
|
|
19
|
-
Nullish<PlusMinus>,
|
|
20
|
-
Nullish<string>,
|
|
21
|
-
Nullish<string>,
|
|
22
|
-
Nullish<string>,
|
|
23
|
-
Nullish<string>,
|
|
24
|
-
Nullish<Directions>,
|
|
25
|
-
Nullish<Directions>,
|
|
26
|
-
Nullish<PlusMinus>,
|
|
27
|
-
Nullish<string>,
|
|
28
|
-
Nullish<string>,
|
|
29
|
-
Nullish<string>,
|
|
30
|
-
Nullish<string>,
|
|
31
|
-
Nullish<Directions>
|
|
32
|
-
];
|
|
33
|
-
export declare function matchDMS(val: unknown): DMSMatches;
|
|
34
|
-
export {};
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright 2024 Hypergiant Galactic Systems Inc. All rights reserved.
|
|
3
|
-
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
-
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
-
* of the License at https://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
-
*
|
|
7
|
-
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
-
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
-
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
-
* governing permissions and limitations under the License.
|
|
11
|
-
*/
|
|
12
|
-
import { dd, dms } from './configurations';
|
|
13
|
-
const ddFallback = Array.from(Array(10), () => '');
|
|
14
|
-
// biome-ignore lint/style/useNamingConvention: <explanation>
|
|
15
|
-
export function matchDD(val) {
|
|
16
|
-
// TODO: lat/lon ordering
|
|
17
|
-
const matches = `${val}`.match(dd[0]);
|
|
18
|
-
if (!matches) {
|
|
19
|
-
return ddFallback;
|
|
20
|
-
}
|
|
21
|
-
// Remove first regex.match entry since it is the input value
|
|
22
|
-
return Array.from(matches).slice(1);
|
|
23
|
-
}
|
|
24
|
-
const dmsFallback = Array.from(Array(14), () => '');
|
|
25
|
-
// biome-ignore lint/style/useNamingConvention: <explanation>
|
|
26
|
-
export function matchDMS(val) {
|
|
27
|
-
// TODO: lat/lon ordering
|
|
28
|
-
const matches = `${val}`.match(dms[0]);
|
|
29
|
-
if (!matches) {
|
|
30
|
-
return dmsFallback;
|
|
31
|
-
}
|
|
32
|
-
// Remove first regex.match entry since it is the input value
|
|
33
|
-
return Array.from(matches).slice(1);
|
|
34
|
-
}
|
|
35
|
-
//# sourceMappingURL=match.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"match.js","sourceRoot":"","sources":["../../src/coordinates/match.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,EAAE,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAC;AAoB3C,MAAM,UAAU,GAAG,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC,CAAC;AAEnD,6DAA6D;AAC7D,MAAM,UAAU,OAAO,CAAC,GAAY;IAClC,yBAAyB;IAEzB,MAAM,OAAO,GAAG,GAAG,GAAG,EAAE,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;IAEtC,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,OAAO,UAAuB,CAAC;IACjC,CAAC;IAED,6DAA6D;IAC7D,OAAO,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,KAAK,CAAC,CAAC,CAAc,CAAC;AACnD,CAAC;AAoBD,MAAM,WAAW,GAAG,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC,CAAC;AAEpD,6DAA6D;AAC7D,MAAM,UAAU,QAAQ,CAAC,GAAY;IACnC,yBAAyB;IAEzB,MAAM,OAAO,GAAG,GAAG,GAAG,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;IAEvC,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,OAAO,WAAyB,CAAC;IACnC,CAAC;IAED,6DAA6D;IAC7D,OAAO,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,KAAK,CAAC,CAAC,CAAe,CAAC;AACpD,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function normalizeDD(val: string): number[];
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright 2024 Hypergiant Galactic Systems Inc. All rights reserved.
|
|
3
|
-
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
-
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
-
* of the License at https://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
-
*
|
|
7
|
-
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
-
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
-
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
-
* governing permissions and limitations under the License.
|
|
11
|
-
*/
|
|
12
|
-
import { toDigits } from '@accelint/converters';
|
|
13
|
-
import { matchDD } from './match';
|
|
14
|
-
import { isPositiveDirection, normalizeDirection, negate } from './utils';
|
|
15
|
-
// biome-ignore lint/style/useNamingConvention: <explanation>
|
|
16
|
-
export function normalizeDD(val) {
|
|
17
|
-
const matches = matchDD(val);
|
|
18
|
-
const latDirection = normalizeDirection(matches[0] || matches[4]);
|
|
19
|
-
const lonDirection = normalizeDirection(matches[5] || matches[9]);
|
|
20
|
-
const latPositive = isPositiveDirection(latDirection, matches[1]);
|
|
21
|
-
const lonPositive = isPositiveDirection(lonDirection, matches[6]);
|
|
22
|
-
const latParsed = toDigits(Number.parseFloat(`${matches[2]}${matches[3]}`), 6);
|
|
23
|
-
const lonParsed = toDigits(Number.parseFloat(`${matches[7]}${matches[8]}`), 6);
|
|
24
|
-
const latValue = latPositive ? latParsed : negate(latParsed);
|
|
25
|
-
const lonValue = lonPositive ? lonParsed : negate(lonParsed);
|
|
26
|
-
return [latValue, lonValue];
|
|
27
|
-
}
|
|
28
|
-
//# sourceMappingURL=normalize.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"normalize.js","sourceRoot":"","sources":["../../src/coordinates/normalize.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAE1E,6DAA6D;AAC7D,MAAM,UAAU,WAAW,CAAC,GAAW;IACrC,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC;IAE7B,MAAM,YAAY,GAAG,kBAAkB,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;IAClE,MAAM,YAAY,GAAG,kBAAkB,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;IAClE,MAAM,WAAW,GAAG,mBAAmB,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;IAClE,MAAM,WAAW,GAAG,mBAAmB,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;IAElE,MAAM,SAAS,GAAG,QAAQ,CACxB,MAAM,CAAC,UAAU,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,EAC/C,CAAC,CACF,CAAC;IAEF,MAAM,SAAS,GAAG,QAAQ,CACxB,MAAM,CAAC,UAAU,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,EAC/C,CAAC,CACF,CAAC;IAEF,MAAM,QAAQ,GAAG,WAAW,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;IAC7D,MAAM,QAAQ,GAAG,WAAW,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;IAE7D,OAAO,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;AAC9B,CAAC"}
|
|
@@ -1,126 +0,0 @@
|
|
|
1
|
-
export declare const SEPARATORS = "[\\s,\\/]*";
|
|
2
|
-
/**
|
|
3
|
-
* @see https://en.wikipedia.org/wiki/ISO_6709
|
|
4
|
-
*
|
|
5
|
-
* Matches common DD format for longitude values.
|
|
6
|
-
*
|
|
7
|
-
* NSEW ± DDD.D NSEW
|
|
8
|
-
*
|
|
9
|
-
* Five capture groups:
|
|
10
|
-
* 1. Optional NSEW
|
|
11
|
-
* 2. Optional +-
|
|
12
|
-
* 3. Degrees
|
|
13
|
-
* 4. Optional Decimals
|
|
14
|
-
* 5. Optional NSEW
|
|
15
|
-
*
|
|
16
|
-
* @example
|
|
17
|
-
* ```markdown
|
|
18
|
-
* 75
|
|
19
|
-
* 75.00417
|
|
20
|
-
* 075.00417
|
|
21
|
-
* -075.00417
|
|
22
|
-
* - 075.00417
|
|
23
|
-
* W075.00417
|
|
24
|
-
* 075.00417W
|
|
25
|
-
* W 075.00417
|
|
26
|
-
* 075.00417 W
|
|
27
|
-
* ```
|
|
28
|
-
*/
|
|
29
|
-
export declare const DD_LON = "([NSEW]?)[\\s]*([-+]?)[\\s]*(\\d{1,3})(\\.\\d*)?[\\s\u00B0]*([NSEW]?)";
|
|
30
|
-
/**
|
|
31
|
-
* @see https://en.wikipedia.org/wiki/ISO_6709
|
|
32
|
-
*
|
|
33
|
-
* Matches common DD format for latitude values.
|
|
34
|
-
*
|
|
35
|
-
* NSEW ± DD.D NSEW
|
|
36
|
-
*
|
|
37
|
-
* Five capture groups:
|
|
38
|
-
* 1. Optional NSEW
|
|
39
|
-
* 2. Optional +-
|
|
40
|
-
* 3. Degrees
|
|
41
|
-
* 4. Optional Decimals
|
|
42
|
-
* 5. Optional NSEW
|
|
43
|
-
*
|
|
44
|
-
* @example
|
|
45
|
-
* ```markdown
|
|
46
|
-
* 40
|
|
47
|
-
* 40.20361
|
|
48
|
-
* +40.20361
|
|
49
|
-
* + 40.20361
|
|
50
|
-
* N40.20361
|
|
51
|
-
* 40.20361N
|
|
52
|
-
* N 40.20361
|
|
53
|
-
* 40.20361 N
|
|
54
|
-
* ```
|
|
55
|
-
*/
|
|
56
|
-
export declare const DD_LAT = "([NSEW]?)[\\s]*([-+]?)[\\s]*(\\d{1,2})(\\.\\d*)?[\\s\u00B0]*([NSEW]?)";
|
|
57
|
-
/**
|
|
58
|
-
* @see https://en.wikipedia.org/wiki/ISO_6709
|
|
59
|
-
*
|
|
60
|
-
* Matches common DMS format for longitude values.
|
|
61
|
-
*
|
|
62
|
-
* Supported delimiters are comma, colon, space, degree, single quote, double quote, and forward slash.
|
|
63
|
-
*
|
|
64
|
-
* NSEW ± DDD DD DD .D|DDD NSEW
|
|
65
|
-
*
|
|
66
|
-
* Seven capture groups:
|
|
67
|
-
* 1. Optional NSEW
|
|
68
|
-
* 2. Optional +-
|
|
69
|
-
* 3. Degrees
|
|
70
|
-
* 4. Minutes
|
|
71
|
-
* 5. Seconds
|
|
72
|
-
* 6. Optional decimal seconds or milliarcseconds
|
|
73
|
-
* 7. Optional NSEW
|
|
74
|
-
*
|
|
75
|
-
* @example
|
|
76
|
-
* ```markdown
|
|
77
|
-
* 403456.45
|
|
78
|
-
* 40 34 56.45
|
|
79
|
-
* 40/34/56.45
|
|
80
|
-
* 40:34:56.45
|
|
81
|
-
* 40°34'56.45
|
|
82
|
-
* 403456
|
|
83
|
-
* 40°34'56"
|
|
84
|
-
* +403456.45
|
|
85
|
-
* W403456.45
|
|
86
|
-
* 403456.45W
|
|
87
|
-
* W 40 34 56.45
|
|
88
|
-
* 40 34 56.45 W
|
|
89
|
-
* ```
|
|
90
|
-
*/
|
|
91
|
-
export declare const DMS_LON = "([NSEW]?)[\\s]*([-+]?)[\\s]*(\\d{1,3})[\\s,:\u00B0'\u2032\"\u2033\\/]*(\\d{2})[\\s,:\u00B0'\u2032\"\u2033\\/]*(\\d{2})[\\s,:\u00B0'\u2032\"\u2033\\/]*(\\.\\d*|\\d{3})?[\\s,:\u00B0'\u2032\"\u2033\\/]*([NSEW]?)";
|
|
92
|
-
/**
|
|
93
|
-
* @see https://en.wikipedia.org/wiki/ISO_6709
|
|
94
|
-
*
|
|
95
|
-
* Matches common DMS format for latitude values.
|
|
96
|
-
*
|
|
97
|
-
* Supported delimiters are comma, colon, space, degree, single quote, double quote, and forward slash.
|
|
98
|
-
*
|
|
99
|
-
* NSEW ± DD DD DD .D|DDD NSEW
|
|
100
|
-
*
|
|
101
|
-
* Seven capture groups:
|
|
102
|
-
* 1. Optional NSEW
|
|
103
|
-
* 2. Optional +-
|
|
104
|
-
* 3. Degrees
|
|
105
|
-
* 4. Minutes
|
|
106
|
-
* 5. Seconds
|
|
107
|
-
* 6. Optional decimal seconds or milliarcseconds
|
|
108
|
-
* 7. Optional NSEW
|
|
109
|
-
*
|
|
110
|
-
* @example
|
|
111
|
-
* ```markdown
|
|
112
|
-
* 403456.45
|
|
113
|
-
* 40 34 56.45
|
|
114
|
-
* 40/34/56.45
|
|
115
|
-
* 40:34:56.45
|
|
116
|
-
* 40°34'56.45
|
|
117
|
-
* 403456
|
|
118
|
-
* 40°34'56"
|
|
119
|
-
* +403456.45
|
|
120
|
-
* N403456.45
|
|
121
|
-
* 403456.45N
|
|
122
|
-
* N 40 34 56.45
|
|
123
|
-
* 40 34 56.45 N
|
|
124
|
-
* ```
|
|
125
|
-
*/
|
|
126
|
-
export declare const DMS_LAT = "([NSEW]?)[\\s]*([-+]?)[\\s]*(\\d{1,2})[\\s,:\u00B0'\u2032\"\u2033\\/]*(\\d{2})[\\s,:\u00B0'\u2032\"\u2033\\/]*(\\d{2})[\\s,:\u00B0'\u2032\"\u2033\\/]*(\\.\\d*|\\d{3})?[\\s,:\u00B0'\u2032\"\u2033\\/]*([NSEW]?)";
|