@ifc-lite/geo 0.0.0-stage → 0.1.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 +294 -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 +17 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +19 -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,177 @@
|
|
|
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
|
+
* Which EPSG codes have a precision datum-shift grid, and the proj4
|
|
6
|
+
* definition that uses it. Loading is `precision-grids.ts`.
|
|
7
|
+
*/
|
|
8
|
+
import { GRIDS } from './precision-grid-data.js';
|
|
9
|
+
// ── Helpers ────────────────────────────────────────────────────────────────
|
|
10
|
+
function gridSpec(grid, projection, region) {
|
|
11
|
+
const { filename, sourceDatums } = grid;
|
|
12
|
+
return {
|
|
13
|
+
key: filename,
|
|
14
|
+
filename,
|
|
15
|
+
sourceDatums,
|
|
16
|
+
proj4: `${projection} +nadgrids=${filename} +units=m +no_defs +type=crs`,
|
|
17
|
+
region,
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
/** Build a UTM proj4 string ready to receive a `+nadgrids=` suffix. */
|
|
21
|
+
function utm(zone, south, ellps) {
|
|
22
|
+
return `+proj=utm +zone=${zone}${south ? ' +south' : ''} +ellps=${ellps}`;
|
|
23
|
+
}
|
|
24
|
+
// ── Coverage table ─────────────────────────────────────────────────────────
|
|
25
|
+
/**
|
|
26
|
+
* EPSG code → grid spec. Order is irrelevant; loaded lazily on first use.
|
|
27
|
+
*
|
|
28
|
+
* Curated to cover every region where `+towgs84` Helmert is ≥ 1 m off and
|
|
29
|
+
* the upstream PROJ project publishes a precision grid. Adding a new
|
|
30
|
+
* entry: pick the EPSG code, find the canonical grid filename in
|
|
31
|
+
* github.com/OSGeo/PROJ-data, write the proj4 string with `+nadgrids=<file>`
|
|
32
|
+
* (replace any existing `+towgs84`).
|
|
33
|
+
*
|
|
34
|
+
* NOT included: ETRS89/WGS84/NAD83-aligned systems (Swiss LV95 2056, French
|
|
35
|
+
* Lambert-93 2154, all WGS84 UTM zones, Web Mercator 3857, ETRS89 UTM
|
|
36
|
+
* zones, etc.) — these do not require a legacy-datum grid. ETRS89, NAD83 and other
|
|
37
|
+
* regional reference frames are approximated as WGS84 here; this is not an
|
|
38
|
+
* epoch-aware, sub-decimeter transformation to modern WGS84 realizations.
|
|
39
|
+
*/
|
|
40
|
+
export const PRECISION_GRIDS = {
|
|
41
|
+
// ────────────────────────────────────────────────────────────────────────
|
|
42
|
+
// EUROPE
|
|
43
|
+
// ────────────────────────────────────────────────────────────────────────
|
|
44
|
+
// Netherlands — RDNAPTRANS™2018 (Kadaster canonical). +towgs84 off ~117 m.
|
|
45
|
+
'28992': gridSpec(GRIDS.rdtrans2018, '+proj=sterea +lat_0=52.15616055555555 +lon_0=5.38763888888889 '
|
|
46
|
+
+ '+k=0.9999079 +x_0=155000 +y_0=463000 +ellps=bessel', 'Netherlands (RDNAPTRANS™2018)'),
|
|
47
|
+
// RD + NAP compound — same horizontal grid.
|
|
48
|
+
'7415': gridSpec(GRIDS.rdtrans2018, '+proj=sterea +lat_0=52.15616055555555 +lon_0=5.38763888888889 '
|
|
49
|
+
+ '+k=0.9999079 +x_0=155000 +y_0=463000 +ellps=bessel', 'Netherlands (RD + NAP compound)'),
|
|
50
|
+
// United Kingdom — OSTN15. +towgs84 off ~1–20 m (worst in Scotland).
|
|
51
|
+
'27700': gridSpec(GRIDS.ostn15, '+proj=tmerc +lat_0=49 +lon_0=-2 +k=0.9996012717 +x_0=400000 +y_0=-100000 +ellps=airy', 'United Kingdom (OSTN15)'),
|
|
52
|
+
// Belgium — BD72 → ETRS89 (IGN/NGI). +towgs84 off ~2–5 m.
|
|
53
|
+
'31370': gridSpec(GRIDS.bd72, '+proj=lcc +lat_0=90 +lon_0=4.36748666666667 +lat_1=51.1666672333333 '
|
|
54
|
+
+ '+lat_2=49.8333339 +x_0=150000.013 +y_0=5400088.438 +ellps=intl', 'Belgium (BD72 → ETRS89)'),
|
|
55
|
+
// Germany — DHDN Gauss-Krüger zones 2-5 via BeTA2007 (AdV).
|
|
56
|
+
// +towgs84 off ~1–3 m. Same grid for all four zones.
|
|
57
|
+
'31466': gridSpec(GRIDS.beta2007, '+proj=tmerc +lat_0=0 +lon_0=6 +k=1 +x_0=2500000 +y_0=0 +ellps=bessel', 'Germany (DHDN GK zone 2)'),
|
|
58
|
+
'31467': gridSpec(GRIDS.beta2007, '+proj=tmerc +lat_0=0 +lon_0=9 +k=1 +x_0=3500000 +y_0=0 +ellps=bessel', 'Germany (DHDN GK zone 3)'),
|
|
59
|
+
'31468': gridSpec(GRIDS.beta2007, '+proj=tmerc +lat_0=0 +lon_0=12 +k=1 +x_0=4500000 +y_0=0 +ellps=bessel', 'Germany (DHDN GK zone 4)'),
|
|
60
|
+
'31469': gridSpec(GRIDS.beta2007, '+proj=tmerc +lat_0=0 +lon_0=15 +k=1 +x_0=5500000 +y_0=0 +ellps=bessel', 'Germany (DHDN GK zone 5)'),
|
|
61
|
+
// Austria — MGI / Austria Lambert via AT_GIS_GRID (BEV). +towgs84 off ~1–3 m.
|
|
62
|
+
'31287': gridSpec(GRIDS.atGisGrid, '+proj=lcc +lat_0=47.5 +lon_0=13.3333333333333 +lat_1=49 +lat_2=46 '
|
|
63
|
+
+ '+x_0=400000 +y_0=400000 +ellps=bessel', 'Austria (MGI Lambert → ETRS89)'),
|
|
64
|
+
// Austria GK zones — same grid.
|
|
65
|
+
'31254': gridSpec(GRIDS.atGisGrid, '+proj=tmerc +lat_0=0 +lon_0=10.3333333333333 +k=1 +x_0=0 +y_0=-5000000 +ellps=bessel', 'Austria (MGI GK M28)'),
|
|
66
|
+
'31255': gridSpec(GRIDS.atGisGrid, '+proj=tmerc +lat_0=0 +lon_0=13.3333333333333 +k=1 +x_0=0 +y_0=-5000000 +ellps=bessel', 'Austria (MGI GK M31)'),
|
|
67
|
+
'31256': gridSpec(GRIDS.atGisGrid, '+proj=tmerc +lat_0=0 +lon_0=16.3333333333333 +k=1 +x_0=0 +y_0=-5000000 +ellps=bessel', 'Austria (MGI GK M34)'),
|
|
68
|
+
// France — NTF Lambert (legacy zones I-IV) via NTF→RGF93 (IGN). +towgs84 off ~1–3 m.
|
|
69
|
+
'27561': gridSpec(GRIDS.ntfR93, '+proj=lcc +lat_1=49.5 +lat_0=49.5 +lon_0=0 +k_0=0.99987734 +x_0=600000 +y_0=200000 +a=6378249.2 +b=6356515 +pm=paris', 'France (NTF Lambert I carto)'),
|
|
70
|
+
'27562': gridSpec(GRIDS.ntfR93, '+proj=lcc +lat_1=46.8 +lat_0=46.8 +lon_0=0 +k_0=0.99987742 +x_0=600000 +y_0=200000 +a=6378249.2 +b=6356515 +pm=paris', 'France (NTF Lambert II carto)'),
|
|
71
|
+
'27563': gridSpec(GRIDS.ntfR93, '+proj=lcc +lat_1=44.1 +lat_0=44.1 +lon_0=0 +k_0=0.99987750 +x_0=600000 +y_0=200000 +a=6378249.2 +b=6356515 +pm=paris', 'France (NTF Lambert III carto)'),
|
|
72
|
+
'27564': gridSpec(GRIDS.ntfR93, '+proj=lcc +lat_1=42.165 +lat_0=42.165 +lon_0=0 +k_0=0.99994471 +x_0=234.358 +y_0=185861.369 +a=6378249.2 +b=6356515 +pm=paris', 'France (NTF Lambert IV carto)'),
|
|
73
|
+
'27571': gridSpec(GRIDS.ntfR93, '+proj=lcc +lat_1=49.5 +lat_0=49.5 +lon_0=0 +k_0=0.99987734 +x_0=600000 +y_0=1200000 +a=6378249.2 +b=6356515 +pm=paris', 'France (NTF Lambert I)'),
|
|
74
|
+
'27572': gridSpec(GRIDS.ntfR93, '+proj=lcc +lat_1=46.8 +lat_0=46.8 +lon_0=0 +k_0=0.99987742 +x_0=600000 +y_0=2200000 +a=6378249.2 +b=6356515 +pm=paris', 'France (NTF Lambert II étendu)'),
|
|
75
|
+
'27573': gridSpec(GRIDS.ntfR93, '+proj=lcc +lat_1=44.1 +lat_0=44.1 +lon_0=0 +k_0=0.99987750 +x_0=600000 +y_0=3200000 +a=6378249.2 +b=6356515 +pm=paris', 'France (NTF Lambert III)'),
|
|
76
|
+
'27574': gridSpec(GRIDS.ntfR93, '+proj=lcc +lat_1=42.165 +lat_0=42.165 +lon_0=0 +k_0=0.99994471 +x_0=234.358 +y_0=4185861.369 +a=6378249.2 +b=6356515 +pm=paris', 'France (NTF Lambert IV)'),
|
|
77
|
+
// Switzerland — CH1903 / LV03 via CHENyx06 (swisstopo). +towgs84 off ~0.5–1 m.
|
|
78
|
+
// (LV95 / EPSG:2056 is already aligned to ETRS89; no grid needed there.)
|
|
79
|
+
'21781': gridSpec(GRIDS.chENyx06, '+proj=somerc +lat_0=46.9524055555556 +lon_0=7.43958333333333 '
|
|
80
|
+
+ '+k_0=1 +x_0=600000 +y_0=200000 +ellps=bessel', 'Switzerland (CH1903 LV03 → ETRS89)'),
|
|
81
|
+
// Czech Republic — S-JTSK / Krovak (EPSG:5514 EN, 2065 SW): NO precision grid.
|
|
82
|
+
// The only Czech file PROJ publishes that we could reference, cz_cuzk_CR-2005.tif,
|
|
83
|
+
// is a VERTICAL_OFFSET grid (ETRS89 → Baltic 1957 height) — a single-band height
|
|
84
|
+
// model, NOT a horizontal datum shift. Pointing `+nadgrids` at it crashes proj4's
|
|
85
|
+
// 2-band horizontal grid reader (`data[1]` undefined), so the load always failed
|
|
86
|
+
// and surfaced a spurious "grid failed" badge. The only Czech HORIZONTAL_OFFSET
|
|
87
|
+
// grid (cz_cuzk_table_-y-x_3_v1710.tif) is S-JTSK → S-JTSK/05, not → ETRS89, so
|
|
88
|
+
// there is no single-grid S-JTSK → ETRS89 path proj4js can consume. We therefore
|
|
89
|
+
// rely on the bundled `+towgs84` (~1 m), which is correct for these CRSs. (#1357)
|
|
90
|
+
// S-JTSK (including EPSG:5513) is also excluded: JTSK03_to_JTSK
|
|
91
|
+
// starts in S-JTSK [JTSK03] and ends in S-JTSK, not ETRS89/WGS84.
|
|
92
|
+
// A horizontal raster alone is insufficient to make it a WGS84 shift. (#7052)
|
|
93
|
+
// Spain — ED50 / UTM zones via SPED2ETV2 (IGN). +towgs84 off ~1–2 m.
|
|
94
|
+
'23029': gridSpec(GRIDS.sped2etv2, utm(29, false, 'intl'), 'Spain (ED50 / UTM 29N)'),
|
|
95
|
+
'23030': gridSpec(GRIDS.sped2etv2, utm(30, false, 'intl'), 'Spain (ED50 / UTM 30N)'),
|
|
96
|
+
'23031': gridSpec(GRIDS.sped2etv2, utm(31, false, 'intl'), 'Spain (ED50 / UTM 31N)'),
|
|
97
|
+
// Portugal — Datum 73 / Modified Portuguese Grid via DGT grid. +towgs84 off ~1–3 m.
|
|
98
|
+
'27493': gridSpec(GRIDS.d73Etrs89, '+proj=tmerc +lat_0=39.6666666666667 +lon_0=-8.13190611111111 +k=1 +x_0=180.598 +y_0=-86.99 +ellps=intl', 'Portugal (Datum 73 / Modified Portuguese Grid)'),
|
|
99
|
+
// EPSG:3763 already uses ETRS89. The Lisbon → ETRS89 grid applies
|
|
100
|
+
// to Lisbon-based CRSs only and must never shift TM06 coordinates. (#7052)
|
|
101
|
+
// ────────────────────────────────────────────────────────────────────────
|
|
102
|
+
// NORTH AMERICA
|
|
103
|
+
// ────────────────────────────────────────────────────────────────────────
|
|
104
|
+
// USA — NAD27 / UTM zones 10N–19N via NADCON5 CONUS (NOAA).
|
|
105
|
+
// +towgs84 typically off by 5–50 m depending on region.
|
|
106
|
+
// This grid ends in NAD83 (1986), approximated as WGS84 like the other
|
|
107
|
+
// regional target frames above; it is not an epoch-aware NAD83 → WGS84 chain.
|
|
108
|
+
'26710': gridSpec(GRIDS.nadcon5Conus, '+proj=utm +zone=10 +ellps=clrk66', 'USA (NAD27 / UTM 10N)'),
|
|
109
|
+
'26711': gridSpec(GRIDS.nadcon5Conus, '+proj=utm +zone=11 +ellps=clrk66', 'USA (NAD27 / UTM 11N)'),
|
|
110
|
+
'26712': gridSpec(GRIDS.nadcon5Conus, '+proj=utm +zone=12 +ellps=clrk66', 'USA (NAD27 / UTM 12N)'),
|
|
111
|
+
'26713': gridSpec(GRIDS.nadcon5Conus, '+proj=utm +zone=13 +ellps=clrk66', 'USA (NAD27 / UTM 13N)'),
|
|
112
|
+
'26714': gridSpec(GRIDS.nadcon5Conus, '+proj=utm +zone=14 +ellps=clrk66', 'USA (NAD27 / UTM 14N)'),
|
|
113
|
+
'26715': gridSpec(GRIDS.nadcon5Conus, '+proj=utm +zone=15 +ellps=clrk66', 'USA (NAD27 / UTM 15N)'),
|
|
114
|
+
'26716': gridSpec(GRIDS.nadcon5Conus, '+proj=utm +zone=16 +ellps=clrk66', 'USA (NAD27 / UTM 16N)'),
|
|
115
|
+
'26717': gridSpec(GRIDS.nadcon5Conus, '+proj=utm +zone=17 +ellps=clrk66', 'USA (NAD27 / UTM 17N)'),
|
|
116
|
+
'26718': gridSpec(GRIDS.nadcon5Conus, '+proj=utm +zone=18 +ellps=clrk66', 'USA (NAD27 / UTM 18N)'),
|
|
117
|
+
'26719': gridSpec(GRIDS.nadcon5Conus, '+proj=utm +zone=19 +ellps=clrk66', 'USA (NAD27 / UTM 19N)'),
|
|
118
|
+
// Alaska NAD27 / UTM zones 3N–9N.
|
|
119
|
+
'26703': gridSpec(GRIDS.nadcon5Alaska, '+proj=utm +zone=3 +ellps=clrk66', 'USA (NAD27 / UTM 3N, Alaska)'),
|
|
120
|
+
'26704': gridSpec(GRIDS.nadcon5Alaska, '+proj=utm +zone=4 +ellps=clrk66', 'USA (NAD27 / UTM 4N, Alaska)'),
|
|
121
|
+
'26705': gridSpec(GRIDS.nadcon5Alaska, '+proj=utm +zone=5 +ellps=clrk66', 'USA (NAD27 / UTM 5N, Alaska)'),
|
|
122
|
+
'26706': gridSpec(GRIDS.nadcon5Alaska, '+proj=utm +zone=6 +ellps=clrk66', 'USA (NAD27 / UTM 6N, Alaska)'),
|
|
123
|
+
'26707': gridSpec(GRIDS.nadcon5Alaska, '+proj=utm +zone=7 +ellps=clrk66', 'USA (NAD27 / UTM 7N, Alaska)'),
|
|
124
|
+
'26708': gridSpec(GRIDS.nadcon5Alaska, '+proj=utm +zone=8 +ellps=clrk66', 'USA (NAD27 / UTM 8N, Alaska)'),
|
|
125
|
+
'26709': gridSpec(GRIDS.nadcon5Alaska, '+proj=utm +zone=9 +ellps=clrk66', 'USA (NAD27 / UTM 9N, Alaska)'),
|
|
126
|
+
// Do not assign Canada's NTv2 grid to guessed EPSG codes: 2007 is
|
|
127
|
+
// St. Vincent 45, and 32007–32022 are US NAD27 State Plane CRSs (US feet),
|
|
128
|
+
// not Canadian UTM zones. Their bundled projections remain authoritative.
|
|
129
|
+
// NAD27 UTM zone codes are 267xx, shared across national borders. (#7052)
|
|
130
|
+
// ────────────────────────────────────────────────────────────────────────
|
|
131
|
+
// OCEANIA
|
|
132
|
+
// ────────────────────────────────────────────────────────────────────────
|
|
133
|
+
// Australia AGD66 / AMG zones 48-58 via A66 grid (ICSM). +towgs84 off ~5 m.
|
|
134
|
+
'20248': gridSpec(GRIDS.agd66, '+proj=utm +zone=48 +south +ellps=aust_SA', 'Australia (AGD66 / AMG 48)'),
|
|
135
|
+
'20249': gridSpec(GRIDS.agd66, '+proj=utm +zone=49 +south +ellps=aust_SA', 'Australia (AGD66 / AMG 49)'),
|
|
136
|
+
'20250': gridSpec(GRIDS.agd66, '+proj=utm +zone=50 +south +ellps=aust_SA', 'Australia (AGD66 / AMG 50)'),
|
|
137
|
+
'20251': gridSpec(GRIDS.agd66, '+proj=utm +zone=51 +south +ellps=aust_SA', 'Australia (AGD66 / AMG 51)'),
|
|
138
|
+
'20252': gridSpec(GRIDS.agd66, '+proj=utm +zone=52 +south +ellps=aust_SA', 'Australia (AGD66 / AMG 52)'),
|
|
139
|
+
'20253': gridSpec(GRIDS.agd66, '+proj=utm +zone=53 +south +ellps=aust_SA', 'Australia (AGD66 / AMG 53)'),
|
|
140
|
+
'20254': gridSpec(GRIDS.agd66, '+proj=utm +zone=54 +south +ellps=aust_SA', 'Australia (AGD66 / AMG 54)'),
|
|
141
|
+
'20255': gridSpec(GRIDS.agd66, '+proj=utm +zone=55 +south +ellps=aust_SA', 'Australia (AGD66 / AMG 55)'),
|
|
142
|
+
'20256': gridSpec(GRIDS.agd66, '+proj=utm +zone=56 +south +ellps=aust_SA', 'Australia (AGD66 / AMG 56)'),
|
|
143
|
+
'20257': gridSpec(GRIDS.agd66, '+proj=utm +zone=57 +south +ellps=aust_SA', 'Australia (AGD66 / AMG 57)'),
|
|
144
|
+
'20258': gridSpec(GRIDS.agd66, '+proj=utm +zone=58 +south +ellps=aust_SA', 'Australia (AGD66 / AMG 58)'),
|
|
145
|
+
// Australia AGD84 / AMG zones 48-58 via 84 grid (ICSM). +towgs84 off ~1–3 m.
|
|
146
|
+
'20348': gridSpec(GRIDS.agd84, '+proj=utm +zone=48 +south +ellps=aust_SA', 'Australia (AGD84 / AMG 48)'),
|
|
147
|
+
'20349': gridSpec(GRIDS.agd84, '+proj=utm +zone=49 +south +ellps=aust_SA', 'Australia (AGD84 / AMG 49)'),
|
|
148
|
+
'20350': gridSpec(GRIDS.agd84, '+proj=utm +zone=50 +south +ellps=aust_SA', 'Australia (AGD84 / AMG 50)'),
|
|
149
|
+
'20351': gridSpec(GRIDS.agd84, '+proj=utm +zone=51 +south +ellps=aust_SA', 'Australia (AGD84 / AMG 51)'),
|
|
150
|
+
'20352': gridSpec(GRIDS.agd84, '+proj=utm +zone=52 +south +ellps=aust_SA', 'Australia (AGD84 / AMG 52)'),
|
|
151
|
+
'20353': gridSpec(GRIDS.agd84, '+proj=utm +zone=53 +south +ellps=aust_SA', 'Australia (AGD84 / AMG 53)'),
|
|
152
|
+
'20354': gridSpec(GRIDS.agd84, '+proj=utm +zone=54 +south +ellps=aust_SA', 'Australia (AGD84 / AMG 54)'),
|
|
153
|
+
'20355': gridSpec(GRIDS.agd84, '+proj=utm +zone=55 +south +ellps=aust_SA', 'Australia (AGD84 / AMG 55)'),
|
|
154
|
+
'20356': gridSpec(GRIDS.agd84, '+proj=utm +zone=56 +south +ellps=aust_SA', 'Australia (AGD84 / AMG 56)'),
|
|
155
|
+
// New Zealand — NZGD49 / NZMG (LINZ). Legacy projection still used for old data.
|
|
156
|
+
'27200': gridSpec(GRIDS.nzgd49, '+proj=nzmg +lat_0=-41 +lon_0=173 +x_0=2510000 +y_0=6023150 +ellps=intl', 'New Zealand (NZGD49 / NZMG)'),
|
|
157
|
+
// ────────────────────────────────────────────────────────────────────────
|
|
158
|
+
// SOUTH AMERICA
|
|
159
|
+
// ────────────────────────────────────────────────────────────────────────
|
|
160
|
+
// Brazil SAD69 / UTM zones via SAD69_003 (IBGE). +towgs84 off ~5–10 m.
|
|
161
|
+
'29101': gridSpec(GRIDS.sad69, '+proj=poly +lat_0=0 +lon_0=-54 +x_0=5000000 +y_0=10000000 +ellps=aust_SA', 'Brazil (SAD69 / Polyconic)'),
|
|
162
|
+
'29168': gridSpec(GRIDS.sad69, '+proj=utm +zone=18 +ellps=aust_SA', 'Brazil (SAD69 / UTM 18N)'),
|
|
163
|
+
'29169': gridSpec(GRIDS.sad69, '+proj=utm +zone=19 +ellps=aust_SA', 'Brazil (SAD69 / UTM 19N)'),
|
|
164
|
+
'29170': gridSpec(GRIDS.sad69, '+proj=utm +zone=20 +ellps=aust_SA', 'Brazil (SAD69 / UTM 20N)'),
|
|
165
|
+
'29171': gridSpec(GRIDS.sad69, '+proj=utm +zone=21 +ellps=aust_SA', 'Brazil (SAD69 / UTM 21N)'),
|
|
166
|
+
'29172': gridSpec(GRIDS.sad69, '+proj=utm +zone=22 +ellps=aust_SA', 'Brazil (SAD69 / UTM 22N)'),
|
|
167
|
+
'29187': gridSpec(GRIDS.sad69, '+proj=utm +zone=17 +south +ellps=aust_SA', 'Brazil (SAD69 / UTM 17S)'),
|
|
168
|
+
'29188': gridSpec(GRIDS.sad69, '+proj=utm +zone=18 +south +ellps=aust_SA', 'Brazil (SAD69 / UTM 18S)'),
|
|
169
|
+
'29189': gridSpec(GRIDS.sad69, '+proj=utm +zone=19 +south +ellps=aust_SA', 'Brazil (SAD69 / UTM 19S)'),
|
|
170
|
+
'29190': gridSpec(GRIDS.sad69, '+proj=utm +zone=20 +south +ellps=aust_SA', 'Brazil (SAD69 / UTM 20S)'),
|
|
171
|
+
'29191': gridSpec(GRIDS.sad69, '+proj=utm +zone=21 +south +ellps=aust_SA', 'Brazil (SAD69 / UTM 21S)'),
|
|
172
|
+
'29192': gridSpec(GRIDS.sad69, '+proj=utm +zone=22 +south +ellps=aust_SA', 'Brazil (SAD69 / UTM 22S)'),
|
|
173
|
+
'29193': gridSpec(GRIDS.sad69, '+proj=utm +zone=23 +south +ellps=aust_SA', 'Brazil (SAD69 / UTM 23S)'),
|
|
174
|
+
'29194': gridSpec(GRIDS.sad69, '+proj=utm +zone=24 +south +ellps=aust_SA', 'Brazil (SAD69 / UTM 24S)'),
|
|
175
|
+
'29195': gridSpec(GRIDS.sad69, '+proj=utm +zone=25 +south +ellps=aust_SA', 'Brazil (SAD69 / UTM 25S)'),
|
|
176
|
+
};
|
|
177
|
+
//# sourceMappingURL=precision-grid-table.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"precision-grid-table.js","sourceRoot":"","sources":["../src/precision-grid-table.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAE/D;;;GAGG;AAEH,OAAO,EAAE,KAAK,EAAqB,MAAM,0BAA0B,CAAC;AAepE,8EAA8E;AAE9E,SAAS,QAAQ,CAAC,IAAkB,EAAE,UAAkB,EAAE,MAAc;IACtE,MAAM,EAAE,QAAQ,EAAE,YAAY,EAAE,GAAG,IAAI,CAAC;IACxC,OAAO;QACL,GAAG,EAAE,QAAQ;QACb,QAAQ;QACR,YAAY;QACZ,KAAK,EAAE,GAAG,UAAU,cAAc,QAAQ,8BAA8B;QACxE,MAAM;KACP,CAAC;AACJ,CAAC;AAED,uEAAuE;AACvE,SAAS,GAAG,CAAC,IAAY,EAAE,KAAc,EAAE,KAAa;IACtD,OAAO,mBAAmB,IAAI,GAAG,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,WAAW,KAAK,EAAE,CAAC;AAC5E,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,CAAC,KAAK,CAAC,KAAK,EAAE,0CAA0C,EAAE,0BAA0B,CAAC;IACtG,OAAO,EAAE,QAAQ,CAAC,KAAK,CAAC,KAAK,EAAE,0CAA0C,EAAE,0BAA0B,CAAC;IACtG,OAAO,EAAE,QAAQ,CAAC,KAAK,CAAC,KAAK,EAAE,0CAA0C,EAAE,0BAA0B,CAAC;CACvG,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { type EngineState } from './engine-state.js';
|
|
2
|
+
export { PRECISION_GRIDS } from './precision-grid-table.js';
|
|
3
|
+
/**
|
|
4
|
+
* proj4's `+nadgrids` reader treats a GeoTIFF as a horizontal-offset grid and
|
|
5
|
+
* reads TWO raster bands (band 0 = latitude offsets, band 1 = longitude
|
|
6
|
+
* offsets). A single-band grid is a vertical / height model (e.g. a
|
|
7
|
+
* quasigeoid) and makes proj4 dereference an undefined second band and throw.
|
|
8
|
+
* Guard against any such mis-registration. (#1357)
|
|
9
|
+
*/
|
|
10
|
+
export declare function isHorizontalOffsetGrid(sampleCount: number): boolean;
|
|
11
|
+
/**
|
|
12
|
+
* If `epsgCode` has a registered precision grid, load it and return the
|
|
13
|
+
* grid-using proj4 definition. Returns `null` when the code isn't in our
|
|
14
|
+
* curated list — caller should fall back to the bundled `+towgs84` def.
|
|
15
|
+
*/
|
|
16
|
+
export declare function resolvePrecisionDef(epsgCode: string, state?: EngineState): Promise<string | null>;
|
|
17
|
+
/**
|
|
18
|
+
* Diagnostic for the default engine — has the grid for this code been loaded successfully?
|
|
19
|
+
* Surfaces in the GeoreferencingPanel so users know they're getting
|
|
20
|
+
* the grid-accurate transform vs. the +towgs84 fallback.
|
|
21
|
+
*/
|
|
22
|
+
export declare function hasLoadedPrecisionGrid(epsgCode: string): boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Diagnostic for the default engine — did the grid load fail (so the badge can stop spinning
|
|
25
|
+
* and show an error state instead of perpetually "loading")?
|
|
26
|
+
*/
|
|
27
|
+
export declare function hasFailedPrecisionGrid(epsgCode: string): boolean;
|
|
28
|
+
//# sourceMappingURL=precision-grids.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"precision-grids.d.ts","sourceRoot":"","sources":["../src/precision-grids.ts"],"names":[],"mappings":"AA+BA,OAAO,EAAsB,KAAK,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEzE,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAI5D;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAEnE;AAgGD;;;;GAIG;AACH,wBAAsB,mBAAmB,CACvC,QAAQ,EAAE,MAAM,EAChB,KAAK,GAAE,WAAkC,GACxC,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAmBxB;AAED;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAIhE;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAIhE"}
|
|
@@ -0,0 +1,173 @@
|
|
|
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
|
+
* Precision datum-shift grids for CRSs where 7-parameter Helmert
|
|
6
|
+
* (`+towgs84`) gives unacceptable error (≥ ~1 m).
|
|
7
|
+
*
|
|
8
|
+
* proj4js can't read NTv2 `.gsb` files directly, but it CAN consume the
|
|
9
|
+
* GeoTIFF datum-shift grids PROJ publishes at cdn.proj.org. The engine's grid
|
|
10
|
+
* loader (`configureCrsLoaders`, `projCdnGridLoader`) fetches the grid on
|
|
11
|
+
* first use of a covered CRS; we parse it with geotiff.js, register via
|
|
12
|
+
* `proj4.nadgrid(key, adapter)`, then call `proj4.defs(...)` with a string
|
|
13
|
+
* that references `+nadgrids={key}`. proj4js resolves the reference and
|
|
14
|
+
* does the datum shift via the loaded grid. Regional frame → WGS84
|
|
15
|
+
* remains an approximation; coordinate epochs are not represented here.
|
|
16
|
+
*
|
|
17
|
+
* Without the grid (no loader installed, fetch failed, CRS not in our list),
|
|
18
|
+
* proj4js falls back to the `+towgs84` baked into the bundled definition,
|
|
19
|
+
* which is the ~1–120 m approximation we had before.
|
|
20
|
+
*
|
|
21
|
+
* Filenames are taken verbatim from the OSGeo/PROJ-data repository (the
|
|
22
|
+
* upstream that publishes to cdn.proj.org). Pattern lifted from
|
|
23
|
+
* bedrock-engineer/ifc-gref under Apache-2.0.
|
|
24
|
+
*/
|
|
25
|
+
import proj4 from 'proj4';
|
|
26
|
+
import { lookupEpsgByCode } from '@ifc-lite/data';
|
|
27
|
+
import { DEPRECATED_SOURCE_DATUMS } from './precision-grid-data.js';
|
|
28
|
+
import { PRECISION_GRIDS } from './precision-grid-table.js';
|
|
29
|
+
import { reportCrsDiagnostic } from './diagnostics.js';
|
|
30
|
+
import { defaultEngineState } from './engine-state.js';
|
|
31
|
+
export { PRECISION_GRIDS } from './precision-grid-table.js';
|
|
32
|
+
// ── Grid loader ────────────────────────────────────────────────────────────
|
|
33
|
+
/**
|
|
34
|
+
* proj4's `+nadgrids` reader treats a GeoTIFF as a horizontal-offset grid and
|
|
35
|
+
* reads TWO raster bands (band 0 = latitude offsets, band 1 = longitude
|
|
36
|
+
* offsets). A single-band grid is a vertical / height model (e.g. a
|
|
37
|
+
* quasigeoid) and makes proj4 dereference an undefined second band and throw.
|
|
38
|
+
* Guard against any such mis-registration. (#1357)
|
|
39
|
+
*/
|
|
40
|
+
export function isHorizontalOffsetGrid(sampleCount) {
|
|
41
|
+
return sampleCount >= 2;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Load a GeoTIFF datum-shift grid into proj4js. Idempotent: subsequent
|
|
45
|
+
* calls for the same key resolve immediately. Concurrent calls dedup.
|
|
46
|
+
* Returns `true` on success, `false` on any failure (caller decides
|
|
47
|
+
* whether to fall back to a `+towgs84`-based proj4 string).
|
|
48
|
+
*/
|
|
49
|
+
async function loadPrecisionGrid(spec, state) {
|
|
50
|
+
const { loaded: loadedGrids, failed: failedGrids, inflight: inflightGrids } = state.grids;
|
|
51
|
+
if (loadedGrids.has(spec.key))
|
|
52
|
+
return true;
|
|
53
|
+
if (failedGrids.has(spec.key))
|
|
54
|
+
return false;
|
|
55
|
+
const loadGridFile = state.loaders.gridFile;
|
|
56
|
+
if (!loadGridFile) {
|
|
57
|
+
// No grid loader installed (the default, and what a test run wants):
|
|
58
|
+
// the caller falls back to the bundled +towgs84.
|
|
59
|
+
failedGrids.add(spec.key);
|
|
60
|
+
return false;
|
|
61
|
+
}
|
|
62
|
+
const pending = inflightGrids.get(spec.key);
|
|
63
|
+
if (pending)
|
|
64
|
+
return pending;
|
|
65
|
+
const promise = (async () => {
|
|
66
|
+
try {
|
|
67
|
+
const buffer = await loadGridFile(spec.filename);
|
|
68
|
+
if (!buffer) {
|
|
69
|
+
// Not available right now: the next resolution asks the loader again,
|
|
70
|
+
// but until then the grid reads as failed rather than still loading.
|
|
71
|
+
state.grids.unavailable.add(spec.key);
|
|
72
|
+
return false;
|
|
73
|
+
}
|
|
74
|
+
const { fromArrayBuffer } = await import('geotiff');
|
|
75
|
+
const tiff = await fromArrayBuffer(buffer);
|
|
76
|
+
// Reject non-horizontal grids before proj4 chokes on the missing second
|
|
77
|
+
// band — turns an opaque proj4 internal TypeError into a clear fallback.
|
|
78
|
+
const probe = await tiff.getImage(0);
|
|
79
|
+
const bands = probe.getSamplesPerPixel();
|
|
80
|
+
if (!isHorizontalOffsetGrid(bands)) {
|
|
81
|
+
reportCrsDiagnostic(`[precision-grid] ${spec.key}: ${bands}-band grid is not a horizontal datum shift; using +towgs84 fallback`);
|
|
82
|
+
failedGrids.add(spec.key);
|
|
83
|
+
return false;
|
|
84
|
+
}
|
|
85
|
+
// proj4js's GeoTIFF nadgrid path expects an older API shape.
|
|
86
|
+
// Bridge to geotiff.js v3 via a Proxy. Adapter borrowed from
|
|
87
|
+
// bedrock-engineer/ifc-gref under Apache-2.0.
|
|
88
|
+
const adapter = {
|
|
89
|
+
getImageCount: () => tiff.getImageCount(),
|
|
90
|
+
getImage: async (index) => {
|
|
91
|
+
// Reuse the band-guard probe for image 0 instead of re-fetching it.
|
|
92
|
+
const img = index === 0 ? probe : await tiff.getImage(index);
|
|
93
|
+
const [scaleX = 0, scaleY = 0] = img.getResolution();
|
|
94
|
+
return new Proxy(img, {
|
|
95
|
+
get(target, property) {
|
|
96
|
+
if (property === 'fileDirectory') {
|
|
97
|
+
return {
|
|
98
|
+
ModelPixelScale: [Math.abs(scaleX), Math.abs(scaleY), 0],
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
const value = target[property];
|
|
102
|
+
return typeof value === 'function'
|
|
103
|
+
? value.bind(target)
|
|
104
|
+
: value;
|
|
105
|
+
},
|
|
106
|
+
});
|
|
107
|
+
},
|
|
108
|
+
};
|
|
109
|
+
// proj4js types lag the actual adapter shape; cast at the boundary.
|
|
110
|
+
const grid = proj4.nadgrid(state.gridName(spec.key), adapter);
|
|
111
|
+
const ready = grid?.ready;
|
|
112
|
+
if (ready && typeof ready.then === 'function') {
|
|
113
|
+
await ready;
|
|
114
|
+
}
|
|
115
|
+
loadedGrids.add(spec.key);
|
|
116
|
+
state.grids.unavailable.delete(spec.key);
|
|
117
|
+
return true;
|
|
118
|
+
}
|
|
119
|
+
catch (error) {
|
|
120
|
+
reportCrsDiagnostic(`[precision-grid] ${spec.key}: load failed, falling back to +towgs84`, error);
|
|
121
|
+
failedGrids.add(spec.key);
|
|
122
|
+
return false;
|
|
123
|
+
}
|
|
124
|
+
})();
|
|
125
|
+
inflightGrids.set(spec.key, promise);
|
|
126
|
+
promise.finally(() => inflightGrids.delete(spec.key));
|
|
127
|
+
return promise;
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* If `epsgCode` has a registered precision grid, load it and return the
|
|
131
|
+
* grid-using proj4 definition. Returns `null` when the code isn't in our
|
|
132
|
+
* curated list — caller should fall back to the bundled `+towgs84` def.
|
|
133
|
+
*/
|
|
134
|
+
export async function resolvePrecisionDef(epsgCode, state = defaultEngineState()) {
|
|
135
|
+
const spec = PRECISION_GRIDS[epsgCode];
|
|
136
|
+
if (!spec)
|
|
137
|
+
return null;
|
|
138
|
+
const incompatibleCodes = state.grids.incompatible;
|
|
139
|
+
const entry = await lookupEpsgByCode(epsgCode);
|
|
140
|
+
const sourceDatum = entry?.datum ?? DEPRECATED_SOURCE_DATUMS[epsgCode];
|
|
141
|
+
if (!sourceDatum || !spec.sourceDatums.includes(sourceDatum)) {
|
|
142
|
+
if (!incompatibleCodes.has(epsgCode)) {
|
|
143
|
+
reportCrsDiagnostic(`[precision-grid] EPSG:${epsgCode}: source datum ${sourceDatum ?? '(unknown)'} is incompatible with ${spec.filename}; keeping bundled definition`);
|
|
144
|
+
}
|
|
145
|
+
incompatibleCodes.add(epsgCode);
|
|
146
|
+
return null;
|
|
147
|
+
}
|
|
148
|
+
incompatibleCodes.delete(epsgCode);
|
|
149
|
+
const loaded = await loadPrecisionGrid(spec, state);
|
|
150
|
+
if (!loaded)
|
|
151
|
+
return null;
|
|
152
|
+
return spec.proj4.replace(`+nadgrids=${spec.key}`, `+nadgrids=${state.gridName(spec.key)}`);
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* Diagnostic for the default engine — has the grid for this code been loaded successfully?
|
|
156
|
+
* Surfaces in the GeoreferencingPanel so users know they're getting
|
|
157
|
+
* the grid-accurate transform vs. the +towgs84 fallback.
|
|
158
|
+
*/
|
|
159
|
+
export function hasLoadedPrecisionGrid(epsgCode) {
|
|
160
|
+
const spec = PRECISION_GRIDS[epsgCode];
|
|
161
|
+
const { incompatible, loaded } = defaultEngineState().grids;
|
|
162
|
+
return spec ? !incompatible.has(epsgCode) && loaded.has(spec.key) : false;
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* Diagnostic for the default engine — did the grid load fail (so the badge can stop spinning
|
|
166
|
+
* and show an error state instead of perpetually "loading")?
|
|
167
|
+
*/
|
|
168
|
+
export function hasFailedPrecisionGrid(epsgCode) {
|
|
169
|
+
const spec = PRECISION_GRIDS[epsgCode];
|
|
170
|
+
const { incompatible, failed, unavailable } = defaultEngineState().grids;
|
|
171
|
+
return spec ? incompatible.has(epsgCode) || failed.has(spec.key) || unavailable.has(spec.key) : false;
|
|
172
|
+
}
|
|
173
|
+
//# sourceMappingURL=precision-grids.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"precision-grids.js","sourceRoot":"","sources":["../src/precision-grids.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAE/D;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAE,wBAAwB,EAAE,MAAM,0BAA0B,CAAC;AACpE,OAAO,EAAE,eAAe,EAA0B,MAAM,2BAA2B,CAAC;AACpF,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,EAAE,kBAAkB,EAAoB,MAAM,mBAAmB,CAAC;AAEzE,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAE5D,8EAA8E;AAE9E;;;;;;GAMG;AACH,MAAM,UAAU,sBAAsB,CAAC,WAAmB;IACxD,OAAO,WAAW,IAAI,CAAC,CAAC;AAC1B,CAAC;AAED;;;;;GAKG;AACH,KAAK,UAAU,iBAAiB,CAAC,IAAuB,EAAE,KAAkB;IAC1E,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,WAAW,EAAE,QAAQ,EAAE,aAAa,EAAE,GAAG,KAAK,CAAC,KAAK,CAAC;IAC1F,IAAI,WAAW,CAAC,GAAG,CAAC,IAAI,CAA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,CAAC,CAAC,YAAY,CAAC,GAAG,CAAC,QAAQ,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,WAAW,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;AACxG,CAAC"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/** Also answers for a WKT definition registered by `resolveWktProjection`. */
|
|
2
|
+
export declare function isGeographicProj4(definition: string): boolean;
|
|
3
|
+
export declare function utmProj4String(zone: string): string | null;
|
|
4
|
+
/**
|
|
5
|
+
* Geometry and spatial references carry projected distances in metres. PROJ
|
|
6
|
+
* strings instead describe the CRS's native output unit (e.g. US survey ft).
|
|
7
|
+
* Override that unit at the metre-coordinate boundary; projection offsets
|
|
8
|
+
* +x_0/+y_0 are already metres and must remain untouched.
|
|
9
|
+
* https://proj.org/en/stable/usage/projections.html#projection-units
|
|
10
|
+
*/
|
|
11
|
+
export declare function projectedDefinitionInMetres(definition: string): string;
|
|
12
|
+
/**
|
|
13
|
+
* Radii of curvature of the WGS84 ellipsoid at a geodetic latitude (degrees):
|
|
14
|
+
* `meridian` (M, north-south) and `primeVertical` (N, east-west; a parallel of
|
|
15
|
+
* latitude has radius N cos(lat)).
|
|
16
|
+
*/
|
|
17
|
+
export declare function wgs84RadiiOfCurvature(latDeg: number): {
|
|
18
|
+
meridian: number;
|
|
19
|
+
primeVertical: number;
|
|
20
|
+
};
|
|
21
|
+
/** Local map-projection factors at one grid point, as seen from the WGS84 ellipsoid. */
|
|
22
|
+
export interface GridPointFactors {
|
|
23
|
+
/** Meridian convergence, radians; same convention as {@link computeGridConvergence}. */
|
|
24
|
+
gamma: number;
|
|
25
|
+
/**
|
|
26
|
+
* Point scale factor k: grid distance / WGS84-ellipsoid distance for a short
|
|
27
|
+
* step (geometric mean of the grid-east and grid-north steps, which agree
|
|
28
|
+
* for a conformal projection). Includes the datum shift's own scale, so it
|
|
29
|
+
* is the factor between grid metres and metres on the ellipsoid Cesium uses.
|
|
30
|
+
*/
|
|
31
|
+
pointScale: number;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Convergence and point scale at a projected point by central differences
|
|
35
|
+
* through proj4, measured with the WGS84 meridian (M) and prime-vertical (N)
|
|
36
|
+
* radii. Works for any projection without per-projection formulae. Throws
|
|
37
|
+
* when proj4 does; returns null for non-finite results.
|
|
38
|
+
*
|
|
39
|
+
* Accuracy: the central difference over +/-10 m leaves a truncation term of
|
|
40
|
+
* order (10 m / R)^2, about 1e-12, and the double-precision round-off on the
|
|
41
|
+
* differenced latitudes is about 1e-10. Both outputs match PROJ to 5e-11 on
|
|
42
|
+
* TM, LCC and Krovak (`__fixtures__/proj-oracle.json`, generated by
|
|
43
|
+
* `scripts/geo/generate-proj-oracle.py`).
|
|
44
|
+
*/
|
|
45
|
+
export declare function computeGridPointFactors(projDef: string, easting: number, northing: number): GridPointFactors | null;
|
|
46
|
+
/**
|
|
47
|
+
* Grid (meridian) convergence at a point in a projected CRS: the angle between
|
|
48
|
+
* grid north (the projected CRS's +N axis) and true north (the geographic ENU
|
|
49
|
+
* +N axis). Returned in radians, counter-clockwise positive, such that the grid
|
|
50
|
+
* frame equals the true-ENU frame rotated by +gamma.
|
|
51
|
+
*
|
|
52
|
+
* WHY THIS EXISTS: `IfcMapConversion` aligns the model to GRID north (its
|
|
53
|
+
* XAxisAbscissa/Ordinate are expressed in the projected grid), but Cesium's
|
|
54
|
+
* `eastNorthUpToFixedFrame()` builds a TRUE-north ENU frame. Feeding the
|
|
55
|
+
* grid-aligned model straight into that frame rotates it by the convergence —
|
|
56
|
+
* up to ~3° for UTM near a zone edge, ~7-8° for oblique projections like
|
|
57
|
+
* Krovak (EPSG:2065, S-JTSK / Czech Republic). See issue #1408.
|
|
58
|
+
*
|
|
59
|
+
* Computed by finite difference through proj4 ({@link computeGridPointFactors})
|
|
60
|
+
* so it works for any projection (TM, LCC, Krovak, ...) without per-projection
|
|
61
|
+
* convergence formulae. A geographic (longlat) def has zero convergence by
|
|
62
|
+
* definition. The step is measured on the WGS84 ellipsoid: the spherical
|
|
63
|
+
* 111320 m/degree it used before turned a 2.2° UTM convergence into an angle
|
|
64
|
+
* off by 1e-4 rad (7.6 mm per 100 m).
|
|
65
|
+
*/
|
|
66
|
+
export declare function computeGridConvergence(projDef: string, easting: number, northing: number, lat: number): number;
|
|
67
|
+
/**
|
|
68
|
+
* {@link computeGridPointFactors} with the placement's guards: a geographic
|
|
69
|
+
* CRS, a point within 0.1° of a pole, or a failed probe read as convergence 0
|
|
70
|
+
* and point scale 1 (the probe failure is logged, see below).
|
|
71
|
+
*/
|
|
72
|
+
export declare function computeGridFrame(projDef: string, easting: number, northing: number, lat: number): GridPointFactors;
|
|
73
|
+
//# sourceMappingURL=proj4-utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"proj4-utils.d.ts","sourceRoot":"","sources":["../src/proj4-utils.ts"],"names":[],"mappings":"AAQA,8EAA8E;AAC9E,wBAAgB,iBAAiB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAG7D;AAED,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAM1D;AAED;;;;;;GAMG;AACH,wBAAgB,2BAA2B,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAItE;AAMD;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,MAAM,GAAG;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,aAAa,EAAE,MAAM,CAAA;CAAE,CAIjG;AAeD,wFAAwF;AACxF,MAAM,WAAW,gBAAgB;IAC/B,wFAAwF;IACxF,KAAK,EAAE,MAAM,CAAC;IACd;;;;;OAKG;IACH,UAAU,EAAE,MAAM,CAAC;CACpB;AAKD;;;;;;;;;;;GAWG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,gBAAgB,GAAG,IAAI,CAkBnH;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAE9G;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,gBAAgB,CAqBlH"}
|