@ifc-lite/geo 0.0.0-stage → 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/LICENSE +373 -0
- package/README.md +301 -2
- package/dist/diagnostics.d.ts +16 -0
- package/dist/diagnostics.d.ts.map +1 -0
- package/dist/diagnostics.js +24 -0
- package/dist/diagnostics.js.map +1 -0
- package/dist/egm96-undulation-data.d.ts +19 -0
- package/dist/egm96-undulation-data.d.ts.map +1 -0
- package/dist/egm96-undulation-data.js +18 -0
- package/dist/egm96-undulation-data.js.map +1 -0
- package/dist/egm96-undulation.d.ts +7 -0
- package/dist/egm96-undulation.d.ts.map +1 -0
- package/dist/egm96-undulation.js +72 -0
- package/dist/egm96-undulation.js.map +1 -0
- package/dist/engine-state.d.ts +62 -0
- package/dist/engine-state.d.ts.map +1 -0
- package/dist/engine-state.js +25 -0
- package/dist/engine-state.js.map +1 -0
- package/dist/index.d.ts +18 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +20 -0
- package/dist/index.js.map +1 -0
- package/dist/loaders.d.ts +56 -0
- package/dist/loaders.d.ts.map +1 -0
- package/dist/loaders.js +73 -0
- package/dist/loaders.js.map +1 -0
- package/dist/map-unit.d.ts +21 -0
- package/dist/map-unit.d.ts.map +1 -0
- package/dist/map-unit.js +29 -0
- package/dist/map-unit.js.map +1 -0
- package/dist/precision-grid-data.d.ts +83 -0
- package/dist/precision-grid-data.d.ts.map +1 -0
- package/dist/precision-grid-data.js +44 -0
- package/dist/precision-grid-data.js.map +1 -0
- package/dist/precision-grid-table.d.ts +29 -0
- package/dist/precision-grid-table.d.ts.map +1 -0
- package/dist/precision-grid-table.js +177 -0
- package/dist/precision-grid-table.js.map +1 -0
- package/dist/precision-grids.d.ts +28 -0
- package/dist/precision-grids.d.ts.map +1 -0
- package/dist/precision-grids.js +173 -0
- package/dist/precision-grids.js.map +1 -0
- package/dist/proj4-utils.d.ts +73 -0
- package/dist/proj4-utils.d.ts.map +1 -0
- package/dist/proj4-utils.js +148 -0
- package/dist/proj4-utils.js.map +1 -0
- package/dist/proj4.d.ts +17 -0
- package/dist/proj4.d.ts.map +1 -0
- package/dist/proj4.js +20 -0
- package/dist/proj4.js.map +1 -0
- package/dist/projected-units.d.ts +17 -0
- package/dist/projected-units.d.ts.map +1 -0
- package/dist/projected-units.js +49 -0
- package/dist/projected-units.js.map +1 -0
- package/dist/reproject-point.d.ts +40 -0
- package/dist/reproject-point.d.ts.map +1 -0
- package/dist/reproject-point.js +88 -0
- package/dist/reproject-point.js.map +1 -0
- package/dist/resolve-projection.d.ts +85 -0
- package/dist/resolve-projection.d.ts.map +1 -0
- package/dist/resolve-projection.js +230 -0
- package/dist/resolve-projection.js.map +1 -0
- package/dist/sanitize-proj4.d.ts +16 -0
- package/dist/sanitize-proj4.d.ts.map +1 -0
- package/dist/sanitize-proj4.js +133 -0
- package/dist/sanitize-proj4.js.map +1 -0
- package/dist/spatial-wkt.d.ts +28 -0
- package/dist/spatial-wkt.d.ts.map +1 -0
- package/dist/spatial-wkt.js +132 -0
- package/dist/spatial-wkt.js.map +1 -0
- package/dist/transformer.d.ts +97 -0
- package/dist/transformer.d.ts.map +1 -0
- package/dist/transformer.js +93 -0
- package/dist/transformer.js.map +1 -0
- package/dist/well-known-crs.d.ts +2 -0
- package/dist/well-known-crs.d.ts.map +1 -0
- package/dist/well-known-crs.js +25 -0
- package/dist/well-known-crs.js.map +1 -0
- package/dist/wkt-parameters.d.ts +25 -0
- package/dist/wkt-parameters.d.ts.map +1 -0
- package/dist/wkt-parameters.js +120 -0
- package/dist/wkt-parameters.js.map +1 -0
- package/dist/wkt-projection.d.ts +60 -0
- package/dist/wkt-projection.d.ts.map +1 -0
- package/dist/wkt-projection.js +174 -0
- package/dist/wkt-projection.js.map +1 -0
- package/dist/wkt.d.ts +7 -0
- package/dist/wkt.d.ts.map +1 -0
- package/dist/wkt.js +10 -0
- package/dist/wkt.js.map +1 -0
- package/package.json +69 -3
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Everything CRS resolution caches, kept per engine so that an engine's
|
|
3
|
+
* loaders decide what it resolves: a definition or grid one engine fetched is
|
|
4
|
+
* never seen by another.
|
|
5
|
+
*
|
|
6
|
+
* The module-level functions (`resolveCrs`, `configureCrsLoaders`, the
|
|
7
|
+
* `@ifc-lite/geo/proj4` entry) use the default engine. `configureCrsLoaders`
|
|
8
|
+
* replaces it with a fresh one, so nothing resolved under the previous
|
|
9
|
+
* loaders survives into the new configuration. `createCrsEngine` makes an
|
|
10
|
+
* engine of its own.
|
|
11
|
+
*/
|
|
12
|
+
import type { CrsLoaders, EpsgDefinitionLoader, GridFileLoader } from './loaders.js';
|
|
13
|
+
/**
|
|
14
|
+
* How the horizontal datum shift to WGS84 is carried out.
|
|
15
|
+
*
|
|
16
|
+
* - `as-defined`: the CRS's own operation is in use: the bundled EPSG
|
|
17
|
+
* parameters, a loaded precision grid, or what the WKT states.
|
|
18
|
+
* - `helmert-approximation`: the CRS needs a datum-shift grid that was not
|
|
19
|
+
* available (no grid loader installed, or the load failed), and a published
|
|
20
|
+
* 7-parameter shift stands in. Expect metre-level differences.
|
|
21
|
+
* - `grid-unavailable`: the CRS needs a grid that is not available and there
|
|
22
|
+
* is no known 7-parameter replacement, so no datum shift is applied.
|
|
23
|
+
* Positions can be tens to hundreds of metres off.
|
|
24
|
+
*/
|
|
25
|
+
export type CrsDatumShift = 'as-defined' | 'helmert-approximation' | 'grid-unavailable';
|
|
26
|
+
/** A proj4 definition together with how its datum shift was obtained. */
|
|
27
|
+
export interface ResolvedDefinition {
|
|
28
|
+
definition: string;
|
|
29
|
+
datumShift: CrsDatumShift;
|
|
30
|
+
}
|
|
31
|
+
interface GridState {
|
|
32
|
+
loaded: Set<string>;
|
|
33
|
+
failed: Set<string>;
|
|
34
|
+
inflight: Map<string, Promise<boolean>>;
|
|
35
|
+
/** The loader's last answer was "not available right now" (`null`); retried on the next resolution. */
|
|
36
|
+
unavailable: Set<string>;
|
|
37
|
+
/** EPSG codes whose datum does not match their listed grid's source. */
|
|
38
|
+
incompatible: Set<string>;
|
|
39
|
+
}
|
|
40
|
+
export interface EngineState {
|
|
41
|
+
readonly loaders: {
|
|
42
|
+
readonly epsgDefinition: EpsgDefinitionLoader | null;
|
|
43
|
+
readonly gridFile: GridFileLoader | null;
|
|
44
|
+
};
|
|
45
|
+
/** EPSG code to resolved definition; `null` is not stored, so a miss can be retried. */
|
|
46
|
+
readonly definitions: Map<string, ResolvedDefinition>;
|
|
47
|
+
readonly grids: GridState;
|
|
48
|
+
/**
|
|
49
|
+
* The name a grid is registered under in proj4's process-wide grid table:
|
|
50
|
+
* the grid's key with a suffix unique to this engine, so the grid bytes one
|
|
51
|
+
* engine's loader returned never replace another engine's registration, nor
|
|
52
|
+
* the grid a transformer from an earlier default engine still uses.
|
|
53
|
+
*/
|
|
54
|
+
gridName(key: string): string;
|
|
55
|
+
}
|
|
56
|
+
export declare function createEngineState(loaders: CrsLoaders): EngineState;
|
|
57
|
+
/** The default engine's state. Read it per call: `configureCrsLoaders` replaces it. */
|
|
58
|
+
export declare function defaultEngineState(): EngineState;
|
|
59
|
+
/** Replace the default engine with a fresh one using `loaders`; returns the previous loaders. */
|
|
60
|
+
export declare function replaceDefaultEngineState(loaders: CrsLoaders): CrsLoaders;
|
|
61
|
+
export {};
|
|
62
|
+
//# sourceMappingURL=engine-state.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"engine-state.d.ts","sourceRoot":"","sources":["../src/engine-state.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,oBAAoB,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAErF;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,aAAa,GAAG,YAAY,GAAG,uBAAuB,GAAG,kBAAkB,CAAC;AAExF,yEAAyE;AACzE,MAAM,WAAW,kBAAkB;IACjC,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,aAAa,CAAC;CAC3B;AAED,UAAU,SAAS;IACjB,MAAM,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IACpB,MAAM,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IACpB,QAAQ,EAAE,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC;IACxC,uGAAuG;IACvG,WAAW,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IACzB,wEAAwE;IACxE,YAAY,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;CAC3B;AAED,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,OAAO,EAAE;QAAE,QAAQ,CAAC,cAAc,EAAE,oBAAoB,GAAG,IAAI,CAAC;QAAC,QAAQ,CAAC,QAAQ,EAAE,cAAc,GAAG,IAAI,CAAA;KAAE,CAAC;IACrH,wFAAwF;IACxF,QAAQ,CAAC,WAAW,EAAE,GAAG,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAAC;IACtD,QAAQ,CAAC,KAAK,EAAE,SAAS,CAAC;IAC1B;;;;;OAKG;IACH,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAC;CAC/B;AAID,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,UAAU,GAAG,WAAW,CAQlE;AAID,uFAAuF;AACvF,wBAAgB,kBAAkB,IAAI,WAAW,CAEhD;AAED,iGAAiG;AACjG,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,UAAU,GAAG,UAAU,CAIzE"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
2
|
+
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
3
|
+
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
|
4
|
+
let engines = 0;
|
|
5
|
+
export function createEngineState(loaders) {
|
|
6
|
+
const suffix = `~engine${++engines}`;
|
|
7
|
+
return {
|
|
8
|
+
loaders: { epsgDefinition: loaders.epsgDefinition ?? null, gridFile: loaders.gridFile ?? null },
|
|
9
|
+
definitions: new Map(),
|
|
10
|
+
grids: { loaded: new Set(), failed: new Set(), inflight: new Map(), unavailable: new Set(), incompatible: new Set() },
|
|
11
|
+
gridName: (key) => `${key}${suffix}`,
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
let defaultState = createEngineState({});
|
|
15
|
+
/** The default engine's state. Read it per call: `configureCrsLoaders` replaces it. */
|
|
16
|
+
export function defaultEngineState() {
|
|
17
|
+
return defaultState;
|
|
18
|
+
}
|
|
19
|
+
/** Replace the default engine with a fresh one using `loaders`; returns the previous loaders. */
|
|
20
|
+
export function replaceDefaultEngineState(loaders) {
|
|
21
|
+
const previous = { ...defaultState.loaders };
|
|
22
|
+
defaultState = createEngineState(loaders);
|
|
23
|
+
return previous;
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=engine-state.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"engine-state.js","sourceRoot":"","sources":["../src/engine-state.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AA4D/D,IAAI,OAAO,GAAG,CAAC,CAAC;AAEhB,MAAM,UAAU,iBAAiB,CAAC,OAAmB;IACnD,MAAM,MAAM,GAAG,UAAU,EAAE,OAAO,EAAE,CAAC;IACrC,OAAO;QACL,OAAO,EAAE,EAAE,cAAc,EAAE,OAAO,CAAC,cAAc,IAAI,IAAI,EAAE,QAAQ,EAAE,OAAO,CAAC,QAAQ,IAAI,IAAI,EAAE;QAC/F,WAAW,EAAE,IAAI,GAAG,EAAE;QACtB,KAAK,EAAE,EAAE,MAAM,EAAE,IAAI,GAAG,EAAE,EAAE,MAAM,EAAE,IAAI,GAAG,EAAE,EAAE,QAAQ,EAAE,IAAI,GAAG,EAAE,EAAE,WAAW,EAAE,IAAI,GAAG,EAAE,EAAE,YAAY,EAAE,IAAI,GAAG,EAAE,EAAE;QACrH,QAAQ,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,GAAG,GAAG,MAAM,EAAE;KACrC,CAAC;AACJ,CAAC;AAED,IAAI,YAAY,GAAG,iBAAiB,CAAC,EAAE,CAAC,CAAC;AAEzC,uFAAuF;AACvF,MAAM,UAAU,kBAAkB;IAChC,OAAO,YAAY,CAAC;AACtB,CAAC;AAED,iGAAiG;AACjG,MAAM,UAAU,yBAAyB,CAAC,OAAmB;IAC3D,MAAM,QAAQ,GAAG,EAAE,GAAG,YAAY,CAAC,OAAO,EAAE,CAAC;IAC7C,YAAY,GAAG,iBAAiB,CAAC,OAAO,CAAC,CAAC;IAC1C,OAAO,QAAQ,CAAC;AAClB,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @ifc-lite/geo — headless CRS engine.
|
|
3
|
+
*
|
|
4
|
+
* Resolve a CRS, convert points to and from WGS84, read grid convergence and
|
|
5
|
+
* point scale, and look up the EGM96 geoid undulation. Works in Node and the
|
|
6
|
+
* browser, and makes no network request unless the host installs a loader.
|
|
7
|
+
*
|
|
8
|
+
* The definition-string functions the viewer builds on are the separate
|
|
9
|
+
* `@ifc-lite/geo/proj4` entry; reading a WKT without resolving it is
|
|
10
|
+
* `@ifc-lite/geo/wkt`.
|
|
11
|
+
*/
|
|
12
|
+
export { createCrsEngine, resolveCrs, type Coordinate, type CrsDatumShift, type CrsEngine, type CrsEngineOptions, type CrsInput, type CrsTransformer, type LinearUnit, } from './transformer.js';
|
|
13
|
+
export type { GridPointFactors } from './proj4-utils.js';
|
|
14
|
+
export { configureCrsLoaders, epsgIoDefinitionLoader, projCdnGridLoader, type CrsLoaders, type EpsgDefinitionLoader, type GridFileLoader, type ProjCdnGridLoaderOptions, } from './loaders.js';
|
|
15
|
+
export { configureCrsDiagnostics, type CrsDiagnosticHandler } from './diagnostics.js';
|
|
16
|
+
export { egm96Undulation } from './egm96-undulation.js';
|
|
17
|
+
export { wellKnownCrsCode } from './well-known-crs.js';
|
|
18
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;GAUG;AAEH,OAAO,EACL,eAAe,EACf,UAAU,EACV,KAAK,UAAU,EACf,KAAK,aAAa,EAClB,KAAK,SAAS,EACd,KAAK,gBAAgB,EACrB,KAAK,QAAQ,EACb,KAAK,cAAc,EACnB,KAAK,UAAU,GAChB,MAAM,kBAAkB,CAAC;AAC1B,YAAY,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACzD,OAAO,EACL,mBAAmB,EACnB,sBAAsB,EACtB,iBAAiB,EACjB,KAAK,UAAU,EACf,KAAK,oBAAoB,EACzB,KAAK,cAAc,EACnB,KAAK,wBAAwB,GAC9B,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,uBAAuB,EAAE,KAAK,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AACtF,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
2
|
+
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
3
|
+
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
|
4
|
+
/**
|
|
5
|
+
* @ifc-lite/geo — headless CRS engine.
|
|
6
|
+
*
|
|
7
|
+
* Resolve a CRS, convert points to and from WGS84, read grid convergence and
|
|
8
|
+
* point scale, and look up the EGM96 geoid undulation. Works in Node and the
|
|
9
|
+
* browser, and makes no network request unless the host installs a loader.
|
|
10
|
+
*
|
|
11
|
+
* The definition-string functions the viewer builds on are the separate
|
|
12
|
+
* `@ifc-lite/geo/proj4` entry; reading a WKT without resolving it is
|
|
13
|
+
* `@ifc-lite/geo/wkt`.
|
|
14
|
+
*/
|
|
15
|
+
export { createCrsEngine, resolveCrs, } from './transformer.js';
|
|
16
|
+
export { configureCrsLoaders, epsgIoDefinitionLoader, projCdnGridLoader, } from './loaders.js';
|
|
17
|
+
export { configureCrsDiagnostics } from './diagnostics.js';
|
|
18
|
+
export { egm96Undulation } from './egm96-undulation.js';
|
|
19
|
+
export { wellKnownCrsCode } from './well-known-crs.js';
|
|
20
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAE/D;;;;;;;;;;GAUG;AAEH,OAAO,EACL,eAAe,EACf,UAAU,GAQX,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EACL,mBAAmB,EACnB,sBAAsB,EACtB,iBAAiB,GAKlB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,uBAAuB,EAA6B,MAAM,kBAAkB,CAAC;AACtF,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Last-resort definition lookup for an EPSG code the bundled index does not
|
|
3
|
+
* carry. Resolves to a proj4 string, or `null` when there is none. A `null`
|
|
4
|
+
* is not cached, so a transient failure can be retried.
|
|
5
|
+
*/
|
|
6
|
+
export type EpsgDefinitionLoader = (epsgCode: string) => Promise<string | null>;
|
|
7
|
+
/**
|
|
8
|
+
* Fetches one datum-shift grid by its PROJ-data filename (for example
|
|
9
|
+
* `ch_swisstopo_CHENyx06_ETRS.tif`) and resolves to the GeoTIFF bytes.
|
|
10
|
+
* `null` means "not available right now": the grid reads as failed
|
|
11
|
+
* (`hasFailedPrecisionGrid`) and the next resolution asks again. A rejection
|
|
12
|
+
* marks the grid failed for the engine's lifetime.
|
|
13
|
+
*/
|
|
14
|
+
export type GridFileLoader = (filename: string) => Promise<ArrayBuffer | null>;
|
|
15
|
+
export interface CrsLoaders {
|
|
16
|
+
/** Absent or `null`: an EPSG code missing from the bundled index does not resolve. */
|
|
17
|
+
epsgDefinition?: EpsgDefinitionLoader | null;
|
|
18
|
+
/** Absent or `null`: no precision grid is loaded; the `+towgs84` approximation is used. */
|
|
19
|
+
gridFile?: GridFileLoader | null;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Install the loaders the default engine (`resolveCrs`, `@ifc-lite/geo/proj4`)
|
|
23
|
+
* may call, replacing both. Returns the previous ones, so a caller that
|
|
24
|
+
* installs temporarily can put them back.
|
|
25
|
+
*
|
|
26
|
+
* This is one configuration per process. It starts the default engine over:
|
|
27
|
+
* definitions and grids resolved under the previous loaders are dropped, so
|
|
28
|
+
* nothing a previous loader returned is used afterwards (a transformer made
|
|
29
|
+
* earlier keeps working with the definition it holds). A host that needs
|
|
30
|
+
* different loaders side by side, such as a server handling several tenants,
|
|
31
|
+
* makes an engine for each with `createCrsEngine`.
|
|
32
|
+
*/
|
|
33
|
+
export declare function configureCrsLoaders(loaders: CrsLoaders): CrsLoaders;
|
|
34
|
+
type FetchLike = (input: string, init?: {
|
|
35
|
+
signal?: AbortSignal;
|
|
36
|
+
}) => Promise<Response>;
|
|
37
|
+
/**
|
|
38
|
+
* {@link EpsgDefinitionLoader} that reads `https://epsg.io/<code>.proj4`.
|
|
39
|
+
* Any failure (offline, HTTP error, a non-proj4 body) reads as `null`.
|
|
40
|
+
*/
|
|
41
|
+
export declare function epsgIoDefinitionLoader(fetchImpl?: FetchLike): EpsgDefinitionLoader;
|
|
42
|
+
export interface ProjCdnGridLoaderOptions {
|
|
43
|
+
fetch?: FetchLike;
|
|
44
|
+
/** Where the PROJ-data files are served from. Default `https://cdn.proj.org`. */
|
|
45
|
+
baseUrl?: string;
|
|
46
|
+
/** Abort the request after this long. Default 15 s. */
|
|
47
|
+
timeoutMs?: number;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* {@link GridFileLoader} that downloads PROJ's GeoTIFF grids from
|
|
51
|
+
* cdn.proj.org. A host that ships or caches the files supplies its own loader
|
|
52
|
+
* (read from disk, an internal mirror) instead.
|
|
53
|
+
*/
|
|
54
|
+
export declare function projCdnGridLoader(options?: ProjCdnGridLoaderOptions): GridFileLoader;
|
|
55
|
+
export {};
|
|
56
|
+
//# sourceMappingURL=loaders.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loaders.d.ts","sourceRoot":"","sources":["../src/loaders.ts"],"names":[],"mappings":"AAiBA;;;;GAIG;AACH,MAAM,MAAM,oBAAoB,GAAG,CAAC,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;AAEhF;;;;;;GAMG;AACH,MAAM,MAAM,cAAc,GAAG,CAAC,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC,WAAW,GAAG,IAAI,CAAC,CAAC;AAE/E,MAAM,WAAW,UAAU;IACzB,sFAAsF;IACtF,cAAc,CAAC,EAAE,oBAAoB,GAAG,IAAI,CAAC;IAC7C,2FAA2F;IAC3F,QAAQ,CAAC,EAAE,cAAc,GAAG,IAAI,CAAC;CAClC;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,UAAU,GAAG,UAAU,CAEnE;AAED,KAAK,SAAS,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE;IAAE,MAAM,CAAC,EAAE,WAAW,CAAA;CAAE,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAC;AAKvF;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,SAAS,GAAE,SAAuB,GAAG,oBAAoB,CAc/F;AAED,MAAM,WAAW,wBAAwB;IACvC,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,iFAAiF;IACjF,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,uDAAuD;IACvD,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,GAAE,wBAA6B,GAAG,cAAc,CAcxF"}
|
package/dist/loaders.js
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
2
|
+
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
3
|
+
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
|
4
|
+
/**
|
|
5
|
+
* The two places the CRS engine can reach the network, as injectable loaders.
|
|
6
|
+
*
|
|
7
|
+
* Nothing here runs unless the host installs it with
|
|
8
|
+
* {@link configureCrsLoaders} or passes it to `createCrsEngine`: with no
|
|
9
|
+
* loaders the engine resolves from the bundled EPSG index, the UTM and name
|
|
10
|
+
* aliases and WKT only, and a CRS that has a precision grid uses its
|
|
11
|
+
* documented `+towgs84` approximation.
|
|
12
|
+
*/
|
|
13
|
+
import { reportCrsDiagnostic } from './diagnostics.js';
|
|
14
|
+
import { replaceDefaultEngineState } from './engine-state.js';
|
|
15
|
+
/**
|
|
16
|
+
* Install the loaders the default engine (`resolveCrs`, `@ifc-lite/geo/proj4`)
|
|
17
|
+
* may call, replacing both. Returns the previous ones, so a caller that
|
|
18
|
+
* installs temporarily can put them back.
|
|
19
|
+
*
|
|
20
|
+
* This is one configuration per process. It starts the default engine over:
|
|
21
|
+
* definitions and grids resolved under the previous loaders are dropped, so
|
|
22
|
+
* nothing a previous loader returned is used afterwards (a transformer made
|
|
23
|
+
* earlier keeps working with the definition it holds). A host that needs
|
|
24
|
+
* different loaders side by side, such as a server handling several tenants,
|
|
25
|
+
* makes an engine for each with `createCrsEngine`.
|
|
26
|
+
*/
|
|
27
|
+
export function configureCrsLoaders(loaders) {
|
|
28
|
+
return replaceDefaultEngineState(loaders);
|
|
29
|
+
}
|
|
30
|
+
/** The host's `fetch`, looked up per call so a later replacement is honoured. */
|
|
31
|
+
const globalFetch = (input, init) => globalThis.fetch(input, init);
|
|
32
|
+
/**
|
|
33
|
+
* {@link EpsgDefinitionLoader} that reads `https://epsg.io/<code>.proj4`.
|
|
34
|
+
* Any failure (offline, HTTP error, a non-proj4 body) reads as `null`.
|
|
35
|
+
*/
|
|
36
|
+
export function epsgIoDefinitionLoader(fetchImpl = globalFetch) {
|
|
37
|
+
return async (epsgCode) => {
|
|
38
|
+
try {
|
|
39
|
+
const resp = await fetchImpl(`https://epsg.io/${epsgCode}.proj4`);
|
|
40
|
+
if (!resp.ok)
|
|
41
|
+
return null;
|
|
42
|
+
const text = (await resp.text()).trim();
|
|
43
|
+
if (!text || text.startsWith('<') || text.startsWith('{') || !text.includes('+')) {
|
|
44
|
+
return null;
|
|
45
|
+
}
|
|
46
|
+
return text;
|
|
47
|
+
}
|
|
48
|
+
catch {
|
|
49
|
+
return null;
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* {@link GridFileLoader} that downloads PROJ's GeoTIFF grids from
|
|
55
|
+
* cdn.proj.org. A host that ships or caches the files supplies its own loader
|
|
56
|
+
* (read from disk, an internal mirror) instead.
|
|
57
|
+
*/
|
|
58
|
+
export function projCdnGridLoader(options = {}) {
|
|
59
|
+
const { fetch: fetchImpl = globalFetch, baseUrl = 'https://cdn.proj.org', timeoutMs = 15_000 } = options;
|
|
60
|
+
return async (filename) => {
|
|
61
|
+
// cdn.proj.org is usually a few hundred ms, but corporate proxies and the
|
|
62
|
+
// occasional CDN hiccup can hang a fetch indefinitely without a signal.
|
|
63
|
+
// Falling back to +towgs84 after the timeout is far better than a
|
|
64
|
+
// perpetual "loading grid" badge.
|
|
65
|
+
const response = await fetchImpl(`${baseUrl}/${filename}`, { signal: AbortSignal.timeout(timeoutMs) });
|
|
66
|
+
if (!response.ok) {
|
|
67
|
+
reportCrsDiagnostic(`[precision-grid] ${filename}: fetch failed (HTTP ${response.status})`);
|
|
68
|
+
return null;
|
|
69
|
+
}
|
|
70
|
+
return response.arrayBuffer();
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
//# sourceMappingURL=loaders.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loaders.js","sourceRoot":"","sources":["../src/loaders.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAE/D;;;;;;;;GAQG;AAEH,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,EAAE,yBAAyB,EAAE,MAAM,mBAAmB,CAAC;AAyB9D;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,mBAAmB,CAAC,OAAmB;IACrD,OAAO,yBAAyB,CAAC,OAAO,CAAC,CAAC;AAC5C,CAAC;AAID,iFAAiF;AACjF,MAAM,WAAW,GAAc,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE,CAAC,UAAU,CAAC,KAAK,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;AAE9E;;;GAGG;AACH,MAAM,UAAU,sBAAsB,CAAC,YAAuB,WAAW;IACvE,OAAO,KAAK,EAAE,QAAQ,EAAE,EAAE;QACxB,IAAI,CAAC;YACH,MAAM,IAAI,GAAG,MAAM,SAAS,CAAC,mBAAmB,QAAQ,QAAQ,CAAC,CAAC;YAClE,IAAI,CAAC,IAAI,CAAC,EAAE;gBAAE,OAAO,IAAI,CAAC;YAC1B,MAAM,IAAI,GAAG,CAAC,MAAM,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;YACxC,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;gBACjF,OAAO,IAAI,CAAC;YACd,CAAC;YACD,OAAO,IAAI,CAAC;QACd,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,IAAI,CAAC;QACd,CAAC;IACH,CAAC,CAAC;AACJ,CAAC;AAUD;;;;GAIG;AACH,MAAM,UAAU,iBAAiB,CAAC,UAAoC,EAAE;IACtE,MAAM,EAAE,KAAK,EAAE,SAAS,GAAG,WAAW,EAAE,OAAO,GAAG,sBAAsB,EAAE,SAAS,GAAG,MAAM,EAAE,GAAG,OAAO,CAAC;IACzG,OAAO,KAAK,EAAE,QAAQ,EAAE,EAAE;QACxB,0EAA0E;QAC1E,wEAAwE;QACxE,kEAAkE;QAClE,kCAAkC;QAClC,MAAM,QAAQ,GAAG,MAAM,SAAS,CAAC,GAAG,OAAO,IAAI,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,WAAW,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC;QACvG,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;YACjB,mBAAmB,CAAC,oBAAoB,QAAQ,wBAAwB,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC;YAC5F,OAAO,IAAI,CAAC;QACd,CAAC;QACD,OAAO,QAAQ,CAAC,WAAW,EAAE,CAAC;IAChC,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Resolve the scale factor converting `IfcMapConversion.eastings/northings/
|
|
3
|
+
* orthogonalHeight` into metres (the unit proj4 expects).
|
|
4
|
+
*
|
|
5
|
+
* IFC4 spec: those offsets are in `IfcProjectedCRS.MapUnit`, falling back to
|
|
6
|
+
* the project's `IfcUnitAssignment` LengthUnit when MapUnit is absent.
|
|
7
|
+
*
|
|
8
|
+
* Real-world practice diverges: Bonsai, IfcOpenShell, and most surveying
|
|
9
|
+
* pipelines emit metre values regardless of the project's length unit because
|
|
10
|
+
* survey CRS offsets come in metres. When MapUnit is absent AND the project
|
|
11
|
+
* unit isn't metres, applying the spec interpretation pushes coords miles
|
|
12
|
+
* outside the CRS's valid range, and projections like RD New / OSGB / Lambert
|
|
13
|
+
* extrapolate to the projection's antipode (e.g. an RD easting of `126500`
|
|
14
|
+
* read as mm = `126.5 m` → South Pacific instead of the Netherlands).
|
|
15
|
+
*
|
|
16
|
+
* Heuristic: when no explicit MapUnit is set, treat the offsets as metres.
|
|
17
|
+
* Files that genuinely use non-metre offsets can set MapUnit explicitly
|
|
18
|
+
* (e.g. `IfcProjectedCRS.MapUnit = MILLIMETRE`) to opt out.
|
|
19
|
+
*/
|
|
20
|
+
export declare function resolveMapUnitToMetreScale(mapUnitScaleFromCrs: number | undefined, lengthUnitScale: number): number;
|
|
21
|
+
//# sourceMappingURL=map-unit.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"map-unit.d.ts","sourceRoot":"","sources":["../src/map-unit.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,0BAA0B,CACxC,mBAAmB,EAAE,MAAM,GAAG,SAAS,EACvC,eAAe,EAAE,MAAM,GACtB,MAAM,CAIR"}
|
package/dist/map-unit.js
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
2
|
+
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
3
|
+
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
|
4
|
+
/**
|
|
5
|
+
* Resolve the scale factor converting `IfcMapConversion.eastings/northings/
|
|
6
|
+
* orthogonalHeight` into metres (the unit proj4 expects).
|
|
7
|
+
*
|
|
8
|
+
* IFC4 spec: those offsets are in `IfcProjectedCRS.MapUnit`, falling back to
|
|
9
|
+
* the project's `IfcUnitAssignment` LengthUnit when MapUnit is absent.
|
|
10
|
+
*
|
|
11
|
+
* Real-world practice diverges: Bonsai, IfcOpenShell, and most surveying
|
|
12
|
+
* pipelines emit metre values regardless of the project's length unit because
|
|
13
|
+
* survey CRS offsets come in metres. When MapUnit is absent AND the project
|
|
14
|
+
* unit isn't metres, applying the spec interpretation pushes coords miles
|
|
15
|
+
* outside the CRS's valid range, and projections like RD New / OSGB / Lambert
|
|
16
|
+
* extrapolate to the projection's antipode (e.g. an RD easting of `126500`
|
|
17
|
+
* read as mm = `126.5 m` → South Pacific instead of the Netherlands).
|
|
18
|
+
*
|
|
19
|
+
* Heuristic: when no explicit MapUnit is set, treat the offsets as metres.
|
|
20
|
+
* Files that genuinely use non-metre offsets can set MapUnit explicitly
|
|
21
|
+
* (e.g. `IfcProjectedCRS.MapUnit = MILLIMETRE`) to opt out.
|
|
22
|
+
*/
|
|
23
|
+
export function resolveMapUnitToMetreScale(mapUnitScaleFromCrs, lengthUnitScale) {
|
|
24
|
+
if (mapUnitScaleFromCrs && mapUnitScaleFromCrs > 0)
|
|
25
|
+
return mapUnitScaleFromCrs;
|
|
26
|
+
void lengthUnitScale; // parameter kept for future spec-strict override
|
|
27
|
+
return 1;
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=map-unit.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"map-unit.js","sourceRoot":"","sources":["../src/map-unit.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAE/D;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,UAAU,0BAA0B,CACxC,mBAAuC,EACvC,eAAuB;IAEvB,IAAI,mBAAmB,IAAI,mBAAmB,GAAG,CAAC;QAAE,OAAO,mBAAmB,CAAC;IAC/E,KAAK,eAAe,CAAC,CAAC,iDAAiD;IACvE,OAAO,CAAC,CAAC;AACX,CAAC"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Source CRS names from PROJ's official grid catalogue:
|
|
3
|
+
* https://cdn.proj.org/files.geojson (source_crs_name / target_crs_name).
|
|
4
|
+
* The comments retain the audited target frames; their WGS84 approximation
|
|
5
|
+
* is documented by precision-grids.ts.
|
|
6
|
+
*
|
|
7
|
+
* Accepted names use the bundled EPSG index's datum spelling. RD is the
|
|
8
|
+
* horizontal component name exposed for the RD + NAP compound CRS; NTF
|
|
9
|
+
* (Paris) differs from NTF only by prime meridian, handled by the projection.
|
|
10
|
+
* Ellipsoid equality alone never establishes datum compatibility.
|
|
11
|
+
*/
|
|
12
|
+
export interface GridMetadata {
|
|
13
|
+
readonly filename: string;
|
|
14
|
+
readonly sourceDatums: readonly string[];
|
|
15
|
+
}
|
|
16
|
+
export declare const GRIDS: {
|
|
17
|
+
readonly rdtrans2018: {
|
|
18
|
+
readonly filename: "nl_nsgi_rdtrans2018.tif";
|
|
19
|
+
readonly sourceDatums: readonly ["Amersfoort", "RD"];
|
|
20
|
+
};
|
|
21
|
+
readonly ostn15: {
|
|
22
|
+
readonly filename: "uk_os_OSTN15_NTv2_OSGBtoETRS.tif";
|
|
23
|
+
readonly sourceDatums: readonly ["OSGB36"];
|
|
24
|
+
};
|
|
25
|
+
readonly bd72: {
|
|
26
|
+
readonly filename: "be_ign_bd72lb72_etrs89lb08.tif";
|
|
27
|
+
readonly sourceDatums: readonly ["BD72"];
|
|
28
|
+
};
|
|
29
|
+
readonly beta2007: {
|
|
30
|
+
readonly filename: "de_adv_BETA2007.tif";
|
|
31
|
+
readonly sourceDatums: readonly ["DHDN"];
|
|
32
|
+
};
|
|
33
|
+
readonly atGisGrid: {
|
|
34
|
+
readonly filename: "at_bev_AT_GIS_GRID.tif";
|
|
35
|
+
readonly sourceDatums: readonly ["MGI"];
|
|
36
|
+
};
|
|
37
|
+
readonly ntfR93: {
|
|
38
|
+
readonly filename: "fr_ign_ntf_r93.tif";
|
|
39
|
+
readonly sourceDatums: readonly ["NTF", "NTF (Paris)"];
|
|
40
|
+
};
|
|
41
|
+
readonly chENyx06: {
|
|
42
|
+
readonly filename: "ch_swisstopo_CHENyx06_ETRS.tif";
|
|
43
|
+
readonly sourceDatums: readonly ["CH1903"];
|
|
44
|
+
};
|
|
45
|
+
readonly sped2etv2: {
|
|
46
|
+
readonly filename: "es_ign_SPED2ETV2.tif";
|
|
47
|
+
readonly sourceDatums: readonly ["ED50"];
|
|
48
|
+
};
|
|
49
|
+
readonly d73Etrs89: {
|
|
50
|
+
readonly filename: "pt_dgt_D73_ETRS89_geo.tif";
|
|
51
|
+
readonly sourceDatums: readonly ["Datum 73"];
|
|
52
|
+
};
|
|
53
|
+
readonly sad69: {
|
|
54
|
+
readonly filename: "br_ibge_SAD69_003.tif";
|
|
55
|
+
readonly sourceDatums: readonly ["SAD69"];
|
|
56
|
+
};
|
|
57
|
+
readonly agd66: {
|
|
58
|
+
readonly filename: "au_icsm_A66_National_13_09_01.tif";
|
|
59
|
+
readonly sourceDatums: readonly ["AGD66"];
|
|
60
|
+
};
|
|
61
|
+
readonly agd84: {
|
|
62
|
+
readonly filename: "au_icsm_National_84_02_07_01.tif";
|
|
63
|
+
readonly sourceDatums: readonly ["AGD84"];
|
|
64
|
+
};
|
|
65
|
+
readonly nzgd49: {
|
|
66
|
+
readonly filename: "nz_linz_nzgd2kgrid0005.tif";
|
|
67
|
+
readonly sourceDatums: readonly ["NZGD49"];
|
|
68
|
+
};
|
|
69
|
+
readonly nadcon5Conus: {
|
|
70
|
+
readonly filename: "us_noaa_nadcon5_nad27_nad83_1986_conus.tif";
|
|
71
|
+
readonly sourceDatums: readonly ["NAD27"];
|
|
72
|
+
};
|
|
73
|
+
readonly nadcon5Alaska: {
|
|
74
|
+
readonly filename: "us_noaa_nadcon5_nad27_nad83_1986_alaska.tif";
|
|
75
|
+
readonly sourceDatums: readonly ["NAD27"];
|
|
76
|
+
};
|
|
77
|
+
};
|
|
78
|
+
/** EPSG-deprecated CRSs omitted by the bundled index, verified in PROJ 9.8.
|
|
79
|
+
* Their independent projection controls are in precision-grids.test.ts.
|
|
80
|
+
* Missing metadata for every other code must fail closed.
|
|
81
|
+
*/
|
|
82
|
+
export declare const DEPRECATED_SOURCE_DATUMS: Readonly<Record<string, string>>;
|
|
83
|
+
//# sourceMappingURL=precision-grid-data.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"precision-grid-data.d.ts","sourceRoot":"","sources":["../src/precision-grid-data.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;GAUG;AACH,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,YAAY,EAAE,SAAS,MAAM,EAAE,CAAC;CAC1C;AAED,eAAO,MAAM,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+ByC,CAAC;AAE5D;;;GAGG;AACH,eAAO,MAAM,wBAAwB,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAGrE,CAAC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
2
|
+
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
3
|
+
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
|
4
|
+
export const GRIDS = {
|
|
5
|
+
// Amersfoort → ETRF2000
|
|
6
|
+
rdtrans2018: { filename: 'nl_nsgi_rdtrans2018.tif', sourceDatums: ['Amersfoort', 'RD'] },
|
|
7
|
+
// OSGB36 → ETRS89
|
|
8
|
+
ostn15: { filename: 'uk_os_OSTN15_NTv2_OSGBtoETRS.tif', sourceDatums: ['OSGB36'] },
|
|
9
|
+
// BD72 → ETRS89
|
|
10
|
+
bd72: { filename: 'be_ign_bd72lb72_etrs89lb08.tif', sourceDatums: ['BD72'] },
|
|
11
|
+
// DHDN → ETRS89
|
|
12
|
+
beta2007: { filename: 'de_adv_BETA2007.tif', sourceDatums: ['DHDN'] },
|
|
13
|
+
// MGI → ETRS89
|
|
14
|
+
atGisGrid: { filename: 'at_bev_AT_GIS_GRID.tif', sourceDatums: ['MGI'] },
|
|
15
|
+
// NTF → ETRS89-FRA [RGF93 v1]
|
|
16
|
+
ntfR93: { filename: 'fr_ign_ntf_r93.tif', sourceDatums: ['NTF', 'NTF (Paris)'] },
|
|
17
|
+
// CH1903 → ETRS89
|
|
18
|
+
chENyx06: { filename: 'ch_swisstopo_CHENyx06_ETRS.tif', sourceDatums: ['CH1903'] },
|
|
19
|
+
// ED50 → ETRS89
|
|
20
|
+
sped2etv2: { filename: 'es_ign_SPED2ETV2.tif', sourceDatums: ['ED50'] },
|
|
21
|
+
// Datum 73 → ETRS89
|
|
22
|
+
d73Etrs89: { filename: 'pt_dgt_D73_ETRS89_geo.tif', sourceDatums: ['Datum 73'] },
|
|
23
|
+
// SAD69 → SIRGAS 2000
|
|
24
|
+
sad69: { filename: 'br_ibge_SAD69_003.tif', sourceDatums: ['SAD69'] },
|
|
25
|
+
// AGD66 → GDA94
|
|
26
|
+
agd66: { filename: 'au_icsm_A66_National_13_09_01.tif', sourceDatums: ['AGD66'] },
|
|
27
|
+
// AGD84 → GDA94
|
|
28
|
+
agd84: { filename: 'au_icsm_National_84_02_07_01.tif', sourceDatums: ['AGD84'] },
|
|
29
|
+
// NZGD49 → NZGD2000
|
|
30
|
+
nzgd49: { filename: 'nz_linz_nzgd2kgrid0005.tif', sourceDatums: ['NZGD49'] },
|
|
31
|
+
// NAD27 → NAD83 (CONUS)
|
|
32
|
+
nadcon5Conus: { filename: 'us_noaa_nadcon5_nad27_nad83_1986_conus.tif', sourceDatums: ['NAD27'] },
|
|
33
|
+
// NAD27 → NAD83 (Alaska)
|
|
34
|
+
nadcon5Alaska: { filename: 'us_noaa_nadcon5_nad27_nad83_1986_alaska.tif', sourceDatums: ['NAD27'] },
|
|
35
|
+
};
|
|
36
|
+
/** EPSG-deprecated CRSs omitted by the bundled index, verified in PROJ 9.8.
|
|
37
|
+
* Their independent projection controls are in precision-grids.test.ts.
|
|
38
|
+
* Missing metadata for every other code must fail closed.
|
|
39
|
+
*/
|
|
40
|
+
export const DEPRECATED_SOURCE_DATUMS = {
|
|
41
|
+
'20248': 'AGD66',
|
|
42
|
+
'20348': 'AGD84',
|
|
43
|
+
};
|
|
44
|
+
//# sourceMappingURL=precision-grid-data.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"precision-grid-data.js","sourceRoot":"","sources":["../src/precision-grid-data.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAkB/D,MAAM,CAAC,MAAM,KAAK,GAAG;IACnB,wBAAwB;IACxB,WAAW,EAAE,EAAE,QAAQ,EAAE,yBAAyB,EAAE,YAAY,EAAE,CAAC,YAAY,EAAE,IAAI,CAAC,EAAE;IACxF,kBAAkB;IAClB,MAAM,EAAE,EAAE,QAAQ,EAAE,kCAAkC,EAAE,YAAY,EAAE,CAAC,QAAQ,CAAC,EAAE;IAClF,gBAAgB;IAChB,IAAI,EAAE,EAAE,QAAQ,EAAE,gCAAgC,EAAE,YAAY,EAAE,CAAC,MAAM,CAAC,EAAE;IAC5E,gBAAgB;IAChB,QAAQ,EAAE,EAAE,QAAQ,EAAE,qBAAqB,EAAE,YAAY,EAAE,CAAC,MAAM,CAAC,EAAE;IACrE,eAAe;IACf,SAAS,EAAE,EAAE,QAAQ,EAAE,wBAAwB,EAAE,YAAY,EAAE,CAAC,KAAK,CAAC,EAAE;IACxE,8BAA8B;IAC9B,MAAM,EAAE,EAAE,QAAQ,EAAE,oBAAoB,EAAE,YAAY,EAAE,CAAC,KAAK,EAAE,aAAa,CAAC,EAAE;IAChF,kBAAkB;IAClB,QAAQ,EAAE,EAAE,QAAQ,EAAE,gCAAgC,EAAE,YAAY,EAAE,CAAC,QAAQ,CAAC,EAAE;IAClF,gBAAgB;IAChB,SAAS,EAAE,EAAE,QAAQ,EAAE,sBAAsB,EAAE,YAAY,EAAE,CAAC,MAAM,CAAC,EAAE;IACvE,oBAAoB;IACpB,SAAS,EAAE,EAAE,QAAQ,EAAE,2BAA2B,EAAE,YAAY,EAAE,CAAC,UAAU,CAAC,EAAE;IAChF,sBAAsB;IACtB,KAAK,EAAE,EAAE,QAAQ,EAAE,uBAAuB,EAAE,YAAY,EAAE,CAAC,OAAO,CAAC,EAAE;IACrE,gBAAgB;IAChB,KAAK,EAAE,EAAE,QAAQ,EAAE,mCAAmC,EAAE,YAAY,EAAE,CAAC,OAAO,CAAC,EAAE;IACjF,gBAAgB;IAChB,KAAK,EAAE,EAAE,QAAQ,EAAE,kCAAkC,EAAE,YAAY,EAAE,CAAC,OAAO,CAAC,EAAE;IAChF,oBAAoB;IACpB,MAAM,EAAE,EAAE,QAAQ,EAAE,4BAA4B,EAAE,YAAY,EAAE,CAAC,QAAQ,CAAC,EAAE;IAC5E,wBAAwB;IACxB,YAAY,EAAE,EAAE,QAAQ,EAAE,4CAA4C,EAAE,YAAY,EAAE,CAAC,OAAO,CAAC,EAAE;IACjG,yBAAyB;IACzB,aAAa,EAAE,EAAE,QAAQ,EAAE,6CAA6C,EAAE,YAAY,EAAE,CAAC,OAAO,CAAC,EAAE;CAC1C,CAAC;AAE5D;;;GAGG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAqC;IACxE,OAAO,EAAE,OAAO;IAChB,OAAO,EAAE,OAAO;CACjB,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export interface PrecisionGridSpec {
|
|
2
|
+
/** Key proj4 references via `+nadgrids={key}` (typically the filename). */
|
|
3
|
+
key: string;
|
|
4
|
+
/** Filename under cdn.proj.org/ */
|
|
5
|
+
filename: string;
|
|
6
|
+
/** Full proj4 string with `+nadgrids` instead of `+towgs84` */
|
|
7
|
+
proj4: string;
|
|
8
|
+
/** EPSG datum names compatible with the upstream grid source CRS. */
|
|
9
|
+
sourceDatums: readonly string[];
|
|
10
|
+
/** Human-readable name for diagnostics */
|
|
11
|
+
region: string;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* EPSG code → grid spec. Order is irrelevant; loaded lazily on first use.
|
|
15
|
+
*
|
|
16
|
+
* Curated to cover every region where `+towgs84` Helmert is ≥ 1 m off and
|
|
17
|
+
* the upstream PROJ project publishes a precision grid. Adding a new
|
|
18
|
+
* entry: pick the EPSG code, find the canonical grid filename in
|
|
19
|
+
* github.com/OSGeo/PROJ-data, write the proj4 string with `+nadgrids=<file>`
|
|
20
|
+
* (replace any existing `+towgs84`).
|
|
21
|
+
*
|
|
22
|
+
* NOT included: ETRS89/WGS84/NAD83-aligned systems (Swiss LV95 2056, French
|
|
23
|
+
* Lambert-93 2154, all WGS84 UTM zones, Web Mercator 3857, ETRS89 UTM
|
|
24
|
+
* zones, etc.) — these do not require a legacy-datum grid. ETRS89, NAD83 and other
|
|
25
|
+
* regional reference frames are approximated as WGS84 here; this is not an
|
|
26
|
+
* epoch-aware, sub-decimeter transformation to modern WGS84 realizations.
|
|
27
|
+
*/
|
|
28
|
+
export declare const PRECISION_GRIDS: Record<string, PrecisionGridSpec>;
|
|
29
|
+
//# sourceMappingURL=precision-grid-table.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"precision-grid-table.d.ts","sourceRoot":"","sources":["../src/precision-grid-table.ts"],"names":[],"mappings":"AAWA,MAAM,WAAW,iBAAiB;IAChC,2EAA2E;IAC3E,GAAG,EAAE,MAAM,CAAC;IACZ,mCAAmC;IACnC,QAAQ,EAAE,MAAM,CAAC;IACjB,+DAA+D;IAC/D,KAAK,EAAE,MAAM,CAAC;IACd,qEAAqE;IACrE,YAAY,EAAE,SAAS,MAAM,EAAE,CAAC;IAChC,0CAA0C;IAC1C,MAAM,EAAE,MAAM,CAAC;CAChB;AAsBD;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,iBAAiB,CA6L7D,CAAC"}
|