@nika-js/onlymap 0.7.0 → 0.7.1
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/CHANGELOG.md +9 -0
- package/dist/{LercDecode.es-CYOgDeVu.js → LercDecode.es-gFG_4xNk.js} +1 -1
- package/dist/{basemap-0rGUZkQT.js → basemap-oVln_CKU.js} +1 -1
- package/dist/{geoparquet-Cau8fzH7.js → geoparquet-CufpN8G1.js} +1 -1
- package/dist/{index-CriPOt1s.js → index--zvhxlLl.js} +2 -2
- package/dist/{index-CpSUZ-J3.js → index-CLe7spTj.js} +1 -1
- package/dist/{index-CxOS31XG.js → index-CnwhAoQ5.js} +4488 -4482
- package/dist/{index-BF3xZe9d.js → index-DEIMxmvY.js} +1 -1
- package/dist/{index-Bt3U7sbb.js → index-EXrBWGX7.js} +1 -1
- package/dist/{lerc-aeqKo4fK.js → lerc-nHFgnN0N.js} +2 -2
- package/dist/onlymap.standalone.js +12950 -12915
- package/dist/onlymapjs.js +1 -1
- package/dist/{raster-D70FrkLt.js → raster-CE4jsgUi.js} +442 -414
- package/dist/{raster-pipeline-A-zvBnKU.js → raster-pipeline-ghFqryqb.js} +38 -36
- package/dist/raster.d.ts +44 -0
- package/dist/version.d.ts +1 -1
- package/dist/{zarr-DmrbmSNx.js → zarr-DjEYckHG.js} +2 -2
- package/llms.txt +2 -2
- package/package.json +1 -1
- package/skills/onlymapjs/SKILL.md +1 -1
- package/skills/onlymapjs/references/syntax.md +3 -3
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { c as
|
|
2
|
-
import { ax as
|
|
3
|
-
import
|
|
4
|
-
function
|
|
1
|
+
import { c as se, t as ze, i as wt, a as Be, s as St, C as Pt, b as bt, F as Ct, A as Lt, d as It, R as fe, e as Gt, p as vt, m as Et, f as Ft, g as At, r as _e, h as jt, j as Rt, k as Ut, l as Mt, n as Ot } from "./raster-pipeline-ghFqryqb.js";
|
|
2
|
+
import { ax as Kt, ay as xt } from "./index-CnwhAoQ5.js";
|
|
3
|
+
import ye from "./index-CW1n5LdO.js";
|
|
4
|
+
function Dt(e, t) {
|
|
5
5
|
const n = e.length / 3, r = new Uint8ClampedArray(n * 4), o = 0, i = n, a = n * 2;
|
|
6
6
|
for (let s = 0; s < n; s++)
|
|
7
7
|
r[4 * s + 0] = e[o + s] >> 8, r[4 * s + 1] = e[i + s] >> 8, r[4 * s + 2] = e[a + s] >> 8, r[4 * s + 3] = 255;
|
|
@@ -15,10 +15,10 @@ var J;
|
|
|
15
15
|
(function(e) {
|
|
16
16
|
e[e.ReducedImage = 1] = "ReducedImage", e[e.Page = 2] = "Page", e[e.Mask = 4] = "Mask";
|
|
17
17
|
})(J || (J = {}));
|
|
18
|
-
var
|
|
18
|
+
var we;
|
|
19
19
|
(function(e) {
|
|
20
20
|
e[e.TopLeft = 1] = "TopLeft", e[e.TopRight = 2] = "TopRight", e[e.BottomRight = 3] = "BottomRight", e[e.BottomLeft = 4] = "BottomLeft", e[e.LeftTop = 5] = "LeftTop", e[e.RightTOP = 6] = "RightTOP", e[e.RightBottom = 7] = "RightBottom", e[e.LeftBottom = 8] = "LeftBottom";
|
|
21
|
-
})(
|
|
21
|
+
})(we || (we = {}));
|
|
22
22
|
var te;
|
|
23
23
|
(function(e) {
|
|
24
24
|
e[e.PixelIsArea = 1] = "PixelIsArea", e[e.PixelIsPoint = 2] = "PixelIsPoint";
|
|
@@ -27,10 +27,10 @@ var O;
|
|
|
27
27
|
(function(e) {
|
|
28
28
|
e[e.Unknown = 0] = "Unknown", e[e.Projected = 1] = "Projected", e[e.Geographic = 2] = "Geographic", e[e.Geocentric = 3] = "Geocentric", e[e.UserDefined = 32767] = "UserDefined";
|
|
29
29
|
})(O || (O = {}));
|
|
30
|
-
var
|
|
30
|
+
var Se;
|
|
31
31
|
(function(e) {
|
|
32
32
|
e[e.Image = 1] = "Image", e[e.ReducedImage = 2] = "ReducedImage", e[e.Page = 3] = "Page";
|
|
33
|
-
})(
|
|
33
|
+
})(Se || (Se = {}));
|
|
34
34
|
var f;
|
|
35
35
|
(function(e) {
|
|
36
36
|
e[e.None = 1] = "None", e[e.Ccittrle = 2] = "Ccittrle", e[e.CcittT4 = 3] = "CcittT4", e[e.CcittT6 = 4] = "CcittT6", e[e.Lzw = 5] = "Lzw", e[e.Jpeg6 = 6] = "Jpeg6", e[e.Jpeg = 7] = "Jpeg", e[e.DeflateOther = 8] = "DeflateOther", e[e.T85 = 9] = "T85", e[e.T43 = 10] = "T43", e[e.Next = 32766] = "Next", e[e.Ccittrlew = 32771] = "Ccittrlew", e[e.PackBits = 32773] = "PackBits", e[e.ThunderScan = 32809] = "ThunderScan", e[e.It8ctpad = 32895] = "It8ctpad", e[e.It8lw = 32896] = "It8lw", e[e.It8mp = 32897] = "It8mp", e[e.It8bl = 32898] = "It8bl", e[e.PixarFilm = 32908] = "PixarFilm", e[e.PixarLog = 32909] = "PixarLog", e[e.Deflate = 32946] = "Deflate", e[e.Dcs = 32947] = "Dcs", e[e.Jbig = 34661] = "Jbig", e[e.SgiLog = 34676] = "SgiLog", e[e.SgiLog24 = 34677] = "SgiLog24", e[e.Jp2000 = 34712] = "Jp2000", e[e.Lerc = 34887] = "Lerc", e[e.Lzma = 34925] = "Lzma", e[e.Zstd = 5e4] = "Zstd", e[e.Webp = 50001] = "Webp", e[e.JpegXl = 50002] = "JpegXl", e[e.JpegXlDng17 = 52546] = "JpegXlDng17";
|
|
@@ -59,15 +59,15 @@ var m;
|
|
|
59
59
|
(function(e) {
|
|
60
60
|
e[e.GTModelTypeGeoKey = 1024] = "GTModelTypeGeoKey", e[e.GTRasterTypeGeoKey = 1025] = "GTRasterTypeGeoKey", e[e.GTCitationGeoKey = 1026] = "GTCitationGeoKey", e[e.GeodeticCRSGeoKey = 2048] = "GeodeticCRSGeoKey", e[e.GeodeticCitationGeoKey = 2049] = "GeodeticCitationGeoKey", e[e.GeodeticDatumGeoKey = 2050] = "GeodeticDatumGeoKey", e[e.PrimeMeridianGeoKey = 2051] = "PrimeMeridianGeoKey", e[e.GeogLinearUnitsGeoKey = 2052] = "GeogLinearUnitsGeoKey", e[e.GeogLinearUnitSizeGeoKey = 2053] = "GeogLinearUnitSizeGeoKey", e[e.GeogAngularUnitsGeoKey = 2054] = "GeogAngularUnitsGeoKey", e[e.GeogAngularUnitSizeGeoKey = 2055] = "GeogAngularUnitSizeGeoKey", e[e.EllipsoidGeoKey = 2056] = "EllipsoidGeoKey", e[e.EllipsoidSemiMajorAxisGeoKey = 2057] = "EllipsoidSemiMajorAxisGeoKey", e[e.EllipsoidSemiMinorAxisGeoKey = 2058] = "EllipsoidSemiMinorAxisGeoKey", e[e.EllipsoidInvFlatteningGeoKey = 2059] = "EllipsoidInvFlatteningGeoKey", e[e.PrimeMeridianLongitudeGeoKey = 2061] = "PrimeMeridianLongitudeGeoKey", e[e.GeogTOWGS84GeoKey = 2062] = "GeogTOWGS84GeoKey", e[e.GeogAzimuthUnitsGeoKey = 2060] = "GeogAzimuthUnitsGeoKey", e[e.ProjectedCRSGeoKey = 3072] = "ProjectedCRSGeoKey", e[e.ProjectedCitationGeoKey = 3073] = "ProjectedCitationGeoKey", e[e.ProjectionGeoKey = 3074] = "ProjectionGeoKey", e[e.ProjMethodGeoKey = 3075] = "ProjMethodGeoKey", e[e.ProjLinearUnitsGeoKey = 3076] = "ProjLinearUnitsGeoKey", e[e.ProjLinearUnitSizeGeoKey = 3077] = "ProjLinearUnitSizeGeoKey", e[e.ProjStdParallel1GeoKey = 3078] = "ProjStdParallel1GeoKey", e[e.ProjStdParallel2GeoKey = 3079] = "ProjStdParallel2GeoKey", e[e.ProjNatOriginLongGeoKey = 3080] = "ProjNatOriginLongGeoKey", e[e.ProjNatOriginLatGeoKey = 3081] = "ProjNatOriginLatGeoKey", e[e.ProjFalseEastingGeoKey = 3082] = "ProjFalseEastingGeoKey", e[e.ProjFalseNorthingGeoKey = 3083] = "ProjFalseNorthingGeoKey", e[e.ProjFalseOriginLongGeoKey = 3084] = "ProjFalseOriginLongGeoKey", e[e.ProjFalseOriginLatGeoKey = 3085] = "ProjFalseOriginLatGeoKey", e[e.ProjFalseOriginEastingGeoKey = 3086] = "ProjFalseOriginEastingGeoKey", e[e.ProjFalseOriginNorthingGeoKey = 3087] = "ProjFalseOriginNorthingGeoKey", e[e.ProjCenterLongGeoKey = 3088] = "ProjCenterLongGeoKey", e[e.ProjCenterLatGeoKey = 3089] = "ProjCenterLatGeoKey", e[e.ProjCenterEastingGeoKey = 3090] = "ProjCenterEastingGeoKey", e[e.ProjCenterNorthingGeoKey = 3091] = "ProjCenterNorthingGeoKey", e[e.ProjScaleAtNatOriginGeoKey = 3092] = "ProjScaleAtNatOriginGeoKey", e[e.ProjScaleAtCenterGeoKey = 3093] = "ProjScaleAtCenterGeoKey", e[e.ProjAzimuthAngleGeoKey = 3094] = "ProjAzimuthAngleGeoKey", e[e.ProjStraightVertPoleLongGeoKey = 3095] = "ProjStraightVertPoleLongGeoKey", e[e.ProjRectifiedGridAngleGeoKey = 3096] = "ProjRectifiedGridAngleGeoKey", e[e.VerticalGeoKey = 4096] = "VerticalGeoKey", e[e.VerticalCitationGeoKey = 4097] = "VerticalCitationGeoKey", e[e.VerticalDatumGeoKey = 4098] = "VerticalDatumGeoKey", e[e.VerticalUnitsGeoKey = 4099] = "VerticalUnitsGeoKey";
|
|
61
61
|
})(m || (m = {}));
|
|
62
|
-
var
|
|
62
|
+
var Pe;
|
|
63
63
|
(function(e) {
|
|
64
64
|
e[e.Radian = 9101] = "Radian", e[e.Degree = 9102] = "Degree", e[e.ArcMinute = 9103] = "ArcMinute", e[e.ArcDegree = 9104] = "ArcDegree", e[e.Grad = 9105] = "Grad", e[e.Gon = 9106] = "Gon", e[e.Dms = 9107] = "Dms";
|
|
65
|
-
})(
|
|
66
|
-
var
|
|
65
|
+
})(Pe || (Pe = {}));
|
|
66
|
+
var be;
|
|
67
67
|
(function(e) {
|
|
68
68
|
e[e.Metre = 9001] = "Metre", e[e.Foot = 9002] = "Foot", e[e.FootUsSurvey = 9003] = "FootUsSurvey", e[e.FootModifiedAmerican = 9004] = "FootModifiedAmerican", e[e.FootClarke = 9005] = "FootClarke", e[e.FootIndian = 9006] = "FootIndian", e[e.Link = 9007] = "Link", e[e.LinkBenoit = 9008] = "LinkBenoit", e[e.LinkSears = 9009] = "LinkSears", e[e.ChainBenoit = 9010] = "ChainBenoit", e[e.ChainSears = 9011] = "ChainSears", e[e.YardSears = 9012] = "YardSears", e[e.YardIndian = 9013] = "YardIndian", e[e.Fathom = 9014] = "Fathom", e[e.MileInternationalNautical = 9015] = "MileInternationalNautical";
|
|
69
|
-
})(
|
|
70
|
-
const
|
|
69
|
+
})(be || (be = {}));
|
|
70
|
+
const Nt = {
|
|
71
71
|
[d.TileByteCounts]: !0,
|
|
72
72
|
[d.TileOffsets]: !0,
|
|
73
73
|
[d.StripOffsets]: !0,
|
|
@@ -77,46 +77,46 @@ const Dt = {
|
|
|
77
77
|
[d.GeoKeyDirectory]: !0,
|
|
78
78
|
[d.GeoDoubleParams]: !0
|
|
79
79
|
};
|
|
80
|
-
var
|
|
80
|
+
var P;
|
|
81
81
|
(function(e) {
|
|
82
82
|
e.None = "application/octet-stream", e.Jbig = "image/jbig", e.Dcs = "image/x-kodak-dcs", e.PackBits = "application/packbits", e.Jpeg = "image/jpeg", e.Jp2000 = "image/jp2", e.JpegXl = "image/jpegxl", e.Webp = "image/webp", e.Zstd = "application/zstd", e.Lzw = "application/lzw", e.Deflate = "application/deflate", e.Lerc = "application/lerc", e.Lzma = "application/x-lzma";
|
|
83
|
-
})(
|
|
84
|
-
const
|
|
85
|
-
[f.None]:
|
|
86
|
-
[f.Lzw]:
|
|
87
|
-
[f.Jpeg6]:
|
|
88
|
-
[f.Jpeg]:
|
|
89
|
-
[f.DeflateOther]:
|
|
90
|
-
[f.Deflate]:
|
|
91
|
-
[f.Lerc]:
|
|
92
|
-
[f.Lzma]:
|
|
93
|
-
[f.Jp2000]:
|
|
94
|
-
[f.Zstd]:
|
|
95
|
-
[f.Webp]:
|
|
96
|
-
[f.JpegXl]:
|
|
97
|
-
[f.Ccittrle]:
|
|
98
|
-
[f.CcittT4]:
|
|
99
|
-
[f.CcittT6]:
|
|
100
|
-
[f.T85]:
|
|
101
|
-
[f.T43]:
|
|
102
|
-
[f.Next]:
|
|
103
|
-
[f.Ccittrlew]:
|
|
104
|
-
[f.PackBits]:
|
|
105
|
-
[f.ThunderScan]:
|
|
106
|
-
[f.It8ctpad]:
|
|
107
|
-
[f.It8lw]:
|
|
108
|
-
[f.It8mp]:
|
|
109
|
-
[f.It8bl]:
|
|
110
|
-
[f.PixarFilm]:
|
|
111
|
-
[f.PixarLog]:
|
|
112
|
-
[f.Dcs]:
|
|
113
|
-
[f.Jbig]:
|
|
114
|
-
[f.SgiLog]:
|
|
115
|
-
[f.SgiLog24]:
|
|
116
|
-
[f.JpegXlDng17]:
|
|
83
|
+
})(P || (P = {}));
|
|
84
|
+
const $e = {
|
|
85
|
+
[f.None]: P.None,
|
|
86
|
+
[f.Lzw]: P.Lzw,
|
|
87
|
+
[f.Jpeg6]: P.Jpeg,
|
|
88
|
+
[f.Jpeg]: P.Jpeg,
|
|
89
|
+
[f.DeflateOther]: P.Deflate,
|
|
90
|
+
[f.Deflate]: P.Deflate,
|
|
91
|
+
[f.Lerc]: P.Lerc,
|
|
92
|
+
[f.Lzma]: P.Lzma,
|
|
93
|
+
[f.Jp2000]: P.Jp2000,
|
|
94
|
+
[f.Zstd]: P.Zstd,
|
|
95
|
+
[f.Webp]: P.Webp,
|
|
96
|
+
[f.JpegXl]: P.JpegXl,
|
|
97
|
+
[f.Ccittrle]: P.None,
|
|
98
|
+
[f.CcittT4]: P.None,
|
|
99
|
+
[f.CcittT6]: P.None,
|
|
100
|
+
[f.T85]: P.Jbig,
|
|
101
|
+
[f.T43]: P.Jbig,
|
|
102
|
+
[f.Next]: P.None,
|
|
103
|
+
[f.Ccittrlew]: P.None,
|
|
104
|
+
[f.PackBits]: P.PackBits,
|
|
105
|
+
[f.ThunderScan]: P.None,
|
|
106
|
+
[f.It8ctpad]: P.None,
|
|
107
|
+
[f.It8lw]: P.None,
|
|
108
|
+
[f.It8mp]: P.None,
|
|
109
|
+
[f.It8bl]: P.None,
|
|
110
|
+
[f.PixarFilm]: P.None,
|
|
111
|
+
[f.PixarLog]: P.None,
|
|
112
|
+
[f.Dcs]: P.Dcs,
|
|
113
|
+
[f.Jbig]: P.Jbig,
|
|
114
|
+
[f.SgiLog]: P.None,
|
|
115
|
+
[f.SgiLog24]: P.None,
|
|
116
|
+
[f.JpegXlDng17]: P.JpegXl
|
|
117
117
|
};
|
|
118
|
-
function
|
|
119
|
-
return e == null ? null :
|
|
118
|
+
function zt(e) {
|
|
119
|
+
return e == null ? null : $e[e];
|
|
120
120
|
}
|
|
121
121
|
var w;
|
|
122
122
|
(function(e) {
|
|
@@ -152,17 +152,17 @@ function N(e) {
|
|
|
152
152
|
throw new Error(`Invalid fieldType ${String(e)}`);
|
|
153
153
|
}
|
|
154
154
|
}
|
|
155
|
-
var
|
|
155
|
+
var Ce;
|
|
156
156
|
(function(e) {
|
|
157
157
|
e[e.Double = 8] = "Double", e[e.Float32 = 4] = "Float32";
|
|
158
|
-
})(
|
|
158
|
+
})(Ce || (Ce = {}));
|
|
159
159
|
var I;
|
|
160
160
|
(function(e) {
|
|
161
161
|
e[e.UInt64 = 8] = "UInt64", e[e.UInt32 = 4] = "UInt32", e[e.UInt16 = 2] = "UInt16", e[e.UInt8 = 1] = "UInt8";
|
|
162
162
|
})(I || (I = {}));
|
|
163
|
-
const
|
|
164
|
-
function
|
|
165
|
-
const r = e.getUint32(t, n), o = e.getUint32(t + 4, n), i = n ? r +
|
|
163
|
+
const Le = 2 ** 32;
|
|
164
|
+
function ke(e, t, n) {
|
|
165
|
+
const r = e.getUint32(t, n), o = e.getUint32(t + 4, n), i = n ? r + Le * o : Le * r + o;
|
|
166
166
|
if (!Number.isSafeInteger(i))
|
|
167
167
|
throw new Error(i + " exceeds MAX_SAFE_INTEGER. Precision may is lost");
|
|
168
168
|
return i;
|
|
@@ -176,16 +176,16 @@ function K(e, t, n, r) {
|
|
|
176
176
|
case I.UInt32:
|
|
177
177
|
return e.getUint32(t, r);
|
|
178
178
|
case I.UInt64:
|
|
179
|
-
return
|
|
179
|
+
return ke(e, t, r);
|
|
180
180
|
}
|
|
181
181
|
}
|
|
182
182
|
function X(e, t, n) {
|
|
183
183
|
return !(t < e.sourceOffset || e.sourceOffset + e.byteLength < t + n);
|
|
184
184
|
}
|
|
185
|
-
const
|
|
186
|
-
|
|
187
|
-
const
|
|
188
|
-
function
|
|
185
|
+
const We = new ArrayBuffer(4), Bt = new Uint32Array(We), _t = new Uint8Array(We);
|
|
186
|
+
Bt[0] = 1;
|
|
187
|
+
const Ie = _t[0] === 1;
|
|
188
|
+
function Ge(e, t, n, r) {
|
|
189
189
|
switch (e) {
|
|
190
190
|
case w.Ascii:
|
|
191
191
|
return String.fromCharCode(t.getUint8(n));
|
|
@@ -212,43 +212,43 @@ function Ie(e, t, n, r) {
|
|
|
212
212
|
case w.Float32:
|
|
213
213
|
return t.getFloat32(n, r);
|
|
214
214
|
case w.Uint64:
|
|
215
|
-
return
|
|
215
|
+
return ke(t, n, r);
|
|
216
216
|
default:
|
|
217
217
|
throw new Error(`Unknown read type "${e}" "${w[e]}"`);
|
|
218
218
|
}
|
|
219
219
|
}
|
|
220
|
-
function
|
|
220
|
+
function Je(e, t, n, r, o) {
|
|
221
221
|
switch (o) {
|
|
222
222
|
case w.Uint8:
|
|
223
223
|
return new Uint8Array(t.buffer.slice(t.byteOffset + n, t.byteOffset + n + r));
|
|
224
224
|
case w.Uint16:
|
|
225
|
-
return e.isLittleEndian !==
|
|
225
|
+
return e.isLittleEndian !== Ie ? null : new Uint16Array(t.buffer.slice(t.byteOffset + n, t.byteOffset + n + r));
|
|
226
226
|
case w.Uint32:
|
|
227
|
-
return e.isLittleEndian !==
|
|
227
|
+
return e.isLittleEndian !== Ie ? null : new Uint32Array(t.buffer.slice(t.byteOffset + n, t.byteOffset + n + r));
|
|
228
228
|
}
|
|
229
229
|
return null;
|
|
230
230
|
}
|
|
231
231
|
function D(e, t, n, r, o, i) {
|
|
232
232
|
const a = N(o), s = i * a;
|
|
233
233
|
if (i === 1) {
|
|
234
|
-
const c =
|
|
235
|
-
return t &&
|
|
234
|
+
const c = Ge(o, n, r, e.isLittleEndian);
|
|
235
|
+
return t && Nt[t] ? [c] : c;
|
|
236
236
|
}
|
|
237
237
|
switch (o) {
|
|
238
238
|
case w.Ascii:
|
|
239
239
|
return String.fromCharCode.apply(null, new Uint8Array(n.buffer, r, s - 1));
|
|
240
240
|
}
|
|
241
241
|
if (t === d.TileOffsets || t === d.TileByteCounts || t === d.StripOffsets || t === d.StripByteCounts) {
|
|
242
|
-
const c =
|
|
242
|
+
const c = Je(e, n, r, s, o);
|
|
243
243
|
if (c)
|
|
244
244
|
return c;
|
|
245
245
|
}
|
|
246
246
|
const l = [];
|
|
247
247
|
for (let c = 0; c < s; c += a)
|
|
248
|
-
l.push(
|
|
248
|
+
l.push(Ge(o, n, r + c, e.isLittleEndian));
|
|
249
249
|
return l;
|
|
250
250
|
}
|
|
251
|
-
function
|
|
251
|
+
function $t(e, t, n) {
|
|
252
252
|
const r = t.getUint16(n + 0, e.isLittleEndian), o = t.getUint16(n + 2, e.isLittleEndian), i = K(t, n + 4, e.ifdConfig.pointer, e.isLittleEndian), s = N(o) * i;
|
|
253
253
|
if (s <= e.ifdConfig.pointer) {
|
|
254
254
|
const c = D(e, r, t, n + 4 + e.ifdConfig.pointer, o, i);
|
|
@@ -272,8 +272,8 @@ function _t(e, t, n) {
|
|
|
272
272
|
tagOffset: n
|
|
273
273
|
};
|
|
274
274
|
if (X(t, l, s)) {
|
|
275
|
-
const u =
|
|
276
|
-
u ? (c.value = u, c.isLoaded = !0) :
|
|
275
|
+
const u = Je(e, t, l - t.sourceOffset, s, o);
|
|
276
|
+
u ? (c.value = u, c.isLoaded = !0) : Jt(c, t);
|
|
277
277
|
}
|
|
278
278
|
return c;
|
|
279
279
|
}
|
|
@@ -283,13 +283,13 @@ function _t(e, t, n) {
|
|
|
283
283
|
}
|
|
284
284
|
return { type: "lazy", id: r, name: d[r], count: i, dataOffset: l, dataType: o, tagOffset: n };
|
|
285
285
|
}
|
|
286
|
-
async function
|
|
286
|
+
async function kt(e, t, n) {
|
|
287
287
|
if (e.value != null)
|
|
288
288
|
return e.value;
|
|
289
289
|
const o = N(e.dataType) * e.count, i = await t.source.fetch(e.dataOffset, o, n), a = new DataView(i);
|
|
290
290
|
return e.value = D(t, e.id, a, 0, e.dataType, e.count), e.value;
|
|
291
291
|
}
|
|
292
|
-
async function
|
|
292
|
+
async function Wt(e, t, n) {
|
|
293
293
|
const r = N(t.dataType);
|
|
294
294
|
if (t.view == null) {
|
|
295
295
|
const o = await e.source.fetch(t.dataOffset, r * t.count, n);
|
|
@@ -297,11 +297,11 @@ async function kt(e, t, n) {
|
|
|
297
297
|
}
|
|
298
298
|
return t.value = D(e, t.id, t.view, 0, t.dataType, t.count), t.view = void 0, t.isLoaded = !0, t.value;
|
|
299
299
|
}
|
|
300
|
-
function
|
|
300
|
+
function Jt(e, t) {
|
|
301
301
|
const n = N(e.dataType), r = t.byteOffset + e.dataOffset - t.sourceOffset;
|
|
302
302
|
e.view = new DataView(t.buffer.slice(r, r + n * e.count)), e.view.sourceOffset = e.dataOffset;
|
|
303
303
|
}
|
|
304
|
-
async function
|
|
304
|
+
async function Vt(e, t, n, r) {
|
|
305
305
|
if (n > t.count || n < 0)
|
|
306
306
|
throw new Error("TagOffset: out of bounds :" + n);
|
|
307
307
|
if (t.value[n] != null)
|
|
@@ -318,7 +318,7 @@ async function Jt(e, t, n, r) {
|
|
|
318
318
|
throw new Error("Value is not a number");
|
|
319
319
|
return t.value[n] = i, i;
|
|
320
320
|
}
|
|
321
|
-
function
|
|
321
|
+
function Ht(e, t, n) {
|
|
322
322
|
if (n > t.count || n < 0)
|
|
323
323
|
throw new Error("TagOffset: out of bounds :" + n);
|
|
324
324
|
if (t.value[n] != null)
|
|
@@ -330,7 +330,7 @@ function Vt(e, t, n) {
|
|
|
330
330
|
throw new Error("Value is not a number");
|
|
331
331
|
return t.value[n] = o, o;
|
|
332
332
|
}
|
|
333
|
-
const
|
|
333
|
+
const ve = 32767, Yt = /* @__PURE__ */ new Set([
|
|
334
334
|
d.Compression,
|
|
335
335
|
d.ImageHeight,
|
|
336
336
|
d.ImageWidth,
|
|
@@ -339,8 +339,8 @@ const Ge = 32767, Ht = /* @__PURE__ */ new Set([
|
|
|
339
339
|
d.ModelTransformation,
|
|
340
340
|
d.TileHeight,
|
|
341
341
|
d.TileWidth
|
|
342
|
-
]),
|
|
343
|
-
class
|
|
342
|
+
]), Xt = /* @__PURE__ */ new Set([d.GeoKeyDirectory, d.GeoAsciiParams, d.GeoDoubleParams]);
|
|
343
|
+
class Zt {
|
|
344
344
|
/**
|
|
345
345
|
* Id of the tif image, generally the image index inside the tif
|
|
346
346
|
* where 0 is the root image, and every sub image is +1
|
|
@@ -366,9 +366,9 @@ class Xt {
|
|
|
366
366
|
*/
|
|
367
367
|
async init(t = !0, n) {
|
|
368
368
|
const r = [];
|
|
369
|
-
|
|
369
|
+
Yt.forEach((o) => {
|
|
370
370
|
r.push(this.fetch(o, n));
|
|
371
|
-
}), t &&
|
|
371
|
+
}), t && Xt.forEach((o) => {
|
|
372
372
|
r.push(this.fetch(o, n));
|
|
373
373
|
}), await Promise.all(r), t && await this.loadGeoTiffTags();
|
|
374
374
|
}
|
|
@@ -418,11 +418,11 @@ class Xt {
|
|
|
418
418
|
if (r.type === "inline")
|
|
419
419
|
return r.value;
|
|
420
420
|
if (r.type === "lazy")
|
|
421
|
-
return
|
|
421
|
+
return kt(r, this.tiff, n);
|
|
422
422
|
if (r.isLoaded)
|
|
423
423
|
return r.value;
|
|
424
424
|
if (r.type === "offset")
|
|
425
|
-
return
|
|
425
|
+
return Wt(this.tiff, r, n);
|
|
426
426
|
throw new Error("Cannot fetch:" + t);
|
|
427
427
|
}
|
|
428
428
|
/**
|
|
@@ -560,7 +560,7 @@ class Xt {
|
|
|
560
560
|
*/
|
|
561
561
|
get compression() {
|
|
562
562
|
const t = this.value(d.Compression);
|
|
563
|
-
return t == null ? null :
|
|
563
|
+
return t == null ? null : $e[t];
|
|
564
564
|
}
|
|
565
565
|
/**
|
|
566
566
|
* Attempt to read the EPSG Code from TiffGeoTags
|
|
@@ -571,7 +571,7 @@ class Xt {
|
|
|
571
571
|
*/
|
|
572
572
|
get epsg() {
|
|
573
573
|
const t = this.valueGeo(m.ProjectionGeoKey);
|
|
574
|
-
if (t != null && t !==
|
|
574
|
+
if (t != null && t !== ve)
|
|
575
575
|
return t;
|
|
576
576
|
let n = null;
|
|
577
577
|
switch (this.valueGeo(m.GTModelTypeGeoKey)) {
|
|
@@ -589,7 +589,7 @@ class Xt {
|
|
|
589
589
|
case O.UserDefined:
|
|
590
590
|
return null;
|
|
591
591
|
}
|
|
592
|
-
return n ===
|
|
592
|
+
return n === ve ? null : n;
|
|
593
593
|
}
|
|
594
594
|
/**
|
|
595
595
|
* Get the size of the image
|
|
@@ -688,7 +688,7 @@ class Xt {
|
|
|
688
688
|
throw new Error(`Failed to fetch bytes from offset:${t} wanted:${n} got:${o.byteLength}`);
|
|
689
689
|
let i = this.value(d.Compression);
|
|
690
690
|
i == null && (i = f.None);
|
|
691
|
-
const a =
|
|
691
|
+
const a = zt(i) ?? P.None;
|
|
692
692
|
return i === f.Jpeg ? { mimeType: a, bytes: this.getJpegHeader(o), compression: i } : { mimeType: a, bytes: o, compression: i };
|
|
693
693
|
}
|
|
694
694
|
/**
|
|
@@ -764,26 +764,26 @@ class Xt {
|
|
|
764
764
|
}
|
|
765
765
|
function k(e, t, n, r) {
|
|
766
766
|
const o = ne(e, t, n);
|
|
767
|
-
return o != null ? Promise.resolve(o) :
|
|
767
|
+
return o != null ? Promise.resolve(o) : Vt(e, t, n, r);
|
|
768
768
|
}
|
|
769
769
|
function ne(e, t, n) {
|
|
770
770
|
if (n < 0)
|
|
771
771
|
throw new Error(`Tiff: ${e.source.url.href} out of bounds ${d[t.id]} index:${n} total:${t.count}`);
|
|
772
|
-
return n >= t.count ? 0 : t.type === "inline" || t.isLoaded ? t.value[n] :
|
|
772
|
+
return n >= t.count ? 0 : t.type === "inline" || t.isLoaded ? t.value[n] : Ht(e, t, n);
|
|
773
773
|
}
|
|
774
774
|
var z;
|
|
775
775
|
(function(e) {
|
|
776
776
|
e.GdalStructuralMetadataSize = "GDAL_STRUCTURAL_METADATA_SIZE", e.Layout = "LAYOUT", e.BlockOrder = "BLOCK_ORDER", e.BlockLeader = "BLOCK_LEADER", e.BlockTrailer = "BLOCK_TRAILER", e.KnownIncompatibleEdition = "KNOWN_INCOMPATIBLE_EDITION", e.MaskInterleavedWithImagery = "MASK_INTERLEAVED_WITH_IMAGERY";
|
|
777
777
|
})(z || (z = {}));
|
|
778
|
-
var
|
|
778
|
+
var Ee;
|
|
779
779
|
(function(e) {
|
|
780
780
|
e.RowMajor = "ROW_MAJOR";
|
|
781
|
-
})(
|
|
781
|
+
})(Ee || (Ee = {}));
|
|
782
782
|
var re;
|
|
783
783
|
(function(e) {
|
|
784
784
|
e.uint32 = "SIZE_AS_UINT4";
|
|
785
785
|
})(re || (re = {}));
|
|
786
|
-
class
|
|
786
|
+
class Qt {
|
|
787
787
|
options = /* @__PURE__ */ new Map();
|
|
788
788
|
/**
|
|
789
789
|
* Has GDAL optimized this tiff
|
|
@@ -827,7 +827,7 @@ class Zt {
|
|
|
827
827
|
return this.options.get(z.MaskInterleavedWithImagery) === "YES";
|
|
828
828
|
}
|
|
829
829
|
}
|
|
830
|
-
const
|
|
830
|
+
const Ve = {
|
|
831
831
|
version: R.Tiff,
|
|
832
832
|
pointer: I.UInt32,
|
|
833
833
|
offset: I.UInt16,
|
|
@@ -839,7 +839,7 @@ const Je = {
|
|
|
839
839
|
* UInt32:Pointer To Value or value
|
|
840
840
|
*/
|
|
841
841
|
ifd: I.UInt16 + I.UInt16 + 2 * I.UInt32
|
|
842
|
-
},
|
|
842
|
+
}, He = {
|
|
843
843
|
version: R.BigTiff,
|
|
844
844
|
/** Size of most pointers */
|
|
845
845
|
pointer: I.UInt64,
|
|
@@ -855,7 +855,7 @@ const Je = {
|
|
|
855
855
|
ifd: I.UInt16 + I.UInt16 + 2 * I.UInt64
|
|
856
856
|
};
|
|
857
857
|
R.BigTiff + "", R.Tiff + "";
|
|
858
|
-
function
|
|
858
|
+
function qt(e, t = 4, n = !0) {
|
|
859
859
|
const r = e.toString(16).padStart(t, "0");
|
|
860
860
|
return n ? "0x" + r : r;
|
|
861
861
|
}
|
|
@@ -873,7 +873,7 @@ class B {
|
|
|
873
873
|
/** Ghost header options */
|
|
874
874
|
options;
|
|
875
875
|
/** Configuration for the size of the IFD */
|
|
876
|
-
ifdConfig =
|
|
876
|
+
ifdConfig = Ve;
|
|
877
877
|
/** Is the tiff being read is little Endian */
|
|
878
878
|
isLittleEndian = !1;
|
|
879
879
|
/** Has init() been called */
|
|
@@ -914,7 +914,7 @@ class B {
|
|
|
914
914
|
async readHeader(t) {
|
|
915
915
|
if (this.isInitialized)
|
|
916
916
|
return this;
|
|
917
|
-
const n = new DataView(await this.source.fetch(0,
|
|
917
|
+
const n = new DataView(await this.source.fetch(0, Fe(this.source, 0, this.defaultReadSize), t));
|
|
918
918
|
if (n.byteLength === 0)
|
|
919
919
|
throw new Error("Unable to read empty tiff");
|
|
920
920
|
n.sourceOffset = 0;
|
|
@@ -923,7 +923,7 @@ class B {
|
|
|
923
923
|
r += 2, this.isLittleEndian = o === ee.Little, this.version = n.getUint16(r, this.isLittleEndian), r += 2;
|
|
924
924
|
let i;
|
|
925
925
|
if (this.version === R.BigTiff) {
|
|
926
|
-
this.ifdConfig =
|
|
926
|
+
this.ifdConfig = He;
|
|
927
927
|
const s = n.getUint16(r, this.isLittleEndian);
|
|
928
928
|
if (r += 2, s !== 8)
|
|
929
929
|
throw new Error("Only 8byte pointers are supported");
|
|
@@ -936,10 +936,10 @@ class B {
|
|
|
936
936
|
else
|
|
937
937
|
throw new Error(`Only tiff supported version:${String(this.version)}`);
|
|
938
938
|
const a = i - r;
|
|
939
|
-
for (a > 0 && a < 16 * 1024 && (this.options = new
|
|
939
|
+
for (a > 0 && a < 16 * 1024 && (this.options = new Qt(), this.options.process(n, r, a)); i !== 0; ) {
|
|
940
940
|
let s = n;
|
|
941
941
|
if (!X(s, i, 1024)) {
|
|
942
|
-
const l = await this.source.fetch(i,
|
|
942
|
+
const l = await this.source.fetch(i, Fe(this.source, i, this.defaultReadSize), t);
|
|
943
943
|
s = new DataView(l), s.sourceOffset = i;
|
|
944
944
|
}
|
|
945
945
|
i = this.readIfd(i, s);
|
|
@@ -955,20 +955,20 @@ class B {
|
|
|
955
955
|
readIfd(t, n) {
|
|
956
956
|
const r = t - n.sourceOffset, o = K(n, r, this.ifdConfig.offset, this.isLittleEndian), i = /* @__PURE__ */ new Map(), a = o * this.ifdConfig.ifd;
|
|
957
957
|
if (!X(n, t, a))
|
|
958
|
-
throw new Error("IFD out of range @ " +
|
|
958
|
+
throw new Error("IFD out of range @ " + qt(t) + " IFD" + this.images.length);
|
|
959
959
|
const s = this.ifdConfig.ifd, l = r + this.ifdConfig.offset;
|
|
960
960
|
for (let c = 0; c < o; c++) {
|
|
961
|
-
const u =
|
|
961
|
+
const u = $t(this, n, l + c * s);
|
|
962
962
|
i.set(u.id, u);
|
|
963
963
|
}
|
|
964
|
-
return this.images.push(new
|
|
964
|
+
return this.images.push(new Zt(this, this.images.length, i)), K(n, l + o * s, this.ifdConfig.pointer, this.isLittleEndian);
|
|
965
965
|
}
|
|
966
966
|
}
|
|
967
|
-
function
|
|
967
|
+
function Fe(e, t, n) {
|
|
968
968
|
const r = e.metadata?.size;
|
|
969
969
|
return r == null || r < 0 ? n : t + n > r ? r - t : n;
|
|
970
970
|
}
|
|
971
|
-
async function
|
|
971
|
+
async function le(e, t) {
|
|
972
972
|
const n = new Blob([e]), r = await createImageBitmap(n), o = new OffscreenCanvas(r.width, r.height), i = o.getContext("2d");
|
|
973
973
|
i.drawImage(r, 0, 0), r.close();
|
|
974
974
|
const { width: a, height: s } = o, c = i.getImageData(0, 0, a, s).data, u = t.samplesPerPixel;
|
|
@@ -988,23 +988,23 @@ async function se(e, t) {
|
|
|
988
988
|
}
|
|
989
989
|
throw new Error(`Unsupported SamplesPerPixel for JPEG: ${u}`);
|
|
990
990
|
}
|
|
991
|
-
function
|
|
991
|
+
function Tt(e, t = "") {
|
|
992
992
|
if (!e)
|
|
993
993
|
throw new Error(t);
|
|
994
994
|
}
|
|
995
|
-
async function
|
|
995
|
+
async function en(e, { format: t, signal: n }) {
|
|
996
996
|
const r = e instanceof Response ? e : new Response(e);
|
|
997
|
-
|
|
997
|
+
Tt(r.body, "Response does not contain body.");
|
|
998
998
|
try {
|
|
999
999
|
return await new Response(r.body.pipeThrough(new DecompressionStream(t), { signal: n })).arrayBuffer();
|
|
1000
1000
|
} catch {
|
|
1001
1001
|
throw n?.throwIfAborted(), new Error(`Failed to decode ${t}`);
|
|
1002
1002
|
}
|
|
1003
1003
|
}
|
|
1004
|
-
async function
|
|
1005
|
-
return
|
|
1004
|
+
async function Ye(e) {
|
|
1005
|
+
return en(e, { format: "deflate" });
|
|
1006
1006
|
}
|
|
1007
|
-
function
|
|
1007
|
+
function tn(e, t) {
|
|
1008
1008
|
const n = e;
|
|
1009
1009
|
let r = 0, o = e.length - t;
|
|
1010
1010
|
do {
|
|
@@ -1013,7 +1013,7 @@ function en(e, t) {
|
|
|
1013
1013
|
o -= t;
|
|
1014
1014
|
} while (o > 0);
|
|
1015
1015
|
}
|
|
1016
|
-
function
|
|
1016
|
+
function nn(e, t, n) {
|
|
1017
1017
|
let r = 0, o = e.length;
|
|
1018
1018
|
const i = o / n;
|
|
1019
1019
|
for (; o > t; ) {
|
|
@@ -1026,7 +1026,7 @@ function tn(e, t, n) {
|
|
|
1026
1026
|
for (let l = 0; l < n; l++)
|
|
1027
1027
|
e[n * s + l] = a[(n - l - 1) * i + s];
|
|
1028
1028
|
}
|
|
1029
|
-
function
|
|
1029
|
+
function rn(e, t, n, r, o, i, a) {
|
|
1030
1030
|
if (t === _.None)
|
|
1031
1031
|
return e;
|
|
1032
1032
|
const s = o / 8, l = a === U.Separate ? 1 : i;
|
|
@@ -1050,54 +1050,54 @@ function nn(e, t, n, r, o, i, a) {
|
|
|
1050
1050
|
default:
|
|
1051
1051
|
throw new Error(`Predictor 2 not supported for ${o} bits per sample.`);
|
|
1052
1052
|
}
|
|
1053
|
-
|
|
1053
|
+
tn(h, l);
|
|
1054
1054
|
} else if (t === _.FloatingPoint) {
|
|
1055
1055
|
const h = new Uint8Array(e, u, l * n * s);
|
|
1056
|
-
|
|
1056
|
+
nn(h, l, s);
|
|
1057
1057
|
}
|
|
1058
1058
|
}
|
|
1059
1059
|
return e;
|
|
1060
1060
|
}
|
|
1061
|
-
async function
|
|
1061
|
+
async function on(e) {
|
|
1062
1062
|
return e;
|
|
1063
1063
|
}
|
|
1064
1064
|
const j = /* @__PURE__ */ new Map();
|
|
1065
|
-
j.set(f.None, () => Promise.resolve(
|
|
1066
|
-
j.set(f.Deflate, () => Promise.resolve(
|
|
1067
|
-
j.set(f.DeflateOther, () => Promise.resolve(
|
|
1065
|
+
j.set(f.None, () => Promise.resolve(on));
|
|
1066
|
+
j.set(f.Deflate, () => Promise.resolve(Ye));
|
|
1067
|
+
j.set(f.DeflateOther, () => Promise.resolve(Ye));
|
|
1068
1068
|
j.set(f.Lzw, () => import("./lzw-BY5a_5nb.js").then((e) => e.decode));
|
|
1069
1069
|
j.set(f.Zstd, () => import("./zstd-jXobGRcq.js").then((e) => e.decode));
|
|
1070
|
-
j.set(f.Jpeg, () => Promise.resolve(
|
|
1071
|
-
j.set(f.Jpeg6, () => Promise.resolve(
|
|
1072
|
-
j.set(f.Webp, () => Promise.resolve(
|
|
1073
|
-
j.set(f.Lerc, () => import("./lerc-
|
|
1074
|
-
async function
|
|
1070
|
+
j.set(f.Jpeg, () => Promise.resolve(le));
|
|
1071
|
+
j.set(f.Jpeg6, () => Promise.resolve(le));
|
|
1072
|
+
j.set(f.Webp, () => Promise.resolve(le));
|
|
1073
|
+
j.set(f.Lerc, () => import("./lerc-nHFgnN0N.js").then((e) => e.l).then((e) => e.decode));
|
|
1074
|
+
async function ce(e, t, n) {
|
|
1075
1075
|
const r = j.get(t);
|
|
1076
1076
|
if (!r)
|
|
1077
1077
|
throw new Error(`Unsupported compression: ${t}`);
|
|
1078
1078
|
const i = await (await r())(e, n);
|
|
1079
1079
|
if (i instanceof ArrayBuffer) {
|
|
1080
|
-
const { predictor: a, width: s, height: l, bitsPerSample: c, samplesPerPixel: u, planarConfiguration: h } = n, p =
|
|
1080
|
+
const { predictor: a, width: s, height: l, bitsPerSample: c, samplesPerPixel: u, planarConfiguration: h } = n, p = rn(i, a, s, l, c, u, h);
|
|
1081
1081
|
return {
|
|
1082
1082
|
layout: "pixel-interleaved",
|
|
1083
|
-
data:
|
|
1083
|
+
data: sn(p, n)
|
|
1084
1084
|
};
|
|
1085
1085
|
}
|
|
1086
1086
|
return i;
|
|
1087
1087
|
}
|
|
1088
|
-
function
|
|
1088
|
+
function an(e, t) {
|
|
1089
1089
|
const n = new Uint8Array(e), r = new Uint8Array(t);
|
|
1090
1090
|
for (let o = 0; o < t; o++)
|
|
1091
1091
|
r[o] = n[o >> 3] >> 7 - (o & 7) & 1 ? 255 : 0;
|
|
1092
1092
|
return r;
|
|
1093
1093
|
}
|
|
1094
|
-
function
|
|
1094
|
+
function sn(e, t) {
|
|
1095
1095
|
const { sampleFormat: n, bitsPerSample: r } = t;
|
|
1096
1096
|
switch (n) {
|
|
1097
1097
|
case A.Uint:
|
|
1098
1098
|
switch (r) {
|
|
1099
1099
|
case 1:
|
|
1100
|
-
return
|
|
1100
|
+
return an(e, t.width * t.height * t.samplesPerPixel);
|
|
1101
1101
|
case 8:
|
|
1102
1102
|
return new Uint8Array(e);
|
|
1103
1103
|
case 16:
|
|
@@ -1127,7 +1127,7 @@ function an(e, t) {
|
|
|
1127
1127
|
}
|
|
1128
1128
|
throw new Error(`Unsupported sample format/depth: SampleFormat=${n}, BitsPerSample=${r}`);
|
|
1129
1129
|
}
|
|
1130
|
-
class
|
|
1130
|
+
class ln {
|
|
1131
1131
|
name = "source:cache";
|
|
1132
1132
|
maxSize;
|
|
1133
1133
|
/** Number of bytes cached in cacheA, when this overflows maxSize cacheA is moved to cacheB and cacheB is dropped */
|
|
@@ -1206,7 +1206,7 @@ const Q = {
|
|
|
1206
1206
|
return o;
|
|
1207
1207
|
}
|
|
1208
1208
|
};
|
|
1209
|
-
class
|
|
1209
|
+
class cn {
|
|
1210
1210
|
source;
|
|
1211
1211
|
middleware;
|
|
1212
1212
|
static is(t) {
|
|
@@ -1247,14 +1247,14 @@ class ln {
|
|
|
1247
1247
|
return t({ source: this, offset: n, length: r, signal: o?.signal });
|
|
1248
1248
|
}
|
|
1249
1249
|
}
|
|
1250
|
-
function
|
|
1250
|
+
function un(e) {
|
|
1251
1251
|
try {
|
|
1252
1252
|
return new URL(e);
|
|
1253
1253
|
} catch {
|
|
1254
1254
|
return null;
|
|
1255
1255
|
}
|
|
1256
1256
|
}
|
|
1257
|
-
class
|
|
1257
|
+
class dn {
|
|
1258
1258
|
name = "source:chunk";
|
|
1259
1259
|
/** Number of bytes to chunk requests into */
|
|
1260
1260
|
chunkSize;
|
|
@@ -1282,7 +1282,7 @@ class un {
|
|
|
1282
1282
|
return s.buffer;
|
|
1283
1283
|
}
|
|
1284
1284
|
}
|
|
1285
|
-
function
|
|
1285
|
+
function Ae(e) {
|
|
1286
1286
|
const t = {}, n = e.headers.get("content-length");
|
|
1287
1287
|
n && (t.size = parseInt(n));
|
|
1288
1288
|
const r = e.headers.get("content-range");
|
|
@@ -1304,7 +1304,7 @@ class $ {
|
|
|
1304
1304
|
return this._head ? this._head : (this._head = $.fetch(this.url, { method: "HEAD", headers: this.headers }).then((t) => {
|
|
1305
1305
|
if (!t.ok)
|
|
1306
1306
|
throw delete this._head, new Error(`Failed to HEAD ${this.url.href}`, { cause: { statusCode: t.status, msg: t.statusText } });
|
|
1307
|
-
return this.metadata =
|
|
1307
|
+
return this.metadata = Ae(t), this.metadata;
|
|
1308
1308
|
}), this._head);
|
|
1309
1309
|
}
|
|
1310
1310
|
async fetch(t, n, r) {
|
|
@@ -1312,7 +1312,7 @@ class $ {
|
|
|
1312
1312
|
const o = { range: Q.toRange(t, n), ...this.headers }, i = await $.fetch(this.url, { headers: o, signal: r?.signal });
|
|
1313
1313
|
if (!i.ok)
|
|
1314
1314
|
throw new M(`Failed to fetch ${this.url.href} ${o.range}`, i.status, this, new Error(i.statusText));
|
|
1315
|
-
const a =
|
|
1315
|
+
const a = Ae(i);
|
|
1316
1316
|
if (this.metadata == null)
|
|
1317
1317
|
this.metadata = a;
|
|
1318
1318
|
else if (this.metadata.eTag && this.metadata.eTag !== a.eTag)
|
|
@@ -1324,13 +1324,13 @@ class $ {
|
|
|
1324
1324
|
}
|
|
1325
1325
|
}
|
|
1326
1326
|
$.fetch = (e, t) => fetch(e, t);
|
|
1327
|
-
function
|
|
1327
|
+
function hn(e) {
|
|
1328
1328
|
if (typeof e != "string")
|
|
1329
1329
|
return e;
|
|
1330
|
-
const t =
|
|
1330
|
+
const t = un(e);
|
|
1331
1331
|
return t || new URL("memory://" + e);
|
|
1332
1332
|
}
|
|
1333
|
-
class
|
|
1333
|
+
class ue {
|
|
1334
1334
|
url;
|
|
1335
1335
|
type = "memory";
|
|
1336
1336
|
data;
|
|
@@ -1339,8 +1339,8 @@ class ce {
|
|
|
1339
1339
|
return t instanceof ArrayBuffer ? t : t.byteLength === t.buffer.byteLength ? t.buffer : t.buffer.slice(t.byteOffset, t.byteOffset + t.byteLength);
|
|
1340
1340
|
}
|
|
1341
1341
|
constructor(t, n) {
|
|
1342
|
-
const r =
|
|
1343
|
-
this.url =
|
|
1342
|
+
const r = ue.toArrayBuffer(n ?? new Uint8Array());
|
|
1343
|
+
this.url = hn(t), this.data = r, this.metadata = { size: r.byteLength };
|
|
1344
1344
|
}
|
|
1345
1345
|
head() {
|
|
1346
1346
|
return Promise.resolve({ size: this.data.byteLength });
|
|
@@ -1351,37 +1351,37 @@ class ce {
|
|
|
1351
1351
|
return Promise.resolve(this.data.slice(t, n == null ? void 0 : t + n));
|
|
1352
1352
|
}
|
|
1353
1353
|
}
|
|
1354
|
-
const
|
|
1355
|
-
[
|
|
1356
|
-
[
|
|
1357
|
-
[
|
|
1358
|
-
},
|
|
1354
|
+
const Xe = "https://proj.org/schemas/v0.7/projjson.schema.json", pn = 1, mn = 2, V = 32767, je = 1, gn = 2, fn = 3, yn = 4, wn = 5, Sn = 6, Pn = 7, bn = 8, Cn = 9, Ln = 10, In = 11, Gn = 12, vn = 14, En = 15, Fn = 16, An = 17, jn = 18, Rn = 21, Un = 22, Mn = 24, On = 26, Kn = 27, Ze = 9102, xn = 9101, Dn = 9105, Nn = {
|
|
1355
|
+
[Ze]: "degree",
|
|
1356
|
+
[xn]: "radian",
|
|
1357
|
+
[Dn]: "grad"
|
|
1358
|
+
}, Qe = 9001, zn = 9002, Bn = 9003, _n = {
|
|
1359
1359
|
type: "LinearUnit",
|
|
1360
1360
|
name: "US survey foot",
|
|
1361
1361
|
conversion_factor: 0.30480060960121924
|
|
1362
|
-
},
|
|
1363
|
-
[
|
|
1364
|
-
[
|
|
1365
|
-
[
|
|
1362
|
+
}, $n = {
|
|
1363
|
+
[Qe]: "metre",
|
|
1364
|
+
[zn]: "foot",
|
|
1365
|
+
[Bn]: _n
|
|
1366
1366
|
};
|
|
1367
|
-
function
|
|
1367
|
+
function kn(e) {
|
|
1368
1368
|
const t = e.modelType;
|
|
1369
|
-
if (t === hn)
|
|
1370
|
-
return Wn(e);
|
|
1371
1369
|
if (t === pn)
|
|
1372
|
-
return
|
|
1370
|
+
return Jn(e);
|
|
1371
|
+
if (t === mn)
|
|
1372
|
+
return Wn(e);
|
|
1373
1373
|
throw new Error(`Unsupported GeoTIFF model type: ${t}`);
|
|
1374
1374
|
}
|
|
1375
|
-
function
|
|
1375
|
+
function Wn(e) {
|
|
1376
1376
|
const t = e.geodeticCRS;
|
|
1377
|
-
return t !== null && t !== V ? t :
|
|
1377
|
+
return t !== null && t !== V ? t : qe(e, Xe);
|
|
1378
1378
|
}
|
|
1379
|
-
function
|
|
1379
|
+
function Jn(e) {
|
|
1380
1380
|
const t = e.projectedCRS;
|
|
1381
|
-
return t !== null && t !== V ? t :
|
|
1381
|
+
return t !== null && t !== V ? t : Vn(e);
|
|
1382
1382
|
}
|
|
1383
|
-
function
|
|
1384
|
-
const n =
|
|
1383
|
+
function qe(e, t) {
|
|
1384
|
+
const n = Hn(e);
|
|
1385
1385
|
let r = "Greenwich", o = 0;
|
|
1386
1386
|
e.primeMeridian !== null && e.primeMeridian !== V ? r = `EPSG:${e.primeMeridian}` : e.primeMeridianLongitude !== null && (o = e.primeMeridianLongitude, r = "User-defined");
|
|
1387
1387
|
let i;
|
|
@@ -1398,22 +1398,22 @@ function Qe(e, t) {
|
|
|
1398
1398
|
type: "GeographicCRS",
|
|
1399
1399
|
name: e.geodeticCitation ?? "User-defined",
|
|
1400
1400
|
datum: i,
|
|
1401
|
-
coordinate_system:
|
|
1401
|
+
coordinate_system: Xn(e)
|
|
1402
1402
|
};
|
|
1403
1403
|
return t !== void 0 && (a.$schema = t), a;
|
|
1404
1404
|
}
|
|
1405
|
-
function
|
|
1406
|
-
const t =
|
|
1405
|
+
function Vn(e) {
|
|
1406
|
+
const t = qe(e), n = Yn(e), r = Zn(e);
|
|
1407
1407
|
return {
|
|
1408
1408
|
type: "ProjectedCRS",
|
|
1409
|
-
$schema:
|
|
1409
|
+
$schema: Xe,
|
|
1410
1410
|
name: e.projectedCitation ?? e.citation ?? "User-defined",
|
|
1411
1411
|
base_crs: t,
|
|
1412
1412
|
conversion: n,
|
|
1413
1413
|
coordinate_system: r
|
|
1414
1414
|
};
|
|
1415
1415
|
}
|
|
1416
|
-
function
|
|
1416
|
+
function Hn(e) {
|
|
1417
1417
|
if (e.ellipsoid !== null && e.ellipsoid !== V) {
|
|
1418
1418
|
const n = {
|
|
1419
1419
|
name: `EPSG ellipsoid ${e.ellipsoid}`
|
|
@@ -1434,7 +1434,7 @@ function Vn(e) {
|
|
|
1434
1434
|
throw new Error("User-defined ellipsoid requires ellipsoidInvFlattening or ellipsoidSemiMinorAxis");
|
|
1435
1435
|
return t;
|
|
1436
1436
|
}
|
|
1437
|
-
function
|
|
1437
|
+
function Yn(e) {
|
|
1438
1438
|
const t = e.projMethod;
|
|
1439
1439
|
if (t === null)
|
|
1440
1440
|
throw new Error("User-defined projected CRS requires projMethod");
|
|
@@ -1452,10 +1452,10 @@ function Hn(e) {
|
|
|
1452
1452
|
unit: "unity"
|
|
1453
1453
|
});
|
|
1454
1454
|
switch (t) {
|
|
1455
|
-
case
|
|
1456
|
-
case
|
|
1457
|
-
case
|
|
1458
|
-
const i = t ===
|
|
1455
|
+
case je:
|
|
1456
|
+
case gn:
|
|
1457
|
+
case Kn: {
|
|
1458
|
+
const i = t === je ? "Transverse Mercator" : "Transverse Mercator (South Orientated)";
|
|
1459
1459
|
return {
|
|
1460
1460
|
name: i,
|
|
1461
1461
|
method: { name: i },
|
|
@@ -1468,10 +1468,10 @@ function Hn(e) {
|
|
|
1468
1468
|
]
|
|
1469
1469
|
};
|
|
1470
1470
|
}
|
|
1471
|
-
case gn:
|
|
1472
1471
|
case fn:
|
|
1473
1472
|
case yn:
|
|
1474
|
-
case wn:
|
|
1473
|
+
case wn:
|
|
1474
|
+
case Sn: {
|
|
1475
1475
|
const i = "Hotine Oblique Mercator (variant B)";
|
|
1476
1476
|
return {
|
|
1477
1477
|
name: i,
|
|
@@ -1487,7 +1487,7 @@ function Hn(e) {
|
|
|
1487
1487
|
]
|
|
1488
1488
|
};
|
|
1489
1489
|
}
|
|
1490
|
-
case
|
|
1490
|
+
case Pn: {
|
|
1491
1491
|
const i = "Mercator (variant A)";
|
|
1492
1492
|
return {
|
|
1493
1493
|
name: i,
|
|
@@ -1501,7 +1501,7 @@ function Hn(e) {
|
|
|
1501
1501
|
]
|
|
1502
1502
|
};
|
|
1503
1503
|
}
|
|
1504
|
-
case
|
|
1504
|
+
case bn: {
|
|
1505
1505
|
const i = "Lambert Conic Conformal (2SP)";
|
|
1506
1506
|
return {
|
|
1507
1507
|
name: i,
|
|
@@ -1516,7 +1516,7 @@ function Hn(e) {
|
|
|
1516
1516
|
]
|
|
1517
1517
|
};
|
|
1518
1518
|
}
|
|
1519
|
-
case
|
|
1519
|
+
case Cn: {
|
|
1520
1520
|
const i = "Lambert Conic Conformal (1SP)";
|
|
1521
1521
|
return {
|
|
1522
1522
|
name: i,
|
|
@@ -1530,7 +1530,7 @@ function Hn(e) {
|
|
|
1530
1530
|
]
|
|
1531
1531
|
};
|
|
1532
1532
|
}
|
|
1533
|
-
case
|
|
1533
|
+
case Ln: {
|
|
1534
1534
|
const i = "Lambert Azimuthal Equal Area";
|
|
1535
1535
|
return {
|
|
1536
1536
|
name: i,
|
|
@@ -1543,7 +1543,7 @@ function Hn(e) {
|
|
|
1543
1543
|
]
|
|
1544
1544
|
};
|
|
1545
1545
|
}
|
|
1546
|
-
case
|
|
1546
|
+
case In: {
|
|
1547
1547
|
const i = "Albers Equal Area";
|
|
1548
1548
|
return {
|
|
1549
1549
|
name: i,
|
|
@@ -1558,7 +1558,7 @@ function Hn(e) {
|
|
|
1558
1558
|
]
|
|
1559
1559
|
};
|
|
1560
1560
|
}
|
|
1561
|
-
case
|
|
1561
|
+
case Gn: {
|
|
1562
1562
|
const i = "Modified Azimuthal Equidistant";
|
|
1563
1563
|
return {
|
|
1564
1564
|
name: i,
|
|
@@ -1571,7 +1571,7 @@ function Hn(e) {
|
|
|
1571
1571
|
]
|
|
1572
1572
|
};
|
|
1573
1573
|
}
|
|
1574
|
-
case
|
|
1574
|
+
case vn: {
|
|
1575
1575
|
const i = "Stereographic";
|
|
1576
1576
|
return {
|
|
1577
1577
|
name: i,
|
|
@@ -1585,7 +1585,7 @@ function Hn(e) {
|
|
|
1585
1585
|
]
|
|
1586
1586
|
};
|
|
1587
1587
|
}
|
|
1588
|
-
case
|
|
1588
|
+
case En: {
|
|
1589
1589
|
const i = "Polar Stereographic (variant B)";
|
|
1590
1590
|
return {
|
|
1591
1591
|
name: i,
|
|
@@ -1598,7 +1598,7 @@ function Hn(e) {
|
|
|
1598
1598
|
]
|
|
1599
1599
|
};
|
|
1600
1600
|
}
|
|
1601
|
-
case
|
|
1601
|
+
case Fn: {
|
|
1602
1602
|
const i = "Oblique Stereographic";
|
|
1603
1603
|
return {
|
|
1604
1604
|
name: i,
|
|
@@ -1612,7 +1612,7 @@ function Hn(e) {
|
|
|
1612
1612
|
]
|
|
1613
1613
|
};
|
|
1614
1614
|
}
|
|
1615
|
-
case
|
|
1615
|
+
case An: {
|
|
1616
1616
|
const i = "Equidistant Cylindrical";
|
|
1617
1617
|
return {
|
|
1618
1618
|
name: i,
|
|
@@ -1625,7 +1625,7 @@ function Hn(e) {
|
|
|
1625
1625
|
]
|
|
1626
1626
|
};
|
|
1627
1627
|
}
|
|
1628
|
-
case
|
|
1628
|
+
case jn: {
|
|
1629
1629
|
const i = "Cassini-Soldner";
|
|
1630
1630
|
return {
|
|
1631
1631
|
name: i,
|
|
@@ -1638,7 +1638,7 @@ function Hn(e) {
|
|
|
1638
1638
|
]
|
|
1639
1639
|
};
|
|
1640
1640
|
}
|
|
1641
|
-
case
|
|
1641
|
+
case Un: {
|
|
1642
1642
|
const i = "American Polyconic";
|
|
1643
1643
|
return {
|
|
1644
1644
|
name: i,
|
|
@@ -1651,7 +1651,7 @@ function Hn(e) {
|
|
|
1651
1651
|
]
|
|
1652
1652
|
};
|
|
1653
1653
|
}
|
|
1654
|
-
case
|
|
1654
|
+
case Mn: {
|
|
1655
1655
|
const i = "Sinusoidal";
|
|
1656
1656
|
return {
|
|
1657
1657
|
name: i,
|
|
@@ -1663,7 +1663,7 @@ function Hn(e) {
|
|
|
1663
1663
|
]
|
|
1664
1664
|
};
|
|
1665
1665
|
}
|
|
1666
|
-
case
|
|
1666
|
+
case Rn: {
|
|
1667
1667
|
const i = "Orthographic";
|
|
1668
1668
|
return {
|
|
1669
1669
|
name: i,
|
|
@@ -1676,7 +1676,7 @@ function Hn(e) {
|
|
|
1676
1676
|
]
|
|
1677
1677
|
};
|
|
1678
1678
|
}
|
|
1679
|
-
case
|
|
1679
|
+
case On: {
|
|
1680
1680
|
const i = "New Zealand Map Grid";
|
|
1681
1681
|
return {
|
|
1682
1682
|
name: i,
|
|
@@ -1693,8 +1693,8 @@ function Hn(e) {
|
|
|
1693
1693
|
throw new Error(`Unsupported coordinate transformation type: ${t}`);
|
|
1694
1694
|
}
|
|
1695
1695
|
}
|
|
1696
|
-
function
|
|
1697
|
-
const t =
|
|
1696
|
+
function Xn(e) {
|
|
1697
|
+
const t = Nn[e.angularUnits ?? Ze] ?? "degree";
|
|
1698
1698
|
return {
|
|
1699
1699
|
subtype: "ellipsoidal",
|
|
1700
1700
|
axis: [
|
|
@@ -1713,8 +1713,8 @@ function Yn(e) {
|
|
|
1713
1713
|
]
|
|
1714
1714
|
};
|
|
1715
1715
|
}
|
|
1716
|
-
function
|
|
1717
|
-
const t =
|
|
1716
|
+
function Zn(e) {
|
|
1717
|
+
const t = $n[e.projLinearUnits ?? Qe] ?? "metre";
|
|
1718
1718
|
return {
|
|
1719
1719
|
subtype: "Cartesian",
|
|
1720
1720
|
axis: [
|
|
@@ -1723,20 +1723,20 @@ function Xn(e) {
|
|
|
1723
1723
|
]
|
|
1724
1724
|
};
|
|
1725
1725
|
}
|
|
1726
|
-
const
|
|
1727
|
-
async function
|
|
1726
|
+
const Qn = 1024 * 1024, qn = 16 * 1024 * 1024, Re = 6;
|
|
1727
|
+
async function Tn(e, t, n) {
|
|
1728
1728
|
if (t.length === 0)
|
|
1729
1729
|
return [];
|
|
1730
|
-
const r = n?.coalesce ??
|
|
1730
|
+
const r = n?.coalesce ?? Qn, o = n?.maxRangeSize ?? qn, i = n?.signal, a = er(t, r, o), s = await nr(e, a, i), l = new Array(t.length);
|
|
1731
1731
|
for (let c = 0; c < t.length; c++) {
|
|
1732
|
-
const u = t[c], h =
|
|
1733
|
-
if (
|
|
1732
|
+
const u = t[c], h = tr(a, u.offset), p = a[h], g = s[h], y = u.offset - p.offset, S = y + u.length;
|
|
1733
|
+
if (S > g.byteLength)
|
|
1734
1734
|
throw new Error(`Failed to fetch bytes from offset:${u.offset} wanted:${u.length} got:${g.byteLength - y}`);
|
|
1735
|
-
l[c] = g.slice(y,
|
|
1735
|
+
l[c] = g.slice(y, S);
|
|
1736
1736
|
}
|
|
1737
1737
|
return l;
|
|
1738
1738
|
}
|
|
1739
|
-
function
|
|
1739
|
+
function er(e, t, n) {
|
|
1740
1740
|
const r = [...e].sort((a, s) => a.offset - s.offset), o = [];
|
|
1741
1741
|
let i = null;
|
|
1742
1742
|
for (const a of r) {
|
|
@@ -1749,7 +1749,7 @@ function Tn(e, t, n) {
|
|
|
1749
1749
|
}
|
|
1750
1750
|
return i != null && o.push(i), o;
|
|
1751
1751
|
}
|
|
1752
|
-
function
|
|
1752
|
+
function tr(e, t) {
|
|
1753
1753
|
let n = 0, r = e.length - 1;
|
|
1754
1754
|
for (; n < r; ) {
|
|
1755
1755
|
const o = n + r + 1 >>> 1;
|
|
@@ -1757,38 +1757,38 @@ function er(e, t) {
|
|
|
1757
1757
|
}
|
|
1758
1758
|
return n;
|
|
1759
1759
|
}
|
|
1760
|
-
async function
|
|
1760
|
+
async function nr(e, t, n) {
|
|
1761
1761
|
const r = new Array(t.length);
|
|
1762
|
-
for (let o = 0; o < t.length; o +=
|
|
1763
|
-
const i = t.slice(o, o +
|
|
1762
|
+
for (let o = 0; o < t.length; o += Re) {
|
|
1763
|
+
const i = t.slice(o, o + Re), a = await Promise.all(i.map((s) => e.fetch(s.offset, s.length, { signal: n })));
|
|
1764
1764
|
for (let s = 0; s < a.length; s++)
|
|
1765
1765
|
r[o + s] = a[s];
|
|
1766
1766
|
}
|
|
1767
1767
|
return r;
|
|
1768
1768
|
}
|
|
1769
|
-
async function
|
|
1770
|
-
const a =
|
|
1769
|
+
async function Te(e, t, n, { boundless: r = !0, pool: o, signal: i } = {}) {
|
|
1770
|
+
const a = ir(e, t, n, { signal: i }), s = e.maskImage != null ? rt(e.maskImage, t, n, e.dataSource, {
|
|
1771
1771
|
signal: i,
|
|
1772
1772
|
debug: e._debug ? { label: "mask" } : void 0
|
|
1773
1773
|
}) : Promise.resolve(null), [l, c] = await Promise.all([a, s]);
|
|
1774
|
-
return
|
|
1774
|
+
return et(e, t, n, l, c, { boundless: r, pool: o });
|
|
1775
1775
|
}
|
|
1776
|
-
async function
|
|
1777
|
-
const { bitsPerSample: s, predictor: l, planarConfiguration: c, sampleFormat: u, lercParameters: h } = e.cachedTags, { sampleFormat: p, bitsPerSample: g } =
|
|
1776
|
+
async function et(e, t, n, r, o, { boundless: i, pool: a }) {
|
|
1777
|
+
const { bitsPerSample: s, predictor: l, planarConfiguration: c, sampleFormat: u, lercParameters: h } = e.cachedTags, { sampleFormat: p, bitsPerSample: g } = st(u, s), y = se(e.transform, ze(t * e.tileWidth, n * e.tileHeight)), S = e.image.value(d.SamplesPerPixel) ?? 1, b = {
|
|
1778
1778
|
sampleFormat: p,
|
|
1779
1779
|
bitsPerSample: g,
|
|
1780
|
-
samplesPerPixel:
|
|
1780
|
+
samplesPerPixel: S,
|
|
1781
1781
|
width: e.tileWidth,
|
|
1782
1782
|
height: e.tileHeight,
|
|
1783
1783
|
predictor: l,
|
|
1784
1784
|
planarConfiguration: c,
|
|
1785
1785
|
lercParameters: h
|
|
1786
1786
|
}, [v, C] = await Promise.all([
|
|
1787
|
-
|
|
1788
|
-
o != null && e.maskImage != null ?
|
|
1787
|
+
or(r, b, a),
|
|
1788
|
+
o != null && e.maskImage != null ? rr(o, e.maskImage, a) : Promise.resolve(null)
|
|
1789
1789
|
]), L = {
|
|
1790
1790
|
...v,
|
|
1791
|
-
count:
|
|
1791
|
+
count: S,
|
|
1792
1792
|
height: e.tileHeight,
|
|
1793
1793
|
width: e.tileWidth,
|
|
1794
1794
|
mask: C,
|
|
@@ -1799,26 +1799,26 @@ async function Te(e, t, n, r, o, { boundless: i, pool: a }) {
|
|
|
1799
1799
|
return {
|
|
1800
1800
|
x: t,
|
|
1801
1801
|
y: n,
|
|
1802
|
-
array: i === !0 ? L :
|
|
1802
|
+
array: i === !0 ? L : cr(e, t, n, L)
|
|
1803
1803
|
};
|
|
1804
1804
|
}
|
|
1805
|
-
async function
|
|
1805
|
+
async function tt(e, t, { boundless: n = !0, pool: r, signal: o } = {}) {
|
|
1806
1806
|
if (t.length === 0)
|
|
1807
1807
|
return [];
|
|
1808
|
-
const i =
|
|
1808
|
+
const i = sr(e, t, { signal: o }), a = e.maskImage != null ? at(e.maskImage, t, e.dataSource, {
|
|
1809
1809
|
signal: o,
|
|
1810
1810
|
debug: e._debug ? { label: "mask" } : void 0
|
|
1811
1811
|
}) : Promise.resolve(t.map(() => null)), [s, l] = await Promise.all([
|
|
1812
1812
|
i,
|
|
1813
1813
|
a
|
|
1814
1814
|
]);
|
|
1815
|
-
return Promise.all(t.map(([c, u], h) =>
|
|
1815
|
+
return Promise.all(t.map(([c, u], h) => et(e, c, u, s[h], l[h] ?? null, {
|
|
1816
1816
|
boundless: n,
|
|
1817
1817
|
pool: r
|
|
1818
1818
|
})));
|
|
1819
1819
|
}
|
|
1820
|
-
async function
|
|
1821
|
-
const r = t.value(d.SampleFormat) ?? [1], o = t.value(d.BitsPerSample) ?? [8], { sampleFormat: i, bitsPerSample: a } =
|
|
1820
|
+
async function rr(e, t, n) {
|
|
1821
|
+
const r = t.value(d.SampleFormat) ?? [1], o = t.value(d.BitsPerSample) ?? [8], { sampleFormat: i, bitsPerSample: a } = st(r, new Uint16Array(o)), { width: s, height: l } = t.tileSize, c = {
|
|
1822
1822
|
sampleFormat: i,
|
|
1823
1823
|
bitsPerSample: a,
|
|
1824
1824
|
samplesPerPixel: t.value(d.SamplesPerPixel) ?? 1,
|
|
@@ -1826,13 +1826,13 @@ async function nr(e, t, n) {
|
|
|
1826
1826
|
height: l,
|
|
1827
1827
|
predictor: t.value(d.Predictor) ?? 1,
|
|
1828
1828
|
planarConfiguration: t.value(d.PlanarConfiguration) ?? U.Contig
|
|
1829
|
-
}, u = (
|
|
1829
|
+
}, u = (S, b, v) => n ? n.decode(S, b, v) : ce(S, b, v), { bytes: h, compression: p } = e, g = await u(h, p, c), y = g.layout === "pixel-interleaved" ? g.data : g.bands[0];
|
|
1830
1830
|
if (y instanceof Uint8Array)
|
|
1831
1831
|
return y;
|
|
1832
1832
|
throw new Error("Expected mask data to decode to Uint8Array");
|
|
1833
1833
|
}
|
|
1834
|
-
async function
|
|
1835
|
-
const r = (o, i, a) => n ? n.decode(o, i, a) :
|
|
1834
|
+
async function or(e, t, n) {
|
|
1835
|
+
const r = (o, i, a) => n ? n.decode(o, i, a) : ce(o, i, a);
|
|
1836
1836
|
if (Array.isArray(e)) {
|
|
1837
1837
|
const o = { ...t, samplesPerPixel: 1 };
|
|
1838
1838
|
return { layout: "band-separate", bands: (await Promise.all(e.map(({ bytes: s, compression: l }) => r(s, l, o)))).map((s) => s.layout === "band-separate" ? s.bands[0] : s.data) };
|
|
@@ -1841,11 +1841,11 @@ async function rr(e, t, n) {
|
|
|
1841
1841
|
return r(o, i, t);
|
|
1842
1842
|
}
|
|
1843
1843
|
}
|
|
1844
|
-
async function
|
|
1844
|
+
async function ir(e, t, n, { signal: r } = {}) {
|
|
1845
1845
|
const o = e._debug ? { label: "data" } : void 0;
|
|
1846
1846
|
switch (e.cachedTags.planarConfiguration) {
|
|
1847
1847
|
case U.Contig: {
|
|
1848
|
-
const i = await
|
|
1848
|
+
const i = await rt(e.image, t, n, e.dataSource, {
|
|
1849
1849
|
signal: r,
|
|
1850
1850
|
debug: o
|
|
1851
1851
|
});
|
|
@@ -1854,32 +1854,32 @@ async function or(e, t, n, { signal: r } = {}) {
|
|
|
1854
1854
|
return i;
|
|
1855
1855
|
}
|
|
1856
1856
|
case U.Separate:
|
|
1857
|
-
return await
|
|
1857
|
+
return await ar(e, t, n, { signal: r });
|
|
1858
1858
|
default:
|
|
1859
1859
|
throw new Error(`Unsupported PlanarConfiguration: ${e.cachedTags.planarConfiguration}`);
|
|
1860
1860
|
}
|
|
1861
1861
|
}
|
|
1862
|
-
async function
|
|
1862
|
+
async function nt(e, t, n) {
|
|
1863
1863
|
const { x: r, y: o } = e.image.tileCount, i = r * o, a = e.cachedTags.samplesPerPixel, s = [...Array(a).keys()].map((l) => {
|
|
1864
1864
|
const c = l * i + n * r + t;
|
|
1865
1865
|
return e.image.getTileSize(c);
|
|
1866
1866
|
});
|
|
1867
1867
|
return Promise.all(s);
|
|
1868
1868
|
}
|
|
1869
|
-
async function
|
|
1870
|
-
const o = e._debug ? { label: "data" } : void 0, a = (await
|
|
1871
|
-
const c = await
|
|
1869
|
+
async function ar(e, t, n, { signal: r } = {}) {
|
|
1870
|
+
const o = e._debug ? { label: "data" } : void 0, a = (await nt(e, t, n)).map(async ({ offset: s, imageSize: l }) => {
|
|
1871
|
+
const c = await ot(e.image, s, l, e.dataSource, { signal: r, debug: o });
|
|
1872
1872
|
if (c === null)
|
|
1873
1873
|
throw new Error(`Tile at (${t}, ${n}) not found`);
|
|
1874
1874
|
return c;
|
|
1875
1875
|
});
|
|
1876
1876
|
return Promise.all(a);
|
|
1877
1877
|
}
|
|
1878
|
-
async function
|
|
1878
|
+
async function sr(e, t, { signal: n } = {}) {
|
|
1879
1879
|
const r = e._debug ? { label: "data" } : void 0;
|
|
1880
1880
|
switch (e.cachedTags.planarConfiguration) {
|
|
1881
1881
|
case U.Contig:
|
|
1882
|
-
return (await
|
|
1882
|
+
return (await at(e.image, t, e.dataSource, {
|
|
1883
1883
|
signal: n,
|
|
1884
1884
|
debug: r
|
|
1885
1885
|
})).map((i, a) => {
|
|
@@ -1890,23 +1890,23 @@ async function ar(e, t, { signal: n } = {}) {
|
|
|
1890
1890
|
return i;
|
|
1891
1891
|
});
|
|
1892
1892
|
case U.Separate:
|
|
1893
|
-
return
|
|
1893
|
+
return lr(e, t, { signal: n });
|
|
1894
1894
|
default:
|
|
1895
1895
|
throw new Error(`Unsupported PlanarConfiguration: ${e.cachedTags.planarConfiguration}`);
|
|
1896
1896
|
}
|
|
1897
1897
|
}
|
|
1898
|
-
async function
|
|
1899
|
-
const r = e._debug ? { label: "data" } : void 0, o = e.cachedTags.samplesPerPixel, a = (await Promise.all(t.map(([l, c]) =>
|
|
1898
|
+
async function lr(e, t, { signal: n } = {}) {
|
|
1899
|
+
const r = e._debug ? { label: "data" } : void 0, o = e.cachedTags.samplesPerPixel, a = (await Promise.all(t.map(([l, c]) => nt(e, l, c)))).flatMap((l) => l.map(({ offset: c, imageSize: u }) => ({
|
|
1900
1900
|
offset: c,
|
|
1901
1901
|
byteCount: u
|
|
1902
|
-
}))), s = await
|
|
1902
|
+
}))), s = await it(e.image, a, e.dataSource, { signal: n, debug: r });
|
|
1903
1903
|
return t.map(([l, c], u) => s.slice(u * o, u * o + o).map((h) => {
|
|
1904
1904
|
if (h === null)
|
|
1905
1905
|
throw new Error(`Tile at (${l}, ${c}) not found`);
|
|
1906
1906
|
return h;
|
|
1907
1907
|
}));
|
|
1908
1908
|
}
|
|
1909
|
-
async function
|
|
1909
|
+
async function rt(e, t, n, r, o) {
|
|
1910
1910
|
const { size: i, tileSize: a } = e;
|
|
1911
1911
|
if (a == null)
|
|
1912
1912
|
throw new Error("Tiff is not tiled");
|
|
@@ -1917,9 +1917,9 @@ async function nt(e, t, n, r, o) {
|
|
|
1917
1917
|
if (c >= u)
|
|
1918
1918
|
throw new Error(`Tile index is outside of tile range: ${c} >= ${u}`);
|
|
1919
1919
|
const { offset: h, imageSize: p } = await e.getTileSize(c);
|
|
1920
|
-
return
|
|
1920
|
+
return ot(e, h, p, r, o);
|
|
1921
1921
|
}
|
|
1922
|
-
async function
|
|
1922
|
+
async function ot(e, t, n, r, o) {
|
|
1923
1923
|
if (n === 0)
|
|
1924
1924
|
return null;
|
|
1925
1925
|
o?.debug !== void 0 && console.log(`[geotiff dataSource] ${o.debug.label}: offset=${t} length=${n}`);
|
|
@@ -1932,7 +1932,7 @@ async function rt(e, t, n, r, o) {
|
|
|
1932
1932
|
compression: a
|
|
1933
1933
|
} : { bytes: i, compression: a };
|
|
1934
1934
|
}
|
|
1935
|
-
async function
|
|
1935
|
+
async function it(e, t, n, r) {
|
|
1936
1936
|
if (t.length === 0)
|
|
1937
1937
|
return [];
|
|
1938
1938
|
const o = new Array(t.length), i = [], a = [];
|
|
@@ -1945,7 +1945,7 @@ async function ot(e, t, n, r) {
|
|
|
1945
1945
|
if (r?.debug !== void 0)
|
|
1946
1946
|
for (const c of i)
|
|
1947
1947
|
console.log(`[geotiff dataSource] ${r.debug.label}: offset=${c.offset} length=${c.length}`);
|
|
1948
|
-
const s = await
|
|
1948
|
+
const s = await Tn(n, i, {
|
|
1949
1949
|
coalesce: r?.coalesce,
|
|
1950
1950
|
maxRangeSize: r?.maxRangeSize,
|
|
1951
1951
|
signal: r?.signal
|
|
@@ -1956,7 +1956,7 @@ async function ot(e, t, n, r) {
|
|
|
1956
1956
|
}
|
|
1957
1957
|
return o;
|
|
1958
1958
|
}
|
|
1959
|
-
async function
|
|
1959
|
+
async function at(e, t, n, r) {
|
|
1960
1960
|
if (t.length === 0)
|
|
1961
1961
|
return [];
|
|
1962
1962
|
const { size: o, tileSize: i } = e;
|
|
@@ -1970,9 +1970,9 @@ async function it(e, t, n, r) {
|
|
|
1970
1970
|
throw new Error(`Tile index is outside of tile range: ${g} >= ${l}`);
|
|
1971
1971
|
return g;
|
|
1972
1972
|
}), u = await Promise.all(c.map((h) => e.getTileSize(h)));
|
|
1973
|
-
return
|
|
1973
|
+
return it(e, u.map((h) => ({ offset: h.offset, byteCount: h.imageSize })), n, r);
|
|
1974
1974
|
}
|
|
1975
|
-
function
|
|
1975
|
+
function cr(e, t, n, r) {
|
|
1976
1976
|
const { width: o, height: i } = e.image.getTileBounds(t, n);
|
|
1977
1977
|
if (o === e.tileWidth && i === e.tileHeight)
|
|
1978
1978
|
return r;
|
|
@@ -2002,7 +2002,7 @@ function T(e, t, n, r, o) {
|
|
|
2002
2002
|
s.set(e.subarray(l * i, l * i + a), l * a);
|
|
2003
2003
|
return s;
|
|
2004
2004
|
}
|
|
2005
|
-
function
|
|
2005
|
+
function st(e, t) {
|
|
2006
2006
|
const n = new Set(e), r = new Set(t);
|
|
2007
2007
|
if (n.size > 1)
|
|
2008
2008
|
throw new Error("Multiple sample formats are not supported.");
|
|
@@ -2016,7 +2016,7 @@ function at(e, t) {
|
|
|
2016
2016
|
bitsPerSample: i
|
|
2017
2017
|
};
|
|
2018
2018
|
}
|
|
2019
|
-
function
|
|
2019
|
+
function ur(e, { count: t }) {
|
|
2020
2020
|
if (e == null)
|
|
2021
2021
|
return null;
|
|
2022
2022
|
const o = new DOMParser().parseFromString(e, "text/xml").documentElement;
|
|
@@ -2061,11 +2061,11 @@ function cr(e, { count: t }) {
|
|
|
2061
2061
|
}
|
|
2062
2062
|
return { bandStatistics: i, offsets: a, scales: s };
|
|
2063
2063
|
}
|
|
2064
|
-
async function
|
|
2064
|
+
async function dr(e, t = {}) {
|
|
2065
2065
|
const { signal: n } = t, r = e.value(d.Compression);
|
|
2066
2066
|
if (r === null)
|
|
2067
2067
|
throw new Error("Compression tag should always exist.");
|
|
2068
|
-
const [o, i, a, s, l, c, u, h, p, g, y,
|
|
2068
|
+
const [o, i, a, s, l, c, u, h, p, g, y, S, b] = await Promise.all([
|
|
2069
2069
|
e.fetch(d.BitsPerSample, { signal: n }),
|
|
2070
2070
|
e.fetch(d.ColorMap, { signal: n }),
|
|
2071
2071
|
e.fetch(d.GdalNoData, { signal: n }),
|
|
@@ -2099,11 +2099,11 @@ async function ur(e, t = {}) {
|
|
|
2099
2099
|
predictor: y ?? _.None,
|
|
2100
2100
|
// Uint is the default sample format according to the spec
|
|
2101
2101
|
// https://web.archive.org/web/20240329145340/https://www.awaresystems.be/imaging/tiff/tifftags/sampleformat.html
|
|
2102
|
-
sampleFormat:
|
|
2102
|
+
sampleFormat: S ?? [A.Uint],
|
|
2103
2103
|
samplesPerPixel: b
|
|
2104
2104
|
};
|
|
2105
2105
|
}
|
|
2106
|
-
function
|
|
2106
|
+
function hr(e) {
|
|
2107
2107
|
const t = (n) => e.valueGeo(n) ?? null;
|
|
2108
2108
|
return {
|
|
2109
2109
|
// Configuration keys
|
|
@@ -2159,29 +2159,29 @@ function dr(e) {
|
|
|
2159
2159
|
verticalUnits: t(m.VerticalUnitsGeoKey)
|
|
2160
2160
|
};
|
|
2161
2161
|
}
|
|
2162
|
-
function
|
|
2162
|
+
function pr({ modelTiepoint: e, modelPixelScale: t, modelTransformation: n, rasterType: r }) {
|
|
2163
2163
|
let o;
|
|
2164
2164
|
if (e && t)
|
|
2165
|
-
o =
|
|
2165
|
+
o = mr(e, t);
|
|
2166
2166
|
else if (n)
|
|
2167
|
-
o =
|
|
2167
|
+
o = gr(n);
|
|
2168
2168
|
else
|
|
2169
2169
|
throw new Error("The image does not have an affine transformation.");
|
|
2170
|
-
return r === te.PixelIsPoint && (o =
|
|
2170
|
+
return r === te.PixelIsPoint && (o = se(o, ze(-0.5, -0.5))), o;
|
|
2171
2171
|
}
|
|
2172
|
-
function
|
|
2172
|
+
function mr(e, t) {
|
|
2173
2173
|
const n = e[3], r = e[4], o = t[0], i = -t[1];
|
|
2174
2174
|
return [o, 0, n, 0, i, r];
|
|
2175
2175
|
}
|
|
2176
|
-
function
|
|
2176
|
+
function gr(e) {
|
|
2177
2177
|
const t = e[3], n = e[7], r = e[1], o = e[4], i = e[0], a = e[5];
|
|
2178
2178
|
return [i, r, t, o, a, n];
|
|
2179
2179
|
}
|
|
2180
|
-
function
|
|
2181
|
-
const o =
|
|
2180
|
+
function lt(e, t, n, r = Math.floor) {
|
|
2181
|
+
const o = wt(e.transform), [i, a] = Be(o, t, n);
|
|
2182
2182
|
return [r(a), r(i)];
|
|
2183
2183
|
}
|
|
2184
|
-
function
|
|
2184
|
+
function ct(e, t, n, r = "center") {
|
|
2185
2185
|
let o, i;
|
|
2186
2186
|
switch (r) {
|
|
2187
2187
|
case "center":
|
|
@@ -2202,7 +2202,7 @@ function lt(e, t, n, r = "center") {
|
|
|
2202
2202
|
}
|
|
2203
2203
|
return Be(e.transform, o, i);
|
|
2204
2204
|
}
|
|
2205
|
-
class
|
|
2205
|
+
class fr {
|
|
2206
2206
|
cachedTags;
|
|
2207
2207
|
/** The data source used for fetching tile data. */
|
|
2208
2208
|
dataSource;
|
|
@@ -2257,7 +2257,7 @@ class gr {
|
|
|
2257
2257
|
*/
|
|
2258
2258
|
get transform() {
|
|
2259
2259
|
const t = this.geotiff.transform, n = this.geotiff.width / this.width, r = this.geotiff.height / this.height;
|
|
2260
|
-
return
|
|
2260
|
+
return se(t, St(n, r));
|
|
2261
2261
|
}
|
|
2262
2262
|
/** Image width in pixels. */
|
|
2263
2263
|
get width() {
|
|
@@ -2273,7 +2273,7 @@ class gr {
|
|
|
2273
2273
|
* @param options.signal An optional {@link AbortSignal} to cancel the fetch request.
|
|
2274
2274
|
*/
|
|
2275
2275
|
async fetchTile(t, n, r = {}) {
|
|
2276
|
-
return await
|
|
2276
|
+
return await Te(this, t, n, r);
|
|
2277
2277
|
}
|
|
2278
2278
|
/**
|
|
2279
2279
|
* Fetch multiple tiles in parallel.
|
|
@@ -2288,7 +2288,7 @@ class gr {
|
|
|
2288
2288
|
* @see {@link fetchTile} for single-tile fetching.
|
|
2289
2289
|
*/
|
|
2290
2290
|
async fetchTiles(t, n = {}) {
|
|
2291
|
-
return await
|
|
2291
|
+
return await tt(this, t, n);
|
|
2292
2292
|
}
|
|
2293
2293
|
// TiledMixin
|
|
2294
2294
|
// Transform mixin
|
|
@@ -2302,7 +2302,7 @@ class gr {
|
|
|
2302
2302
|
* @returns [row, col] pixel indices.
|
|
2303
2303
|
*/
|
|
2304
2304
|
index(t, n, r = Math.floor) {
|
|
2305
|
-
return
|
|
2305
|
+
return lt(this, t, n, r);
|
|
2306
2306
|
}
|
|
2307
2307
|
/**
|
|
2308
2308
|
* Get the geographic (x, y) coordinate of the pixel at (row, col).
|
|
@@ -2313,7 +2313,7 @@ class gr {
|
|
|
2313
2313
|
* @returns [x, y] in the CRS.
|
|
2314
2314
|
*/
|
|
2315
2315
|
xy(t, n, r = "center") {
|
|
2316
|
-
return
|
|
2316
|
+
return ct(this, t, n, r);
|
|
2317
2317
|
}
|
|
2318
2318
|
}
|
|
2319
2319
|
class x {
|
|
@@ -2387,21 +2387,21 @@ class x {
|
|
|
2387
2387
|
if (a.length === 0)
|
|
2388
2388
|
throw new Error("TIFF does not contain any IFDs");
|
|
2389
2389
|
await Promise.all(a.map((C) => C.init(!0, { signal: o })));
|
|
2390
|
-
const s = a[0], l =
|
|
2390
|
+
const s = a[0], l = hr(s), c = /* @__PURE__ */ new Map(), u = /* @__PURE__ */ new Map();
|
|
2391
2391
|
for (let C = 1; C < a.length; C++) {
|
|
2392
2392
|
const L = a[C], E = L.size, G = `${E.width},${E.height}`;
|
|
2393
|
-
|
|
2393
|
+
yr(L) ? u.set(G, L) : c.set(G, L);
|
|
2394
2394
|
}
|
|
2395
2395
|
const h = `${s.size.width},${s.size.height}`, p = u.get(h) ?? null, g = Array.from(c.entries());
|
|
2396
2396
|
g.sort((C, L) => {
|
|
2397
2397
|
const E = C[1].size, G = L[1].size;
|
|
2398
2398
|
return G.width * G.height - E.width * E.height;
|
|
2399
2399
|
});
|
|
2400
|
-
const y = await
|
|
2400
|
+
const y = await dr(s, { signal: o }), S = ur(y.gdalMetadata, {
|
|
2401
2401
|
count: y.samplesPerPixel
|
|
2402
|
-
}), b = new x(t, s, p, l, [], y, n,
|
|
2402
|
+
}), b = new x(t, s, p, l, [], y, n, S, i), v = g.map(([C, L]) => {
|
|
2403
2403
|
const E = u.get(C) ?? null;
|
|
2404
|
-
return new
|
|
2404
|
+
return new fr(b, l, L, E, y, n);
|
|
2405
2405
|
});
|
|
2406
2406
|
return b.overviews = v, b;
|
|
2407
2407
|
}
|
|
@@ -2417,7 +2417,7 @@ class x {
|
|
|
2417
2417
|
* @returns A Promise that resolves to a GeoTIFF instance.
|
|
2418
2418
|
*/
|
|
2419
2419
|
static async fromArrayBuffer(t) {
|
|
2420
|
-
const n = new
|
|
2420
|
+
const n = new ue("memory://input.tif", t);
|
|
2421
2421
|
return await x.open({
|
|
2422
2422
|
dataSource: n,
|
|
2423
2423
|
headerSource: n
|
|
@@ -2443,9 +2443,9 @@ class x {
|
|
|
2443
2443
|
static async fromUrl(t, { chunkSize: n = 64 * 1024, cacheSize: r = 8 * 1024 * 1024, signal: o, debug: i } = {}) {
|
|
2444
2444
|
const a = new $(t, {});
|
|
2445
2445
|
a.metadata = { size: Number.POSITIVE_INFINITY };
|
|
2446
|
-
const s = new
|
|
2447
|
-
new
|
|
2448
|
-
new
|
|
2446
|
+
const s = new cn(a, [
|
|
2447
|
+
new dn({ size: n }),
|
|
2448
|
+
new ln({ size: r })
|
|
2449
2449
|
]);
|
|
2450
2450
|
return await x.open({
|
|
2451
2451
|
// Tile data reads bypass the header cache (raw source).
|
|
@@ -2465,7 +2465,7 @@ class x {
|
|
|
2465
2465
|
* See also {@link GeoTIFF.epsg} for the EPSG code directly from the TIFF tags.
|
|
2466
2466
|
*/
|
|
2467
2467
|
get crs() {
|
|
2468
|
-
return this._crs === void 0 && (this._crs =
|
|
2468
|
+
return this._crs === void 0 && (this._crs = kn(this.gkd)), this._crs;
|
|
2469
2469
|
}
|
|
2470
2470
|
/** Image width in pixels. */
|
|
2471
2471
|
get width() {
|
|
@@ -2536,7 +2536,7 @@ class x {
|
|
|
2536
2536
|
*/
|
|
2537
2537
|
get transform() {
|
|
2538
2538
|
const { modelPixelScale: t, modelTiepoint: n, modelTransformation: r } = this.cachedTags;
|
|
2539
|
-
return
|
|
2539
|
+
return pr({
|
|
2540
2540
|
modelTiepoint: n,
|
|
2541
2541
|
modelPixelScale: t,
|
|
2542
2542
|
modelTransformation: r,
|
|
@@ -2554,7 +2554,7 @@ class x {
|
|
|
2554
2554
|
* @param options.signal An optional {@link AbortSignal} to cancel the fetch request.
|
|
2555
2555
|
*/
|
|
2556
2556
|
async fetchTile(t, n, r = {}) {
|
|
2557
|
-
return await
|
|
2557
|
+
return await Te(this, t, n, r);
|
|
2558
2558
|
}
|
|
2559
2559
|
/**
|
|
2560
2560
|
* Fetch multiple tiles in parallel.
|
|
@@ -2569,7 +2569,7 @@ class x {
|
|
|
2569
2569
|
* @see {@link fetchTile} for single-tile fetching.
|
|
2570
2570
|
*/
|
|
2571
2571
|
async fetchTiles(t, n = {}) {
|
|
2572
|
-
return await
|
|
2572
|
+
return await tt(this, t, n);
|
|
2573
2573
|
}
|
|
2574
2574
|
// Transform mixin
|
|
2575
2575
|
/**
|
|
@@ -2582,7 +2582,7 @@ class x {
|
|
|
2582
2582
|
* @returns [row, col] pixel indices.
|
|
2583
2583
|
*/
|
|
2584
2584
|
index(t, n, r = Math.floor) {
|
|
2585
|
-
return
|
|
2585
|
+
return lt(this, t, n, r);
|
|
2586
2586
|
}
|
|
2587
2587
|
/**
|
|
2588
2588
|
* Get the geographic (x, y) coordinate of the pixel at (row, col).
|
|
@@ -2593,14 +2593,14 @@ class x {
|
|
|
2593
2593
|
* @returns [x, y] in the CRS.
|
|
2594
2594
|
*/
|
|
2595
2595
|
xy(t, n, r = "center") {
|
|
2596
|
-
return
|
|
2596
|
+
return ct(this, t, n, r);
|
|
2597
2597
|
}
|
|
2598
2598
|
}
|
|
2599
|
-
function
|
|
2599
|
+
function yr(e) {
|
|
2600
2600
|
const t = e.value(d.SubFileType), n = e.value(d.Photometric);
|
|
2601
2601
|
return t !== null && (t & J.Mask) !== 0 && n === F.Mask;
|
|
2602
2602
|
}
|
|
2603
|
-
let
|
|
2603
|
+
let wr = class {
|
|
2604
2604
|
worker;
|
|
2605
2605
|
jobIdCounter = 0;
|
|
2606
2606
|
jobs = /* @__PURE__ */ new Map();
|
|
@@ -2624,14 +2624,14 @@ let yr = class {
|
|
|
2624
2624
|
this.worker.terminate();
|
|
2625
2625
|
}
|
|
2626
2626
|
};
|
|
2627
|
-
const
|
|
2627
|
+
const Sr = typeof navigator < "u" ? navigator.hardwareConcurrency ?? 2 : 2;
|
|
2628
2628
|
class oe {
|
|
2629
2629
|
workerWrappers;
|
|
2630
2630
|
constructor(t = {}) {
|
|
2631
|
-
const { size: n =
|
|
2631
|
+
const { size: n = Sr, createWorker: r } = t;
|
|
2632
2632
|
if (this.workerWrappers = [], r && n > 0)
|
|
2633
2633
|
for (let o = 0; o < n; o++)
|
|
2634
|
-
this.workerWrappers.push(new
|
|
2634
|
+
this.workerWrappers.push(new wr(r()));
|
|
2635
2635
|
}
|
|
2636
2636
|
/** True when workers are available for off-main-thread decoding. */
|
|
2637
2637
|
get hasWorkers() {
|
|
@@ -2649,7 +2649,7 @@ class oe {
|
|
|
2649
2649
|
*/
|
|
2650
2650
|
async decode(t, n, r) {
|
|
2651
2651
|
if (!this.hasWorkers)
|
|
2652
|
-
return
|
|
2652
|
+
return ce(t, n, r);
|
|
2653
2653
|
const o = this.leastLoaded(), i = {
|
|
2654
2654
|
compression: n,
|
|
2655
2655
|
metadata: r,
|
|
@@ -2671,7 +2671,7 @@ class oe {
|
|
|
2671
2671
|
}
|
|
2672
2672
|
}
|
|
2673
2673
|
let H = null;
|
|
2674
|
-
function
|
|
2674
|
+
function Pr() {
|
|
2675
2675
|
return H !== null || (H = new oe({
|
|
2676
2676
|
createWorker: () => new Worker(new URL(
|
|
2677
2677
|
/* @vite-ignore */
|
|
@@ -2680,7 +2680,7 @@ function Sr() {
|
|
|
2680
2680
|
), { type: "module" })
|
|
2681
2681
|
})), H;
|
|
2682
2682
|
}
|
|
2683
|
-
function
|
|
2683
|
+
function br(e) {
|
|
2684
2684
|
const { height: t, width: n } = e;
|
|
2685
2685
|
if (e.layout === "band-separate")
|
|
2686
2686
|
throw new Error("Band-separate images not yet implemented.");
|
|
@@ -2698,10 +2698,10 @@ function Pr(e) {
|
|
|
2698
2698
|
} else
|
|
2699
2699
|
throw new Error(`Unexpected number of channels in raster data: ${e.data.length / (t * n)}`);
|
|
2700
2700
|
}
|
|
2701
|
-
async function
|
|
2701
|
+
async function Cr(e) {
|
|
2702
2702
|
return typeof e == "string" || e instanceof URL ? await x.fromUrl(e) : e instanceof ArrayBuffer ? await x.fromArrayBuffer(e) : e;
|
|
2703
2703
|
}
|
|
2704
|
-
function
|
|
2704
|
+
function Lr(e, t) {
|
|
2705
2705
|
const [n, r, o, i] = e.bbox, a = [
|
|
2706
2706
|
t.forward([n, r]),
|
|
2707
2707
|
// bottom-left
|
|
@@ -2714,17 +2714,17 @@ function Cr(e, t) {
|
|
|
2714
2714
|
], s = a.map((g) => g[0]), l = a.map((g) => g[1]), c = Math.min(...s), u = Math.min(...l), h = Math.max(...s), p = Math.max(...l);
|
|
2715
2715
|
return { west: c, south: u, east: h, north: p };
|
|
2716
2716
|
}
|
|
2717
|
-
const
|
|
2717
|
+
const Ir = (
|
|
2718
2718
|
/* glsl */
|
|
2719
2719
|
`
|
|
2720
2720
|
vec3 black_zero_to_rgb(float value) {
|
|
2721
2721
|
return vec3(value, value, value);
|
|
2722
2722
|
}
|
|
2723
2723
|
`
|
|
2724
|
-
),
|
|
2724
|
+
), Gr = {
|
|
2725
2725
|
name: "black-is-zero",
|
|
2726
2726
|
inject: {
|
|
2727
|
-
"fs:#decl":
|
|
2727
|
+
"fs:#decl": Ir,
|
|
2728
2728
|
"fs:DECKGL_FILTER_COLOR": (
|
|
2729
2729
|
/* glsl */
|
|
2730
2730
|
`
|
|
@@ -2732,7 +2732,7 @@ const Lr = (
|
|
|
2732
2732
|
`
|
|
2733
2733
|
)
|
|
2734
2734
|
}
|
|
2735
|
-
},
|
|
2735
|
+
}, vr = (
|
|
2736
2736
|
/* glsl */
|
|
2737
2737
|
`
|
|
2738
2738
|
const vec3 D65 = vec3(
|
|
@@ -2777,10 +2777,10 @@ const Lr = (
|
|
|
2777
2777
|
return clamp(rgb, 0.0, 1.0);
|
|
2778
2778
|
}
|
|
2779
2779
|
`
|
|
2780
|
-
),
|
|
2780
|
+
), Er = {
|
|
2781
2781
|
name: "cielab-to-rgb",
|
|
2782
2782
|
inject: {
|
|
2783
|
-
"fs:#decl":
|
|
2783
|
+
"fs:#decl": vr,
|
|
2784
2784
|
"fs:DECKGL_FILTER_COLOR": (
|
|
2785
2785
|
/* glsl */
|
|
2786
2786
|
`
|
|
@@ -2788,7 +2788,7 @@ const Lr = (
|
|
|
2788
2788
|
`
|
|
2789
2789
|
)
|
|
2790
2790
|
}
|
|
2791
|
-
},
|
|
2791
|
+
}, Fr = (
|
|
2792
2792
|
/* glsl */
|
|
2793
2793
|
`
|
|
2794
2794
|
vec3 cmykToRgb(vec4 cmyk) {
|
|
@@ -2802,10 +2802,10 @@ const Lr = (
|
|
|
2802
2802
|
);
|
|
2803
2803
|
}
|
|
2804
2804
|
`
|
|
2805
|
-
),
|
|
2805
|
+
), Ar = {
|
|
2806
2806
|
name: "cmyk-to-rgb",
|
|
2807
2807
|
inject: {
|
|
2808
|
-
"fs:#decl":
|
|
2808
|
+
"fs:#decl": Fr,
|
|
2809
2809
|
"fs:DECKGL_FILTER_COLOR": (
|
|
2810
2810
|
/* glsl */
|
|
2811
2811
|
`
|
|
@@ -2813,17 +2813,17 @@ const Lr = (
|
|
|
2813
2813
|
`
|
|
2814
2814
|
)
|
|
2815
2815
|
}
|
|
2816
|
-
},
|
|
2816
|
+
}, jr = (
|
|
2817
2817
|
/* glsl */
|
|
2818
2818
|
`
|
|
2819
2819
|
vec3 white_zero_to_rgb(float value) {
|
|
2820
2820
|
return vec3(1.0 - value, 1.0 - value, 1.0 - value);
|
|
2821
2821
|
}
|
|
2822
2822
|
`
|
|
2823
|
-
),
|
|
2823
|
+
), Rr = {
|
|
2824
2824
|
name: "white-is-zero",
|
|
2825
2825
|
inject: {
|
|
2826
|
-
"fs:#decl":
|
|
2826
|
+
"fs:#decl": jr,
|
|
2827
2827
|
"fs:DECKGL_FILTER_COLOR": (
|
|
2828
2828
|
/* glsl */
|
|
2829
2829
|
`
|
|
@@ -2831,7 +2831,7 @@ const Lr = (
|
|
|
2831
2831
|
`
|
|
2832
2832
|
)
|
|
2833
2833
|
}
|
|
2834
|
-
},
|
|
2834
|
+
}, Ur = {
|
|
2835
2835
|
name: "mask-texture",
|
|
2836
2836
|
inject: {
|
|
2837
2837
|
"fs:#decl": "uniform sampler2D maskTexture;",
|
|
@@ -2849,18 +2849,18 @@ const Lr = (
|
|
|
2849
2849
|
maskTexture: e.maskTexture
|
|
2850
2850
|
})
|
|
2851
2851
|
};
|
|
2852
|
-
function
|
|
2853
|
-
const r =
|
|
2852
|
+
function Mr(e, t, n) {
|
|
2853
|
+
const r = Or(e), o = Kr(t), i = xr(n), a = `${r}:${i}:${o}`, s = Dr[a];
|
|
2854
2854
|
if (!s)
|
|
2855
2855
|
throw new Error(`Unsupported texture format for SamplesPerPixel=${e}, BitsPerSample=${t}, SampleFormat=${n}`);
|
|
2856
2856
|
return s;
|
|
2857
2857
|
}
|
|
2858
|
-
function
|
|
2858
|
+
function Or(e) {
|
|
2859
2859
|
if (e === 1 || e === 2 || e === 3 || e === 4)
|
|
2860
2860
|
return e;
|
|
2861
2861
|
throw new Error(`Unsupported SamplesPerPixel ${e}. Only 1, 2, 3, or 4 are supported.`);
|
|
2862
2862
|
}
|
|
2863
|
-
function
|
|
2863
|
+
function Kr(e) {
|
|
2864
2864
|
const t = e[0];
|
|
2865
2865
|
for (let n = 1; n < e.length; n++)
|
|
2866
2866
|
if (e[n] !== t)
|
|
@@ -2869,7 +2869,7 @@ function Or(e) {
|
|
|
2869
2869
|
throw new Error(`Unsupported BitsPerSample ${t}. Only 8, 16, or 32 are supported.`);
|
|
2870
2870
|
return t;
|
|
2871
2871
|
}
|
|
2872
|
-
function
|
|
2872
|
+
function xr(e) {
|
|
2873
2873
|
const t = e[0];
|
|
2874
2874
|
for (let n = 1; n < e.length; n++)
|
|
2875
2875
|
if (e[n] !== t)
|
|
@@ -2885,7 +2885,7 @@ function Kr(e) {
|
|
|
2885
2885
|
throw new Error(`Unsupported SampleFormat ${e}`);
|
|
2886
2886
|
}
|
|
2887
2887
|
}
|
|
2888
|
-
const
|
|
2888
|
+
const Dr = {
|
|
2889
2889
|
// 1 byte per pixel
|
|
2890
2890
|
"1:sint:8": "r8sint",
|
|
2891
2891
|
"1:uint:8": "r8uint",
|
|
@@ -2932,21 +2932,21 @@ const xr = {
|
|
|
2932
2932
|
"4:sint:32": "rgba32sint",
|
|
2933
2933
|
"4:uint:32": "rgba32uint"
|
|
2934
2934
|
};
|
|
2935
|
-
function
|
|
2935
|
+
function Nr(e, t) {
|
|
2936
2936
|
const { sampleFormat: n } = e.cachedTags;
|
|
2937
2937
|
if (n === null)
|
|
2938
2938
|
throw new Error("SampleFormat tag is required to infer render pipeline");
|
|
2939
2939
|
switch (n[0]) {
|
|
2940
2940
|
// Unsigned integers
|
|
2941
2941
|
case A.Uint:
|
|
2942
|
-
return
|
|
2942
|
+
return zr(e, t);
|
|
2943
2943
|
}
|
|
2944
2944
|
throw new Error(`Inferring render pipeline for non-unsigned integers not yet supported. Found SampleFormat: ${n}`);
|
|
2945
2945
|
}
|
|
2946
|
-
function
|
|
2946
|
+
function zr(e, t) {
|
|
2947
2947
|
const { bitsPerSample: n, colorMap: r, photometric: o, sampleFormat: i, samplesPerPixel: a, nodata: s } = e.cachedTags, l = [
|
|
2948
2948
|
{
|
|
2949
|
-
module:
|
|
2949
|
+
module: bt,
|
|
2950
2950
|
props: {
|
|
2951
2951
|
textureName: (g) => g.texture
|
|
2952
2952
|
}
|
|
@@ -2955,18 +2955,18 @@ function Nr(e, t) {
|
|
|
2955
2955
|
if (s !== null) {
|
|
2956
2956
|
const g = 2 ** n[0] - 1, y = s / g;
|
|
2957
2957
|
l.push({
|
|
2958
|
-
module:
|
|
2958
|
+
module: Ct,
|
|
2959
2959
|
props: { value: y }
|
|
2960
2960
|
});
|
|
2961
2961
|
}
|
|
2962
2962
|
e.maskImage !== null && l.push({
|
|
2963
|
-
module:
|
|
2963
|
+
module: Ur,
|
|
2964
2964
|
props: {
|
|
2965
2965
|
// TODO: how to handle if mask failed to load and is undefined here
|
|
2966
2966
|
maskTexture: (g) => g.mask
|
|
2967
2967
|
}
|
|
2968
2968
|
});
|
|
2969
|
-
const c =
|
|
2969
|
+
const c = Br({
|
|
2970
2970
|
count: a,
|
|
2971
2971
|
photometric: o,
|
|
2972
2972
|
device: t,
|
|
@@ -2981,71 +2981,71 @@ function Nr(e, t) {
|
|
|
2981
2981
|
minFilter: "linear"
|
|
2982
2982
|
};
|
|
2983
2983
|
return { getTileData: async (g, y) => {
|
|
2984
|
-
const { device:
|
|
2984
|
+
const { device: S, x: b, y: v, signal: C, pool: L } = y, E = await g.fetchTile(b, v, {
|
|
2985
2985
|
boundless: !1,
|
|
2986
2986
|
pool: L,
|
|
2987
2987
|
signal: C
|
|
2988
2988
|
});
|
|
2989
2989
|
let { array: G } = E;
|
|
2990
|
-
const { width:
|
|
2991
|
-
let
|
|
2992
|
-
if (a === 3 && (G =
|
|
2990
|
+
const { width: de, height: he, mask: q } = G;
|
|
2991
|
+
let pe = a;
|
|
2992
|
+
if (a === 3 && (G = br(G), pe = 4), G.layout === "band-separate")
|
|
2993
2993
|
throw new Error("Band-separate images not yet implemented.");
|
|
2994
|
-
const
|
|
2994
|
+
const ft = Mr(
|
|
2995
2995
|
// Add one sample for added alpha channel
|
|
2996
|
-
|
|
2996
|
+
pe,
|
|
2997
2997
|
n,
|
|
2998
2998
|
i
|
|
2999
2999
|
);
|
|
3000
|
-
let
|
|
3001
|
-
const
|
|
3000
|
+
let me = G.data.byteLength;
|
|
3001
|
+
const yt = S.createTexture({
|
|
3002
3002
|
data: G.data,
|
|
3003
|
-
format:
|
|
3004
|
-
width:
|
|
3005
|
-
height:
|
|
3003
|
+
format: ft,
|
|
3004
|
+
width: de,
|
|
3005
|
+
height: he,
|
|
3006
3006
|
sampler: u
|
|
3007
3007
|
});
|
|
3008
|
-
let
|
|
3009
|
-
return q !== null && (
|
|
3008
|
+
let ge;
|
|
3009
|
+
return q !== null && (ge = S.createTexture({
|
|
3010
3010
|
data: q,
|
|
3011
3011
|
// Single-channel 8-bit texture for the mask
|
|
3012
3012
|
format: "r8unorm",
|
|
3013
|
-
width:
|
|
3014
|
-
height:
|
|
3013
|
+
width: de,
|
|
3014
|
+
height: he,
|
|
3015
3015
|
// Use nearest filtering for the mask to avoid interpolated edges/halos
|
|
3016
3016
|
sampler: {
|
|
3017
3017
|
minFilter: "nearest",
|
|
3018
3018
|
magFilter: "nearest"
|
|
3019
3019
|
}
|
|
3020
|
-
}),
|
|
3021
|
-
texture:
|
|
3022
|
-
mask:
|
|
3023
|
-
byteLength:
|
|
3020
|
+
}), me += q.byteLength), {
|
|
3021
|
+
texture: yt,
|
|
3022
|
+
mask: ge,
|
|
3023
|
+
byteLength: me,
|
|
3024
3024
|
height: G.height,
|
|
3025
3025
|
width: G.width
|
|
3026
3026
|
};
|
|
3027
3027
|
}, renderTile: (g) => ({
|
|
3028
|
-
renderPipeline: l.map((y,
|
|
3028
|
+
renderPipeline: l.map((y, S) => _r(y, g))
|
|
3029
3029
|
}) };
|
|
3030
3030
|
}
|
|
3031
|
-
function
|
|
3031
|
+
function Br({ count: e, colorMap: t, device: n, photometric: r }) {
|
|
3032
3032
|
if (e === 3 || e === 4)
|
|
3033
3033
|
return null;
|
|
3034
3034
|
switch (r) {
|
|
3035
3035
|
case F.MinIsWhite:
|
|
3036
3036
|
return {
|
|
3037
|
-
module:
|
|
3037
|
+
module: Rr
|
|
3038
3038
|
};
|
|
3039
3039
|
case F.MinIsBlack:
|
|
3040
3040
|
return {
|
|
3041
|
-
module:
|
|
3041
|
+
module: Gr
|
|
3042
3042
|
};
|
|
3043
3043
|
case F.Rgb:
|
|
3044
3044
|
return null;
|
|
3045
3045
|
case F.Palette: {
|
|
3046
3046
|
if (!t)
|
|
3047
3047
|
throw new Error("ColorMap is required for PhotometricInterpretation Palette");
|
|
3048
|
-
const { data: o, width: i, height: a } =
|
|
3048
|
+
const { data: o, width: i, height: a } = Dt(t), s = n.createTexture({
|
|
3049
3049
|
dimension: "2d-array",
|
|
3050
3050
|
data: o,
|
|
3051
3051
|
format: "rgba8unorm",
|
|
@@ -3062,7 +3062,7 @@ function zr({ count: e, colorMap: t, device: n, photometric: r }) {
|
|
|
3062
3062
|
}
|
|
3063
3063
|
});
|
|
3064
3064
|
return {
|
|
3065
|
-
module:
|
|
3065
|
+
module: Pt,
|
|
3066
3066
|
props: {
|
|
3067
3067
|
colormapTexture: s
|
|
3068
3068
|
}
|
|
@@ -3071,19 +3071,19 @@ function zr({ count: e, colorMap: t, device: n, photometric: r }) {
|
|
|
3071
3071
|
// Not sure why cogeotiff calls this "Separated", but it means CMYK
|
|
3072
3072
|
case F.Separated:
|
|
3073
3073
|
return {
|
|
3074
|
-
module:
|
|
3074
|
+
module: Ar
|
|
3075
3075
|
};
|
|
3076
3076
|
case F.Ycbcr:
|
|
3077
3077
|
return null;
|
|
3078
3078
|
case F.Cielab:
|
|
3079
3079
|
return {
|
|
3080
|
-
module:
|
|
3080
|
+
module: Er
|
|
3081
3081
|
};
|
|
3082
3082
|
default:
|
|
3083
3083
|
throw new Error(`Unsupported PhotometricInterpretation ${r}`);
|
|
3084
3084
|
}
|
|
3085
3085
|
}
|
|
3086
|
-
function
|
|
3086
|
+
function _r(e, t) {
|
|
3087
3087
|
const { module: n, props: r } = e;
|
|
3088
3088
|
if (!r)
|
|
3089
3089
|
return { module: n };
|
|
@@ -3094,11 +3094,11 @@ function Br(e, t) {
|
|
|
3094
3094
|
}
|
|
3095
3095
|
return { module: n, props: o };
|
|
3096
3096
|
}
|
|
3097
|
-
function
|
|
3097
|
+
function $r(e, t) {
|
|
3098
3098
|
const r = [
|
|
3099
3099
|
...[...e.overviews].reverse(),
|
|
3100
3100
|
e
|
|
3101
|
-
].map((o) => new
|
|
3101
|
+
].map((o) => new Lt({
|
|
3102
3102
|
affine: o.transform,
|
|
3103
3103
|
arrayWidth: o.width,
|
|
3104
3104
|
arrayHeight: o.height,
|
|
@@ -3106,7 +3106,7 @@ function _r(e, t) {
|
|
|
3106
3106
|
tileHeight: o.tileHeight,
|
|
3107
3107
|
mpu: t.mpu
|
|
3108
3108
|
}));
|
|
3109
|
-
return new
|
|
3109
|
+
return new It({
|
|
3110
3110
|
levels: r,
|
|
3111
3111
|
projectTo3857: t.projectTo3857,
|
|
3112
3112
|
projectFrom3857: t.projectFrom3857,
|
|
@@ -3114,7 +3114,7 @@ function _r(e, t) {
|
|
|
3114
3114
|
projectFrom4326: t.projectFrom4326
|
|
3115
3115
|
});
|
|
3116
3116
|
}
|
|
3117
|
-
class
|
|
3117
|
+
class kr extends fe {
|
|
3118
3118
|
static layerName = "COGLayer";
|
|
3119
3119
|
// COGLayer's getTileData signature differs from the base class's, so
|
|
3120
3120
|
// `DefaultProps<COGLayerProps>` is not assignable to
|
|
@@ -3122,8 +3122,8 @@ class $r extends ge {
|
|
|
3122
3122
|
// to keep inheritance happy. The only COG-specific default is
|
|
3123
3123
|
// `epsgResolver`; all behavior still flows from the base class.
|
|
3124
3124
|
static defaultProps = {
|
|
3125
|
-
...
|
|
3126
|
-
epsgResolver:
|
|
3125
|
+
...fe.defaultProps,
|
|
3126
|
+
epsgResolver: Gt
|
|
3127
3127
|
};
|
|
3128
3128
|
initializeState() {
|
|
3129
3129
|
this.setState({});
|
|
@@ -3142,12 +3142,12 @@ class $r extends ge {
|
|
|
3142
3142
|
});
|
|
3143
3143
|
}
|
|
3144
3144
|
async _parseGeoTIFF() {
|
|
3145
|
-
const t = await
|
|
3145
|
+
const t = await Cr(this.props.geotiff), n = t.crs, r = typeof n == "number" ? await this.props.epsgResolver(n) : vt(n), o = ye(r, "EPSG:4326"), i = (S, b) => o.forward([S, b], !1), a = (S, b) => o.inverse([S, b], !1), s = ye(r, "EPSG:3857"), l = Ft((S, b) => s.forward([S, b], !1), i), c = (S, b) => s.inverse([S, b], !1), u = r.units;
|
|
3146
3146
|
if (!u)
|
|
3147
3147
|
throw new Error("Source projection is missing 'units' property, cannot compute meters per unit");
|
|
3148
|
-
const h =
|
|
3148
|
+
const h = Et(u, {
|
|
3149
3149
|
semiMajorAxis: r.datum?.a ?? r.a
|
|
3150
|
-
}), p =
|
|
3150
|
+
}), p = $r(t, {
|
|
3151
3151
|
projectTo4326: i,
|
|
3152
3152
|
projectFrom4326: a,
|
|
3153
3153
|
projectTo3857: l,
|
|
@@ -3155,14 +3155,14 @@ class $r extends ge {
|
|
|
3155
3155
|
mpu: h
|
|
3156
3156
|
});
|
|
3157
3157
|
if (this.props.onGeoTIFFLoad) {
|
|
3158
|
-
const
|
|
3158
|
+
const S = Lr(t, o);
|
|
3159
3159
|
this.props.onGeoTIFFLoad(t, {
|
|
3160
3160
|
projection: r,
|
|
3161
|
-
geographicBounds:
|
|
3161
|
+
geographicBounds: S
|
|
3162
3162
|
});
|
|
3163
3163
|
}
|
|
3164
3164
|
let g, y;
|
|
3165
|
-
(!this.props.getTileData || !this.props.renderTile) && ({ getTileData: g, renderTile: y } =
|
|
3165
|
+
(!this.props.getTileData || !this.props.renderTile) && ({ getTileData: g, renderTile: y } = Nr(t, this.context.device)), this.setState({
|
|
3166
3166
|
geotiff: t,
|
|
3167
3167
|
tilesetDescriptor: p,
|
|
3168
3168
|
defaultGetTileData: g,
|
|
@@ -3188,7 +3188,7 @@ class $r extends ge {
|
|
|
3188
3188
|
x: a,
|
|
3189
3189
|
y: s,
|
|
3190
3190
|
signal: i.signal,
|
|
3191
|
-
pool: this.props.pool ??
|
|
3191
|
+
pool: this.props.pool ?? Pr()
|
|
3192
3192
|
});
|
|
3193
3193
|
} : void 0;
|
|
3194
3194
|
}
|
|
@@ -3198,7 +3198,7 @@ class $r extends ge {
|
|
|
3198
3198
|
return t;
|
|
3199
3199
|
}
|
|
3200
3200
|
}
|
|
3201
|
-
const
|
|
3201
|
+
const ut = `var j;
|
|
3202
3202
|
(function(e) {
|
|
3203
3203
|
e[e.Big = 19789] = "Big", e[e.Little = 18761] = "Little";
|
|
3204
3204
|
})(j || (j = {}));
|
|
@@ -3503,11 +3503,11 @@ export {
|
|
|
3503
3503
|
t as C,
|
|
3504
3504
|
S as D
|
|
3505
3505
|
};
|
|
3506
|
-
`,
|
|
3507
|
-
function
|
|
3506
|
+
`, Ue = typeof self < "u" && self.Blob && new Blob(["URL.revokeObjectURL(import.meta.url);", ut], { type: "text/javascript;charset=utf-8" });
|
|
3507
|
+
function Wr(e) {
|
|
3508
3508
|
let t;
|
|
3509
3509
|
try {
|
|
3510
|
-
if (t =
|
|
3510
|
+
if (t = Ue && (self.URL || self.webkitURL).createObjectURL(Ue), !t) throw "";
|
|
3511
3511
|
const n = new Worker(t, {
|
|
3512
3512
|
type: "module",
|
|
3513
3513
|
name: e?.name
|
|
@@ -3517,7 +3517,7 @@ function kr(e) {
|
|
|
3517
3517
|
}), n;
|
|
3518
3518
|
} catch {
|
|
3519
3519
|
return new Worker(
|
|
3520
|
-
"data:text/javascript;charset=utf-8," + encodeURIComponent(
|
|
3520
|
+
"data:text/javascript;charset=utf-8," + encodeURIComponent(ut),
|
|
3521
3521
|
{
|
|
3522
3522
|
type: "module",
|
|
3523
3523
|
name: e?.name
|
|
@@ -3525,42 +3525,53 @@ function kr(e) {
|
|
|
3525
3525
|
);
|
|
3526
3526
|
}
|
|
3527
3527
|
}
|
|
3528
|
-
const Z = /* @__PURE__ */ new WeakMap(),
|
|
3529
|
-
|
|
3528
|
+
const Z = /* @__PURE__ */ new WeakMap(), ie = async (e, {
|
|
3529
|
+
device: t,
|
|
3530
|
+
x: n,
|
|
3531
|
+
y: r,
|
|
3532
|
+
signal: o,
|
|
3533
|
+
pool: i,
|
|
3534
|
+
dropDecode: a
|
|
3535
|
+
}) => {
|
|
3536
|
+
const s = () => {
|
|
3530
3537
|
throw o?.reason ?? new DOMException("aborted", "AbortError");
|
|
3531
3538
|
};
|
|
3532
|
-
o?.aborted &&
|
|
3533
|
-
const
|
|
3534
|
-
o?.aborted &&
|
|
3535
|
-
const
|
|
3536
|
-
width:
|
|
3537
|
-
height:
|
|
3538
|
-
byteLength:
|
|
3539
|
+
o?.aborted && s();
|
|
3540
|
+
const l = await e.fetchTile(n, r, { boundless: !1, pool: i, signal: o });
|
|
3541
|
+
o?.aborted && s();
|
|
3542
|
+
const c = l.array, u = e.cachedTags.samplesPerPixel, h = c.layout === "band-separate" ? c.bands.reduce((S, b) => S + b.byteLength || 0, 0) : c.data.byteLength, p = {
|
|
3543
|
+
width: c.width,
|
|
3544
|
+
height: c.height,
|
|
3545
|
+
byteLength: h,
|
|
3539
3546
|
device: t,
|
|
3540
|
-
array:
|
|
3547
|
+
array: c,
|
|
3541
3548
|
bandTextures: /* @__PURE__ */ new Map(),
|
|
3542
|
-
colormapTexture: await
|
|
3543
|
-
bandCount:
|
|
3544
|
-
nodata:
|
|
3549
|
+
colormapTexture: await Ut(t),
|
|
3550
|
+
bandCount: u,
|
|
3551
|
+
nodata: c.nodata
|
|
3545
3552
|
};
|
|
3546
|
-
|
|
3547
|
-
|
|
3548
|
-
|
|
3549
|
-
|
|
3553
|
+
if (a) {
|
|
3554
|
+
const S = _e(a.bands, u), b = Mt(p, S);
|
|
3555
|
+
return p.array = null, p.byteLength = new Set(b).size * c.width * c.height * 4, p;
|
|
3556
|
+
}
|
|
3557
|
+
let g = Z.get(e);
|
|
3558
|
+
g || Z.set(e, g = /* @__PURE__ */ new Map());
|
|
3559
|
+
const y = `${n},${r}`;
|
|
3560
|
+
return g.set(y, p), p.identifyKey = { image: e, key: y }, p;
|
|
3550
3561
|
};
|
|
3551
|
-
function
|
|
3562
|
+
function ae(e) {
|
|
3552
3563
|
const t = e.bitsPerSample?.[0] ?? 8, n = e.sampleFormat?.[0] ?? 1;
|
|
3553
3564
|
return n === 3 ? `float${t}` : n === 2 ? `int${t}` : `uint${t}`;
|
|
3554
3565
|
}
|
|
3555
|
-
function
|
|
3566
|
+
function dt(e) {
|
|
3556
3567
|
return (e.bitsPerSample?.[0] ?? 8) === 8 && (e.sampleFormat?.[0] ?? 1) === 1;
|
|
3557
3568
|
}
|
|
3558
3569
|
const Me = /* @__PURE__ */ new WeakMap();
|
|
3559
|
-
function
|
|
3570
|
+
function Jr(e, t) {
|
|
3560
3571
|
let n = Me.get(e);
|
|
3561
3572
|
return n || Me.set(e, n = /* @__PURE__ */ new Map()), { get: () => n.get(t), set: (r) => n.set(t, r) };
|
|
3562
3573
|
}
|
|
3563
|
-
function
|
|
3574
|
+
function ht(e, t) {
|
|
3564
3575
|
const n = e?.bandStatistics;
|
|
3565
3576
|
if (!n) return null;
|
|
3566
3577
|
const r = [];
|
|
@@ -3571,10 +3582,10 @@ function dt(e, t) {
|
|
|
3571
3582
|
}
|
|
3572
3583
|
return t.length === 1 ? { min: r[0][0], max: r[0][1], source: "stats" } : { min: [r[0][0], r[1][0], r[2][0]], max: [r[0][1], r[1][1], r[2][1]], source: "stats" };
|
|
3573
3584
|
}
|
|
3574
|
-
async function
|
|
3585
|
+
async function pt(e, t, n) {
|
|
3575
3586
|
const o = (await e.fetchTile(0, 0, { boundless: !1, pool: n })).array, i = o.nodata ?? null, a = [];
|
|
3576
3587
|
for (const s of t) {
|
|
3577
|
-
const l =
|
|
3588
|
+
const l = Ot(o, s);
|
|
3578
3589
|
let c = 1 / 0, u = -1 / 0;
|
|
3579
3590
|
for (let h = 0; h < l.length; h++) {
|
|
3580
3591
|
const p = l[h];
|
|
@@ -3585,11 +3596,11 @@ async function ht(e, t, n) {
|
|
|
3585
3596
|
}
|
|
3586
3597
|
return t.length === 1 ? { min: a[0][0], max: a[0][1], source: "overview" } : { min: [a[0][0], a[1][0], a[2][0]], max: [a[0][1], a[1][1], a[2][1]], source: "overview" };
|
|
3587
3598
|
}
|
|
3588
|
-
const
|
|
3589
|
-
function
|
|
3599
|
+
const mt = 12;
|
|
3600
|
+
function gt(e, t) {
|
|
3590
3601
|
const n = Math.floor(e.length / 3), r = t.layout === "band-separate" ? t.bands[0] : t.data, o = /* @__PURE__ */ new Set(), i = t.width * t.height, a = t.layout === "band-separate" ? 1 : t.count ?? 1;
|
|
3591
3602
|
for (let l = 0; l < i; l++)
|
|
3592
|
-
if (o.add(Number(r[l * a])), o.size >
|
|
3603
|
+
if (o.add(Number(r[l * a])), o.size > mt) return null;
|
|
3593
3604
|
const s = (l) => (l >> 8).toString(16).padStart(2, "0");
|
|
3594
3605
|
return [...o].filter((l) => Number.isInteger(l) && l >= 0 && l < n).sort((l, c) => l - c).map((l) => ({
|
|
3595
3606
|
color: `#${s(e[l])}${s(e[n + l])}${s(e[n * 2 + l])}`,
|
|
@@ -3607,13 +3618,13 @@ let W;
|
|
|
3607
3618
|
function Y() {
|
|
3608
3619
|
if (W) return W;
|
|
3609
3620
|
try {
|
|
3610
|
-
W = new oe({ createWorker: () => new
|
|
3621
|
+
W = new oe({ createWorker: () => new Wr() });
|
|
3611
3622
|
} catch (e) {
|
|
3612
3623
|
console.warn("[onlymapjs] COGLayer: worker decode unavailable — falling back to main-thread decode.", e), W = new oe({});
|
|
3613
3624
|
}
|
|
3614
3625
|
return W;
|
|
3615
3626
|
}
|
|
3616
|
-
class
|
|
3627
|
+
class Vr extends kr {
|
|
3617
3628
|
static layerName = "OmCOGLayer";
|
|
3618
3629
|
// Plain nulls (not `{type:"number", value:null}` specs): deck's typed
|
|
3619
3630
|
// number props reject null defaults with a console warning per instance.
|
|
@@ -3634,7 +3645,7 @@ class Jr extends $r {
|
|
|
3634
3645
|
// shape); the sprite texture is device-scoped and must NOT die here.
|
|
3635
3646
|
onTileUnload: (n) => {
|
|
3636
3647
|
const r = n.data;
|
|
3637
|
-
!r || typeof r != "object" || !("bandTextures" in r) || (
|
|
3648
|
+
!r || typeof r != "object" || !("bandTextures" in r) || (At(r), r.identifyKey && Z.get(r.identifyKey.image)?.delete(r.identifyKey.key));
|
|
3638
3649
|
}
|
|
3639
3650
|
});
|
|
3640
3651
|
}
|
|
@@ -3709,7 +3720,7 @@ class Jr extends $r {
|
|
|
3709
3720
|
{
|
|
3710
3721
|
const t = this, n = t.props;
|
|
3711
3722
|
t.props = Object.create(n, {
|
|
3712
|
-
getTileData: { value:
|
|
3723
|
+
getTileData: { value: ie, configurable: !0 },
|
|
3713
3724
|
renderTile: { value: () => null, configurable: !0 }
|
|
3714
3725
|
});
|
|
3715
3726
|
try {
|
|
@@ -3742,23 +3753,23 @@ class Jr extends $r {
|
|
|
3742
3753
|
const n = this.omGeotiff();
|
|
3743
3754
|
if (!n) return !1;
|
|
3744
3755
|
const r = n.cachedTags;
|
|
3745
|
-
return r.colorMap ? !1 : this.omAuthoredStyled() ? !0 : !
|
|
3756
|
+
return r.colorMap ? !1 : this.omAuthoredStyled() ? !0 : !dt(r);
|
|
3746
3757
|
}
|
|
3747
3758
|
/** Resolved auto window, kicking off the one-shot overview sample when stats are absent. Undefined while pending/unavailable. */
|
|
3748
3759
|
omAutoWindow() {
|
|
3749
3760
|
if (!this.omAutoWanted()) return;
|
|
3750
3761
|
const t = this.omGeotiff();
|
|
3751
3762
|
if (!t) return;
|
|
3752
|
-
const n = this.omExtra(), r = t.cachedTags, o =
|
|
3763
|
+
const n = this.omExtra(), r = t.cachedTags, o = _e(n.bands, r.samplesPerPixel ?? 1), i = Jr(t, o.join(",")), a = i.get();
|
|
3753
3764
|
if (a === "pending" || a === null) return;
|
|
3754
3765
|
if (a) return a;
|
|
3755
|
-
const s =
|
|
3766
|
+
const s = ht(t.gdalMetadata, o);
|
|
3756
3767
|
if (s)
|
|
3757
|
-
return i.set(s), Ne(n.geotiff ?? "",
|
|
3768
|
+
return i.set(s), Ne(n.geotiff ?? "", ae(r), s), this.omPublishWindow(s, o), s;
|
|
3758
3769
|
i.set("pending");
|
|
3759
3770
|
const l = t.overviews[t.overviews.length - 1] ?? t;
|
|
3760
|
-
|
|
3761
|
-
i.set(c), c && (Ne(n.geotiff ?? "",
|
|
3771
|
+
pt(l, o, this.props.pool ?? Y()).then((c) => {
|
|
3772
|
+
i.set(c), c && (Ne(n.geotiff ?? "", ae(r), c), this.omPublishWindow(c, o));
|
|
3762
3773
|
try {
|
|
3763
3774
|
this.setState({ omAutoWindowTick: this.state?.omAutoWindowTick === 1 ? 2 : 1 });
|
|
3764
3775
|
} catch {
|
|
@@ -3805,9 +3816,9 @@ class Jr extends $r {
|
|
|
3805
3816
|
for (const c of l) {
|
|
3806
3817
|
const u = Z.get(c);
|
|
3807
3818
|
if (!u || u.size === 0) continue;
|
|
3808
|
-
const h = Math.min(c.height - 1, Math.floor(i * c.height / n.height)), p = Math.min(c.width - 1, Math.floor(a * c.width / n.width)), g = Math.floor(p / c.tileWidth), y = Math.floor(h / c.tileHeight),
|
|
3809
|
-
if (!
|
|
3810
|
-
const b = Math.min(
|
|
3819
|
+
const h = Math.min(c.height - 1, Math.floor(i * c.height / n.height)), p = Math.min(c.width - 1, Math.floor(a * c.width / n.width)), g = Math.floor(p / c.tileWidth), y = Math.floor(h / c.tileHeight), S = u.get(`${g},${y}`);
|
|
3820
|
+
if (!S?.array) continue;
|
|
3821
|
+
const b = Math.min(S.width - 1, p - g * c.tileWidth), v = Math.min(S.height - 1, h - y * c.tileHeight), C = jt(S.array, b, v, s), L = S.nodata;
|
|
3811
3822
|
return {
|
|
3812
3823
|
values: C,
|
|
3813
3824
|
bands: C.map((E, G) => G + 1),
|
|
@@ -3817,7 +3828,7 @@ class Jr extends $r {
|
|
|
3817
3828
|
return null;
|
|
3818
3829
|
}
|
|
3819
3830
|
updateState(t) {
|
|
3820
|
-
super.updateState(t),
|
|
3831
|
+
super.updateState(t), Kt(this.props.id, (n) => this.identify(n)), this.omMaybePaletteLegend();
|
|
3821
3832
|
}
|
|
3822
3833
|
/** One-shot palette legend derivation per opened file (phase 5). */
|
|
3823
3834
|
omMaybePaletteLegend() {
|
|
@@ -3828,7 +3839,7 @@ class Jr extends $r {
|
|
|
3828
3839
|
Oe.add(t);
|
|
3829
3840
|
const r = n.colorMap;
|
|
3830
3841
|
(t.overviews[t.overviews.length - 1] ?? t).fetchTile(0, 0, { boundless: !1, pool: this.props.pool ?? Y() }).then((i) => {
|
|
3831
|
-
const a =
|
|
3842
|
+
const a = gt(r, i.array);
|
|
3832
3843
|
if (!a || a.length === 0) return;
|
|
3833
3844
|
const s = this.props.onPaletteLegend;
|
|
3834
3845
|
s?.(a);
|
|
@@ -3836,17 +3847,17 @@ class Jr extends $r {
|
|
|
3836
3847
|
});
|
|
3837
3848
|
}
|
|
3838
3849
|
finalizeState(t) {
|
|
3839
|
-
|
|
3850
|
+
xt(this.props.id), super.finalizeState(t);
|
|
3840
3851
|
}
|
|
3841
3852
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
3842
3853
|
_getTileDataCallback() {
|
|
3843
3854
|
if (!this.omStyledActive()) return super._getTileDataCallback();
|
|
3844
3855
|
const t = this.omGeotiff();
|
|
3845
3856
|
if (!t) return;
|
|
3846
|
-
const n = this.props.pool ?? Y();
|
|
3847
|
-
return async (
|
|
3848
|
-
const { x:
|
|
3849
|
-
return
|
|
3857
|
+
const n = this.props.pool ?? Y(), r = this.props.identify === "off" ? { bands: this.omEffectiveStyle().bands } : void 0;
|
|
3858
|
+
return async (o, i) => {
|
|
3859
|
+
const { x: a, y: s, z: l } = o.index, c = l === t.overviews.length ? t : t.overviews[t.overviews.length - 1 - l];
|
|
3860
|
+
return ie(c, { device: i.device, x: a, y: s, signal: i.signal, pool: n, dropDecode: r });
|
|
3850
3861
|
};
|
|
3851
3862
|
}
|
|
3852
3863
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -3855,19 +3866,36 @@ class Jr extends $r {
|
|
|
3855
3866
|
const t = this.omEffectiveStyle();
|
|
3856
3867
|
return (n) => n ? Rt(n, t) : null;
|
|
3857
3868
|
}
|
|
3869
|
+
/**
|
|
3870
|
+
* identify="off" bakes the selection into fetch-time textures, so a bands
|
|
3871
|
+
* change — or flipping identify back on, which must repopulate the
|
|
3872
|
+
* retained arrays — has to REFETCH. Surfaced as the inner TileLayer's own
|
|
3873
|
+
* `getTileData` update trigger by cloning what upstream renders (it
|
|
3874
|
+
* passes no such trigger through, and `_renderTileLayer` is TS-private).
|
|
3875
|
+
* Retained mode pins a constant, keeping the v2 contract: refetch keyed
|
|
3876
|
+
* on the tileset descriptor alone, never on styling.
|
|
3877
|
+
*/
|
|
3878
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
3879
|
+
renderLayers() {
|
|
3880
|
+
const t = super.renderLayers();
|
|
3881
|
+
if (!t || !this.omStyledActive()) return t;
|
|
3882
|
+
const r = this.props.identify === "off" ? `off:${JSON.stringify(this.omEffectiveStyle().bands ?? null)}` : "retained", o = (i) => i && typeof i.clone == "function" && i.props?.getTileData ? i.clone({ updateTriggers: { ...i.props.updateTriggers ?? {}, getTileData: r } }) : i;
|
|
3883
|
+
return Array.isArray(t) ? t.map(o) : o(t);
|
|
3884
|
+
}
|
|
3858
3885
|
}
|
|
3859
|
-
const
|
|
3886
|
+
const Qr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
3860
3887
|
__proto__: null,
|
|
3861
|
-
OmCOGLayer:
|
|
3862
|
-
PALETTE_LEGEND_MAX_CLASSES:
|
|
3863
|
-
dtypeName:
|
|
3864
|
-
isUint8:
|
|
3865
|
-
|
|
3866
|
-
|
|
3867
|
-
|
|
3888
|
+
OmCOGLayer: Vr,
|
|
3889
|
+
PALETTE_LEGEND_MAX_CLASSES: mt,
|
|
3890
|
+
dtypeName: ae,
|
|
3891
|
+
isUint8: dt,
|
|
3892
|
+
omGetTileData: ie,
|
|
3893
|
+
overviewWindow: pt,
|
|
3894
|
+
paletteLegendEntries: gt,
|
|
3895
|
+
statsWindow: ht
|
|
3868
3896
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
3869
3897
|
export {
|
|
3870
3898
|
f as C,
|
|
3871
3899
|
j as D,
|
|
3872
|
-
|
|
3900
|
+
Qr as r
|
|
3873
3901
|
};
|