@nika-js/onlymap 0.9.0 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +38 -0
- package/README.md +50 -3
- package/dist/{LercDecode.es-BMcxSLhD.js → LercDecode.es-IEPCRZOv.js} +1 -1
- package/dist/{basemap-m98j2wxG.js → basemap-9lXclX9H.js} +3882 -3980
- package/dist/cartograph/elements/om-frame.d.ts +67 -1
- package/dist/cartograph/georef.d.ts +18 -4
- package/dist/cartograph/schema.d.ts +11 -0
- package/dist/cartograph.js +1480 -1311
- package/dist/cartograph.standalone.js +1808 -1615
- package/dist/{cityjson-D_V5GY8b.js → cityjson-k-z1r6c0.js} +1 -1
- package/dist/{crs-DsDQ4Q4i.js → crs-BzE_KP4M.js} +25 -2
- package/dist/{crs-Ciu7Xs7a.js → crs-ChglCB3O.js} +39 -16
- package/dist/dem-decode.d.ts +58 -0
- package/dist/elements/om-map.d.ts +12 -0
- package/dist/{geoparquet-XOwOmChh.js → geoparquet-DFDZDBun.js} +10 -10
- package/dist/globe-view-D9wjfL0T.js +104 -0
- package/dist/hillshade-C2BQr6pd.js +298 -0
- package/dist/hillshade-apron-Bem3DWyJ.js +40 -0
- package/dist/hillshade-apron.d.ts +54 -0
- package/dist/hillshade-shader-DI2uLSNU.js +165 -0
- package/dist/hillshade-shader.d.ts +168 -0
- package/dist/hillshade.d.ts +163 -0
- package/dist/html-data.d.ts +1 -1
- package/dist/{ifc-Dc-TdSJr.js → ifc-DXwePQRv.js} +131 -131
- package/dist/{index-DzOvV-O7.js → index-4Tvlt0iO.js} +57 -57
- package/dist/{index-HZWdgtm4.js → index-Bn66l3KG.js} +1 -1
- package/dist/index-BuXrMq5D.js +322 -0
- package/dist/index-CNRbZHkK.js +459 -0
- package/dist/{index-DDNElBTs.js → index-CkovmN47.js} +1 -1
- package/dist/index-CmuOizAF.js +641 -0
- package/dist/index-CvT5QHBS.js +65 -0
- package/dist/{index-BMbpftvm.js → index-DnVHKI61.js} +1 -1
- package/dist/{index-BSAY6CWm.js → index-JjyDEqAS.js} +18911 -17456
- package/dist/index.d.ts +4 -0
- package/dist/layer-registry.d.ts +27 -0
- package/dist/lerc-C1mQ_Kqq.js +22 -0
- package/dist/onlymap.standalone.js +49075 -45717
- package/dist/onlymapjs.js +73 -70
- package/dist/parse-manifest.d.ts +6 -0
- package/dist/plane-camera.d.ts +59 -0
- package/dist/plane-layers.d.ts +56 -0
- package/dist/plane-tiles.d.ts +99 -0
- package/dist/plane-tileset.d.ts +31 -0
- package/dist/plane-warp.d.ts +91 -0
- package/dist/post-process-effect-DfslKPM6.js +197 -0
- package/dist/programmatic.d.ts +16 -1
- package/dist/projection.d.ts +118 -0
- package/dist/{raster-Dg5p_99H.js → raster-D2NzdjZE.js} +609 -499
- package/dist/raster-hillshade.d.ts +119 -0
- package/dist/{raster-pipeline-DhjkqDYd.js → raster-pipeline-qnD1icOv.js} +511 -484
- package/dist/raster-pipeline.d.ts +10 -0
- package/dist/raster.d.ts +5 -0
- package/dist/runtime-core.d.ts +140 -1
- package/dist/serialize/clip.d.ts +50 -0
- package/dist/serialize/declutter.d.ts +44 -0
- package/dist/serialize/emit.d.ts +60 -0
- package/dist/serialize/index.d.ts +64 -0
- package/dist/serialize/strategy.d.ts +30 -0
- package/dist/serialize/style.d.ts +77 -0
- package/dist/snapshot.d.ts +46 -0
- package/dist/surface-anchor.d.ts +6 -0
- package/dist/terrain-heightfield.d.ts +0 -16
- package/dist/terrain-sample.d.ts +0 -13
- package/dist/text-on-path-Dm7vtNqt.js +146 -0
- package/dist/text-on-path.d.ts +157 -0
- package/dist/transform/buffer.d.ts +63 -0
- package/dist/transform/contour.d.ts +37 -0
- package/dist/transform/dot-density.d.ts +19 -0
- package/dist/transform/field.d.ts +80 -0
- package/dist/transform/geometry.d.ts +20 -0
- package/dist/transform/index.d.ts +29 -0
- package/dist/transform/simplify.d.ts +10 -0
- package/dist/transform/smooth.d.ts +12 -0
- package/dist/transform-stage.d.ts +92 -0
- package/dist/version.d.ts +1 -1
- package/dist/volumetrics.d.ts +7 -0
- package/dist/{zarr-D3CzK1Zm.js → zarr-D5e5agMG.js} +2 -2
- package/docs/cartograph.md +12 -4
- package/docs/cartography.md +328 -0
- package/docs/design/arrows.md +182 -0
- package/docs/design/carto-substrate.md +1055 -0
- package/docs/design/extensions.md +250 -0
- package/docs/design/hillshade.md +290 -0
- package/docs/effects.md +11 -0
- package/docs/hillshade.md +203 -0
- package/llms.txt +4 -2
- package/onlymapjs.attributes.json +45 -2
- package/onlymapjs.html-data.json +213 -25
- package/package.json +13 -9
- package/skills/onlymapjs/SKILL.md +7 -2
- package/skills/onlymapjs/references/syntax.md +31 -3
- package/dist/index-CfPbQUqO.js +0 -511
- package/dist/lerc-qK-nhCaB.js +0 -30
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import { c as se, t as
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
|
|
1
|
+
import { c as se, t as $e, i as Ct, a as ke, s as Lt, C as It, b as Gt, F as vt, A as Et, d as Ft, R as ye, e as At, p as jt, m as Rt, f as Mt, g as We, h as Ut, r as le, j as Ot, k as xt, l as Kt, n as Dt } from "./raster-pipeline-qnD1icOv.js";
|
|
2
|
+
import { N as Nt, c as zt } from "./hillshade-apron-Bem3DWyJ.js";
|
|
3
|
+
import { r as Bt } from "./hillshade-shader-DI2uLSNU.js";
|
|
4
|
+
import { bK as _t, bL as $t } from "./index-JjyDEqAS.js";
|
|
5
|
+
import we from "./index-CW1n5LdO.js";
|
|
6
|
+
function kt(e, t) {
|
|
5
7
|
const n = e.length / 3, r = new Uint8ClampedArray(n * 4), o = 0, i = n, a = n * 2;
|
|
6
8
|
for (let s = 0; s < n; s++)
|
|
7
9
|
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 +17,10 @@ var J;
|
|
|
15
17
|
(function(e) {
|
|
16
18
|
e[e.ReducedImage = 1] = "ReducedImage", e[e.Page = 2] = "Page", e[e.Mask = 4] = "Mask";
|
|
17
19
|
})(J || (J = {}));
|
|
18
|
-
var
|
|
20
|
+
var Se;
|
|
19
21
|
(function(e) {
|
|
20
22
|
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
|
-
})(
|
|
23
|
+
})(Se || (Se = {}));
|
|
22
24
|
var te;
|
|
23
25
|
(function(e) {
|
|
24
26
|
e[e.PixelIsArea = 1] = "PixelIsArea", e[e.PixelIsPoint = 2] = "PixelIsPoint";
|
|
@@ -27,18 +29,18 @@ var O;
|
|
|
27
29
|
(function(e) {
|
|
28
30
|
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
31
|
})(O || (O = {}));
|
|
30
|
-
var
|
|
32
|
+
var Pe;
|
|
31
33
|
(function(e) {
|
|
32
34
|
e[e.Image = 1] = "Image", e[e.ReducedImage = 2] = "ReducedImage", e[e.Page = 3] = "Page";
|
|
33
|
-
})(
|
|
35
|
+
})(Pe || (Pe = {}));
|
|
34
36
|
var f;
|
|
35
37
|
(function(e) {
|
|
36
38
|
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";
|
|
37
39
|
})(f || (f = {}));
|
|
38
|
-
var
|
|
40
|
+
var M;
|
|
39
41
|
(function(e) {
|
|
40
42
|
e[e.Contig = 1] = "Contig", e[e.Separate = 2] = "Separate";
|
|
41
|
-
})(
|
|
43
|
+
})(M || (M = {}));
|
|
42
44
|
var _;
|
|
43
45
|
(function(e) {
|
|
44
46
|
e[e.None = 1] = "None", e[e.Horizontal = 2] = "Horizontal", e[e.FloatingPoint = 3] = "FloatingPoint";
|
|
@@ -59,15 +61,15 @@ var m;
|
|
|
59
61
|
(function(e) {
|
|
60
62
|
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
63
|
})(m || (m = {}));
|
|
62
|
-
var
|
|
64
|
+
var be;
|
|
63
65
|
(function(e) {
|
|
64
66
|
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
|
|
67
|
+
})(be || (be = {}));
|
|
68
|
+
var Ce;
|
|
67
69
|
(function(e) {
|
|
68
70
|
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
|
|
71
|
+
})(Ce || (Ce = {}));
|
|
72
|
+
const Wt = {
|
|
71
73
|
[d.TileByteCounts]: !0,
|
|
72
74
|
[d.TileOffsets]: !0,
|
|
73
75
|
[d.StripOffsets]: !0,
|
|
@@ -81,7 +83,7 @@ var P;
|
|
|
81
83
|
(function(e) {
|
|
82
84
|
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
85
|
})(P || (P = {}));
|
|
84
|
-
const
|
|
86
|
+
const Je = {
|
|
85
87
|
[f.None]: P.None,
|
|
86
88
|
[f.Lzw]: P.Lzw,
|
|
87
89
|
[f.Jpeg6]: P.Jpeg,
|
|
@@ -115,146 +117,146 @@ const $e = {
|
|
|
115
117
|
[f.SgiLog24]: P.None,
|
|
116
118
|
[f.JpegXlDng17]: P.JpegXl
|
|
117
119
|
};
|
|
118
|
-
function
|
|
119
|
-
return e == null ? null :
|
|
120
|
+
function Jt(e) {
|
|
121
|
+
return e == null ? null : Je[e];
|
|
120
122
|
}
|
|
121
|
-
var
|
|
123
|
+
var S;
|
|
122
124
|
(function(e) {
|
|
123
125
|
e[e.Uint8 = 1] = "Uint8", e[e.Ascii = 2] = "Ascii", e[e.Uint16 = 3] = "Uint16", e[e.Uint32 = 4] = "Uint32", e[e.Rational = 5] = "Rational", e[e.Int8 = 6] = "Int8", e[e.Undefined = 7] = "Undefined", e[e.Int16 = 8] = "Int16", e[e.Int32 = 9] = "Int32", e[e.SignedRational = 10] = "SignedRational", e[e.Float32 = 11] = "Float32", e[e.Float64 = 12] = "Float64", e[e.Ifd = 13] = "Ifd", e[e.Uint64 = 16] = "Uint64", e[e.Int64 = 17] = "Int64", e[e.Ifd8 = 18] = "Ifd8";
|
|
124
|
-
})(
|
|
126
|
+
})(S || (S = {}));
|
|
125
127
|
var R;
|
|
126
128
|
(function(e) {
|
|
127
129
|
e[e.BigTiff = 43] = "BigTiff", e[e.Tiff = 42] = "Tiff";
|
|
128
130
|
})(R || (R = {}));
|
|
129
131
|
function N(e) {
|
|
130
132
|
switch (e) {
|
|
131
|
-
case
|
|
132
|
-
case
|
|
133
|
-
case
|
|
134
|
-
case
|
|
133
|
+
case S.Uint8:
|
|
134
|
+
case S.Ascii:
|
|
135
|
+
case S.Int8:
|
|
136
|
+
case S.Undefined:
|
|
135
137
|
return 1;
|
|
136
|
-
case
|
|
137
|
-
case
|
|
138
|
+
case S.Uint16:
|
|
139
|
+
case S.Int16:
|
|
138
140
|
return 2;
|
|
139
|
-
case
|
|
140
|
-
case
|
|
141
|
-
case
|
|
142
|
-
case
|
|
141
|
+
case S.Uint32:
|
|
142
|
+
case S.Int32:
|
|
143
|
+
case S.Float32:
|
|
144
|
+
case S.Ifd:
|
|
143
145
|
return 4;
|
|
144
|
-
case
|
|
145
|
-
case
|
|
146
|
-
case
|
|
147
|
-
case
|
|
148
|
-
case
|
|
149
|
-
case
|
|
146
|
+
case S.Rational:
|
|
147
|
+
case S.SignedRational:
|
|
148
|
+
case S.Float64:
|
|
149
|
+
case S.Uint64:
|
|
150
|
+
case S.Int64:
|
|
151
|
+
case S.Ifd8:
|
|
150
152
|
return 8;
|
|
151
153
|
default:
|
|
152
154
|
throw new Error(`Invalid fieldType ${String(e)}`);
|
|
153
155
|
}
|
|
154
156
|
}
|
|
155
|
-
var
|
|
157
|
+
var Le;
|
|
156
158
|
(function(e) {
|
|
157
159
|
e[e.Double = 8] = "Double", e[e.Float32 = 4] = "Float32";
|
|
158
|
-
})(
|
|
159
|
-
var
|
|
160
|
+
})(Le || (Le = {}));
|
|
161
|
+
var v;
|
|
160
162
|
(function(e) {
|
|
161
163
|
e[e.UInt64 = 8] = "UInt64", e[e.UInt32 = 4] = "UInt32", e[e.UInt16 = 2] = "UInt16", e[e.UInt8 = 1] = "UInt8";
|
|
162
|
-
})(
|
|
163
|
-
const
|
|
164
|
-
function
|
|
165
|
-
const r = e.getUint32(t, n), o = e.getUint32(t + 4, n), i = n ? r +
|
|
164
|
+
})(v || (v = {}));
|
|
165
|
+
const Ie = 2 ** 32;
|
|
166
|
+
function He(e, t, n) {
|
|
167
|
+
const r = e.getUint32(t, n), o = e.getUint32(t + 4, n), i = n ? r + Ie * o : Ie * r + o;
|
|
166
168
|
if (!Number.isSafeInteger(i))
|
|
167
169
|
throw new Error(i + " exceeds MAX_SAFE_INTEGER. Precision may is lost");
|
|
168
170
|
return i;
|
|
169
171
|
}
|
|
170
|
-
function
|
|
172
|
+
function x(e, t, n, r) {
|
|
171
173
|
switch (n) {
|
|
172
|
-
case
|
|
174
|
+
case v.UInt8:
|
|
173
175
|
return e.getUint8(t);
|
|
174
|
-
case
|
|
176
|
+
case v.UInt16:
|
|
175
177
|
return e.getUint16(t, r);
|
|
176
|
-
case
|
|
178
|
+
case v.UInt32:
|
|
177
179
|
return e.getUint32(t, r);
|
|
178
|
-
case
|
|
179
|
-
return
|
|
180
|
+
case v.UInt64:
|
|
181
|
+
return He(e, t, r);
|
|
180
182
|
}
|
|
181
183
|
}
|
|
182
|
-
function
|
|
184
|
+
function Z(e, t, n) {
|
|
183
185
|
return !(t < e.sourceOffset || e.sourceOffset + e.byteLength < t + n);
|
|
184
186
|
}
|
|
185
|
-
const
|
|
186
|
-
|
|
187
|
-
const
|
|
188
|
-
function
|
|
187
|
+
const Ve = new ArrayBuffer(4), Ht = new Uint32Array(Ve), Vt = new Uint8Array(Ve);
|
|
188
|
+
Ht[0] = 1;
|
|
189
|
+
const Ge = Vt[0] === 1;
|
|
190
|
+
function ve(e, t, n, r) {
|
|
189
191
|
switch (e) {
|
|
190
|
-
case
|
|
192
|
+
case S.Ascii:
|
|
191
193
|
return String.fromCharCode(t.getUint8(n));
|
|
192
|
-
case
|
|
193
|
-
case
|
|
194
|
+
case S.Undefined:
|
|
195
|
+
case S.Uint8:
|
|
194
196
|
return t.getUint8(n);
|
|
195
|
-
case
|
|
197
|
+
case S.Int8:
|
|
196
198
|
return t.getInt8(n);
|
|
197
|
-
case
|
|
199
|
+
case S.Uint16:
|
|
198
200
|
return t.getUint16(n, r);
|
|
199
|
-
case
|
|
201
|
+
case S.Int16:
|
|
200
202
|
return t.getInt16(n, r);
|
|
201
|
-
case
|
|
202
|
-
case
|
|
203
|
+
case S.Uint32:
|
|
204
|
+
case S.Ifd:
|
|
203
205
|
return t.getUint32(n, r);
|
|
204
|
-
case
|
|
206
|
+
case S.Int32:
|
|
205
207
|
return t.getInt32(n, r);
|
|
206
|
-
case
|
|
208
|
+
case S.Rational:
|
|
207
209
|
return [t.getUint32(n, r), t.getUint32(n + 4, r)];
|
|
208
|
-
case
|
|
210
|
+
case S.SignedRational:
|
|
209
211
|
return [t.getInt32(n, r), t.getInt32(n + 4, r)];
|
|
210
|
-
case
|
|
212
|
+
case S.Float64:
|
|
211
213
|
return t.getFloat64(n, r);
|
|
212
|
-
case
|
|
214
|
+
case S.Float32:
|
|
213
215
|
return t.getFloat32(n, r);
|
|
214
|
-
case
|
|
215
|
-
return
|
|
216
|
+
case S.Uint64:
|
|
217
|
+
return He(t, n, r);
|
|
216
218
|
default:
|
|
217
|
-
throw new Error(`Unknown read type "${e}" "${
|
|
219
|
+
throw new Error(`Unknown read type "${e}" "${S[e]}"`);
|
|
218
220
|
}
|
|
219
221
|
}
|
|
220
|
-
function
|
|
222
|
+
function Ye(e, t, n, r, o) {
|
|
221
223
|
switch (o) {
|
|
222
|
-
case
|
|
224
|
+
case S.Uint8:
|
|
223
225
|
return new Uint8Array(t.buffer.slice(t.byteOffset + n, t.byteOffset + n + r));
|
|
224
|
-
case
|
|
225
|
-
return e.isLittleEndian !==
|
|
226
|
-
case
|
|
227
|
-
return e.isLittleEndian !==
|
|
226
|
+
case S.Uint16:
|
|
227
|
+
return e.isLittleEndian !== Ge ? null : new Uint16Array(t.buffer.slice(t.byteOffset + n, t.byteOffset + n + r));
|
|
228
|
+
case S.Uint32:
|
|
229
|
+
return e.isLittleEndian !== Ge ? null : new Uint32Array(t.buffer.slice(t.byteOffset + n, t.byteOffset + n + r));
|
|
228
230
|
}
|
|
229
231
|
return null;
|
|
230
232
|
}
|
|
231
233
|
function D(e, t, n, r, o, i) {
|
|
232
234
|
const a = N(o), s = i * a;
|
|
233
235
|
if (i === 1) {
|
|
234
|
-
const c =
|
|
235
|
-
return t &&
|
|
236
|
+
const c = ve(o, n, r, e.isLittleEndian);
|
|
237
|
+
return t && Wt[t] ? [c] : c;
|
|
236
238
|
}
|
|
237
239
|
switch (o) {
|
|
238
|
-
case
|
|
240
|
+
case S.Ascii:
|
|
239
241
|
return String.fromCharCode.apply(null, new Uint8Array(n.buffer, r, s - 1));
|
|
240
242
|
}
|
|
241
243
|
if (t === d.TileOffsets || t === d.TileByteCounts || t === d.StripOffsets || t === d.StripByteCounts) {
|
|
242
|
-
const c =
|
|
244
|
+
const c = Ye(e, n, r, s, o);
|
|
243
245
|
if (c)
|
|
244
246
|
return c;
|
|
245
247
|
}
|
|
246
248
|
const l = [];
|
|
247
249
|
for (let c = 0; c < s; c += a)
|
|
248
|
-
l.push(
|
|
250
|
+
l.push(ve(o, n, r + c, e.isLittleEndian));
|
|
249
251
|
return l;
|
|
250
252
|
}
|
|
251
|
-
function
|
|
252
|
-
const r = t.getUint16(n + 0, e.isLittleEndian), o = t.getUint16(n + 2, e.isLittleEndian), i =
|
|
253
|
+
function Yt(e, t, n) {
|
|
254
|
+
const r = t.getUint16(n + 0, e.isLittleEndian), o = t.getUint16(n + 2, e.isLittleEndian), i = x(t, n + 4, e.ifdConfig.pointer, e.isLittleEndian), s = N(o) * i;
|
|
253
255
|
if (s <= e.ifdConfig.pointer) {
|
|
254
256
|
const c = D(e, r, t, n + 4 + e.ifdConfig.pointer, o, i);
|
|
255
257
|
return { type: "inline", id: r, name: d[r], count: i, value: c, dataType: o, tagOffset: n };
|
|
256
258
|
}
|
|
257
|
-
const l =
|
|
259
|
+
const l = x(t, n + 4 + e.ifdConfig.pointer, e.ifdConfig.pointer, e.isLittleEndian);
|
|
258
260
|
switch (r) {
|
|
259
261
|
case d.TileOffsets:
|
|
260
262
|
case d.TileByteCounts:
|
|
@@ -271,25 +273,25 @@ function $t(e, t, n) {
|
|
|
271
273
|
value: [],
|
|
272
274
|
tagOffset: n
|
|
273
275
|
};
|
|
274
|
-
if (
|
|
275
|
-
const u =
|
|
276
|
-
u ? (c.value = u, c.isLoaded = !0) :
|
|
276
|
+
if (Z(t, l, s)) {
|
|
277
|
+
const u = Ye(e, t, l - t.sourceOffset, s, o);
|
|
278
|
+
u ? (c.value = u, c.isLoaded = !0) : Qt(c, t);
|
|
277
279
|
}
|
|
278
280
|
return c;
|
|
279
281
|
}
|
|
280
|
-
if (
|
|
282
|
+
if (Z(t, l, s)) {
|
|
281
283
|
const c = D(e, r, t, l - t.sourceOffset, o, i);
|
|
282
284
|
return { type: "inline", id: r, name: d[r], count: i, value: c, dataType: o, tagOffset: n };
|
|
283
285
|
}
|
|
284
286
|
return { type: "lazy", id: r, name: d[r], count: i, dataOffset: l, dataType: o, tagOffset: n };
|
|
285
287
|
}
|
|
286
|
-
async function
|
|
288
|
+
async function Xt(e, t, n) {
|
|
287
289
|
if (e.value != null)
|
|
288
290
|
return e.value;
|
|
289
291
|
const o = N(e.dataType) * e.count, i = await t.source.fetch(e.dataOffset, o, n), a = new DataView(i);
|
|
290
292
|
return e.value = D(t, e.id, a, 0, e.dataType, e.count), e.value;
|
|
291
293
|
}
|
|
292
|
-
async function
|
|
294
|
+
async function Zt(e, t, n) {
|
|
293
295
|
const r = N(t.dataType);
|
|
294
296
|
if (t.view == null) {
|
|
295
297
|
const o = await e.source.fetch(t.dataOffset, r * t.count, n);
|
|
@@ -297,11 +299,11 @@ async function Wt(e, t, n) {
|
|
|
297
299
|
}
|
|
298
300
|
return t.value = D(e, t.id, t.view, 0, t.dataType, t.count), t.view = void 0, t.isLoaded = !0, t.value;
|
|
299
301
|
}
|
|
300
|
-
function
|
|
302
|
+
function Qt(e, t) {
|
|
301
303
|
const n = N(e.dataType), r = t.byteOffset + e.dataOffset - t.sourceOffset;
|
|
302
304
|
e.view = new DataView(t.buffer.slice(r, r + n * e.count)), e.view.sourceOffset = e.dataOffset;
|
|
303
305
|
}
|
|
304
|
-
async function
|
|
306
|
+
async function qt(e, t, n, r) {
|
|
305
307
|
if (n > t.count || n < 0)
|
|
306
308
|
throw new Error("TagOffset: out of bounds :" + n);
|
|
307
309
|
if (t.value[n] != null)
|
|
@@ -318,7 +320,7 @@ async function Vt(e, t, n, r) {
|
|
|
318
320
|
throw new Error("Value is not a number");
|
|
319
321
|
return t.value[n] = i, i;
|
|
320
322
|
}
|
|
321
|
-
function
|
|
323
|
+
function Tt(e, t, n) {
|
|
322
324
|
if (n > t.count || n < 0)
|
|
323
325
|
throw new Error("TagOffset: out of bounds :" + n);
|
|
324
326
|
if (t.value[n] != null)
|
|
@@ -330,7 +332,7 @@ function Ht(e, t, n) {
|
|
|
330
332
|
throw new Error("Value is not a number");
|
|
331
333
|
return t.value[n] = o, o;
|
|
332
334
|
}
|
|
333
|
-
const
|
|
335
|
+
const Ee = 32767, en = /* @__PURE__ */ new Set([
|
|
334
336
|
d.Compression,
|
|
335
337
|
d.ImageHeight,
|
|
336
338
|
d.ImageWidth,
|
|
@@ -339,8 +341,8 @@ const ve = 32767, Yt = /* @__PURE__ */ new Set([
|
|
|
339
341
|
d.ModelTransformation,
|
|
340
342
|
d.TileHeight,
|
|
341
343
|
d.TileWidth
|
|
342
|
-
]),
|
|
343
|
-
class
|
|
344
|
+
]), tn = /* @__PURE__ */ new Set([d.GeoKeyDirectory, d.GeoAsciiParams, d.GeoDoubleParams]);
|
|
345
|
+
class nn {
|
|
344
346
|
/**
|
|
345
347
|
* Id of the tif image, generally the image index inside the tif
|
|
346
348
|
* where 0 is the root image, and every sub image is +1
|
|
@@ -366,9 +368,9 @@ class Zt {
|
|
|
366
368
|
*/
|
|
367
369
|
async init(t = !0, n) {
|
|
368
370
|
const r = [];
|
|
369
|
-
|
|
371
|
+
en.forEach((o) => {
|
|
370
372
|
r.push(this.fetch(o, n));
|
|
371
|
-
}), t &&
|
|
373
|
+
}), t && tn.forEach((o) => {
|
|
372
374
|
r.push(this.fetch(o, n));
|
|
373
375
|
}), await Promise.all(r), t && await this.loadGeoTiffTags();
|
|
374
376
|
}
|
|
@@ -418,11 +420,11 @@ class Zt {
|
|
|
418
420
|
if (r.type === "inline")
|
|
419
421
|
return r.value;
|
|
420
422
|
if (r.type === "lazy")
|
|
421
|
-
return
|
|
423
|
+
return Xt(r, this.tiff, n);
|
|
422
424
|
if (r.isLoaded)
|
|
423
425
|
return r.value;
|
|
424
426
|
if (r.type === "offset")
|
|
425
|
-
return
|
|
427
|
+
return Zt(this.tiff, r, n);
|
|
426
428
|
throw new Error("Cannot fetch:" + t);
|
|
427
429
|
}
|
|
428
430
|
/**
|
|
@@ -560,7 +562,7 @@ class Zt {
|
|
|
560
562
|
*/
|
|
561
563
|
get compression() {
|
|
562
564
|
const t = this.value(d.Compression);
|
|
563
|
-
return t == null ? null :
|
|
565
|
+
return t == null ? null : Je[t];
|
|
564
566
|
}
|
|
565
567
|
/**
|
|
566
568
|
* Attempt to read the EPSG Code from TiffGeoTags
|
|
@@ -571,7 +573,7 @@ class Zt {
|
|
|
571
573
|
*/
|
|
572
574
|
get epsg() {
|
|
573
575
|
const t = this.valueGeo(m.ProjectionGeoKey);
|
|
574
|
-
if (t != null && t !==
|
|
576
|
+
if (t != null && t !== Ee)
|
|
575
577
|
return t;
|
|
576
578
|
let n = null;
|
|
577
579
|
switch (this.valueGeo(m.GTModelTypeGeoKey)) {
|
|
@@ -589,7 +591,7 @@ class Zt {
|
|
|
589
591
|
case O.UserDefined:
|
|
590
592
|
return null;
|
|
591
593
|
}
|
|
592
|
-
return n ===
|
|
594
|
+
return n === Ee ? null : n;
|
|
593
595
|
}
|
|
594
596
|
/**
|
|
595
597
|
* Get the size of the image
|
|
@@ -688,7 +690,7 @@ class Zt {
|
|
|
688
690
|
throw new Error(`Failed to fetch bytes from offset:${t} wanted:${n} got:${o.byteLength}`);
|
|
689
691
|
let i = this.value(d.Compression);
|
|
690
692
|
i == null && (i = f.None);
|
|
691
|
-
const a =
|
|
693
|
+
const a = Jt(i) ?? P.None;
|
|
692
694
|
return i === f.Jpeg ? { mimeType: a, bytes: this.getJpegHeader(o), compression: i } : { mimeType: a, bytes: o, compression: i };
|
|
693
695
|
}
|
|
694
696
|
/**
|
|
@@ -751,7 +753,7 @@ class Zt {
|
|
|
751
753
|
if (c === 0)
|
|
752
754
|
return { offset: 0, imageSize: 0 };
|
|
753
755
|
const u = await this.tiff.source.fetch(c - a, a, n);
|
|
754
|
-
return { offset: c, imageSize:
|
|
756
|
+
return { offset: c, imageSize: x(new DataView(u), 0, a, this.tiff.isLittleEndian) };
|
|
755
757
|
}
|
|
756
758
|
if (r == null)
|
|
757
759
|
throw new Error("No tile byte counts found");
|
|
@@ -764,26 +766,26 @@ class Zt {
|
|
|
764
766
|
}
|
|
765
767
|
function k(e, t, n, r) {
|
|
766
768
|
const o = ne(e, t, n);
|
|
767
|
-
return o != null ? Promise.resolve(o) :
|
|
769
|
+
return o != null ? Promise.resolve(o) : qt(e, t, n, r);
|
|
768
770
|
}
|
|
769
771
|
function ne(e, t, n) {
|
|
770
772
|
if (n < 0)
|
|
771
773
|
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] :
|
|
774
|
+
return n >= t.count ? 0 : t.type === "inline" || t.isLoaded ? t.value[n] : Tt(e, t, n);
|
|
773
775
|
}
|
|
774
776
|
var z;
|
|
775
777
|
(function(e) {
|
|
776
778
|
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
779
|
})(z || (z = {}));
|
|
778
|
-
var
|
|
780
|
+
var Fe;
|
|
779
781
|
(function(e) {
|
|
780
782
|
e.RowMajor = "ROW_MAJOR";
|
|
781
|
-
})(
|
|
783
|
+
})(Fe || (Fe = {}));
|
|
782
784
|
var re;
|
|
783
785
|
(function(e) {
|
|
784
786
|
e.uint32 = "SIZE_AS_UINT4";
|
|
785
787
|
})(re || (re = {}));
|
|
786
|
-
class
|
|
788
|
+
class rn {
|
|
787
789
|
options = /* @__PURE__ */ new Map();
|
|
788
790
|
/**
|
|
789
791
|
* Has GDAL optimized this tiff
|
|
@@ -818,7 +820,7 @@ class Qt {
|
|
|
818
820
|
get tileLeaderByteSize() {
|
|
819
821
|
switch (this.options.get(z.BlockLeader)) {
|
|
820
822
|
case re.uint32:
|
|
821
|
-
return
|
|
823
|
+
return v.UInt32;
|
|
822
824
|
default:
|
|
823
825
|
return null;
|
|
824
826
|
}
|
|
@@ -827,10 +829,10 @@ class Qt {
|
|
|
827
829
|
return this.options.get(z.MaskInterleavedWithImagery) === "YES";
|
|
828
830
|
}
|
|
829
831
|
}
|
|
830
|
-
const
|
|
832
|
+
const Xe = {
|
|
831
833
|
version: R.Tiff,
|
|
832
|
-
pointer:
|
|
833
|
-
offset:
|
|
834
|
+
pointer: v.UInt32,
|
|
835
|
+
offset: v.UInt16,
|
|
834
836
|
/**
|
|
835
837
|
* Each tag entry is specified as
|
|
836
838
|
* UInt16:TagCode
|
|
@@ -838,13 +840,13 @@ const Ve = {
|
|
|
838
840
|
* UInt32:TagCount
|
|
839
841
|
* UInt32:Pointer To Value or value
|
|
840
842
|
*/
|
|
841
|
-
ifd:
|
|
842
|
-
},
|
|
843
|
+
ifd: v.UInt16 + v.UInt16 + 2 * v.UInt32
|
|
844
|
+
}, Ze = {
|
|
843
845
|
version: R.BigTiff,
|
|
844
846
|
/** Size of most pointers */
|
|
845
|
-
pointer:
|
|
847
|
+
pointer: v.UInt64,
|
|
846
848
|
/** Size of offsets */
|
|
847
|
-
offset:
|
|
849
|
+
offset: v.UInt64,
|
|
848
850
|
/**
|
|
849
851
|
* Each tag entry is specified as
|
|
850
852
|
* UInt16:TagCode
|
|
@@ -852,10 +854,10 @@ const Ve = {
|
|
|
852
854
|
* UInt64:TagCount
|
|
853
855
|
* UInt64:Pointer To Value or value
|
|
854
856
|
*/
|
|
855
|
-
ifd:
|
|
857
|
+
ifd: v.UInt16 + v.UInt16 + 2 * v.UInt64
|
|
856
858
|
};
|
|
857
859
|
R.BigTiff + "", R.Tiff + "";
|
|
858
|
-
function
|
|
860
|
+
function on(e, t = 4, n = !0) {
|
|
859
861
|
const r = e.toString(16).padStart(t, "0");
|
|
860
862
|
return n ? "0x" + r : r;
|
|
861
863
|
}
|
|
@@ -873,7 +875,7 @@ class B {
|
|
|
873
875
|
/** Ghost header options */
|
|
874
876
|
options;
|
|
875
877
|
/** Configuration for the size of the IFD */
|
|
876
|
-
ifdConfig =
|
|
878
|
+
ifdConfig = Xe;
|
|
877
879
|
/** Is the tiff being read is little Endian */
|
|
878
880
|
isLittleEndian = !1;
|
|
879
881
|
/** Has init() been called */
|
|
@@ -914,7 +916,7 @@ class B {
|
|
|
914
916
|
async readHeader(t) {
|
|
915
917
|
if (this.isInitialized)
|
|
916
918
|
return this;
|
|
917
|
-
const n = new DataView(await this.source.fetch(0,
|
|
919
|
+
const n = new DataView(await this.source.fetch(0, Ae(this.source, 0, this.defaultReadSize), t));
|
|
918
920
|
if (n.byteLength === 0)
|
|
919
921
|
throw new Error("Unable to read empty tiff");
|
|
920
922
|
n.sourceOffset = 0;
|
|
@@ -923,23 +925,23 @@ class B {
|
|
|
923
925
|
r += 2, this.isLittleEndian = o === ee.Little, this.version = n.getUint16(r, this.isLittleEndian), r += 2;
|
|
924
926
|
let i;
|
|
925
927
|
if (this.version === R.BigTiff) {
|
|
926
|
-
this.ifdConfig =
|
|
928
|
+
this.ifdConfig = Ze;
|
|
927
929
|
const s = n.getUint16(r, this.isLittleEndian);
|
|
928
930
|
if (r += 2, s !== 8)
|
|
929
931
|
throw new Error("Only 8byte pointers are supported");
|
|
930
932
|
const l = n.getUint16(r, this.isLittleEndian);
|
|
931
933
|
if (r += 2, l !== 0)
|
|
932
934
|
throw new Error("Invalid big tiff header");
|
|
933
|
-
i =
|
|
935
|
+
i = x(n, r, this.ifdConfig.pointer, this.isLittleEndian), r += this.ifdConfig.pointer;
|
|
934
936
|
} else if (this.version === R.Tiff)
|
|
935
|
-
i =
|
|
937
|
+
i = x(n, r, this.ifdConfig.pointer, this.isLittleEndian), r += this.ifdConfig.pointer;
|
|
936
938
|
else
|
|
937
939
|
throw new Error(`Only tiff supported version:${String(this.version)}`);
|
|
938
940
|
const a = i - r;
|
|
939
|
-
for (a > 0 && a < 16 * 1024 && (this.options = new
|
|
941
|
+
for (a > 0 && a < 16 * 1024 && (this.options = new rn(), this.options.process(n, r, a)); i !== 0; ) {
|
|
940
942
|
let s = n;
|
|
941
|
-
if (!
|
|
942
|
-
const l = await this.source.fetch(i,
|
|
943
|
+
if (!Z(s, i, 1024)) {
|
|
944
|
+
const l = await this.source.fetch(i, Ae(this.source, i, this.defaultReadSize), t);
|
|
943
945
|
s = new DataView(l), s.sourceOffset = i;
|
|
944
946
|
}
|
|
945
947
|
i = this.readIfd(i, s);
|
|
@@ -953,22 +955,22 @@ class B {
|
|
|
953
955
|
* @param view offset that contains the bytes for the header
|
|
954
956
|
*/
|
|
955
957
|
readIfd(t, n) {
|
|
956
|
-
const r = t - n.sourceOffset, o =
|
|
957
|
-
if (!
|
|
958
|
-
throw new Error("IFD out of range @ " +
|
|
958
|
+
const r = t - n.sourceOffset, o = x(n, r, this.ifdConfig.offset, this.isLittleEndian), i = /* @__PURE__ */ new Map(), a = o * this.ifdConfig.ifd;
|
|
959
|
+
if (!Z(n, t, a))
|
|
960
|
+
throw new Error("IFD out of range @ " + on(t) + " IFD" + this.images.length);
|
|
959
961
|
const s = this.ifdConfig.ifd, l = r + this.ifdConfig.offset;
|
|
960
962
|
for (let c = 0; c < o; c++) {
|
|
961
|
-
const u =
|
|
963
|
+
const u = Yt(this, n, l + c * s);
|
|
962
964
|
i.set(u.id, u);
|
|
963
965
|
}
|
|
964
|
-
return this.images.push(new
|
|
966
|
+
return this.images.push(new nn(this, this.images.length, i)), x(n, l + o * s, this.ifdConfig.pointer, this.isLittleEndian);
|
|
965
967
|
}
|
|
966
968
|
}
|
|
967
|
-
function
|
|
969
|
+
function Ae(e, t, n) {
|
|
968
970
|
const r = e.metadata?.size;
|
|
969
971
|
return r == null || r < 0 ? n : t + n > r ? r - t : n;
|
|
970
972
|
}
|
|
971
|
-
async function
|
|
973
|
+
async function ce(e, t) {
|
|
972
974
|
const n = new Blob([e]), r = await createImageBitmap(n), o = new OffscreenCanvas(r.width, r.height), i = o.getContext("2d");
|
|
973
975
|
i.drawImage(r, 0, 0), r.close();
|
|
974
976
|
const { width: a, height: s } = o, c = i.getImageData(0, 0, a, s).data, u = t.samplesPerPixel;
|
|
@@ -988,23 +990,23 @@ async function le(e, t) {
|
|
|
988
990
|
}
|
|
989
991
|
throw new Error(`Unsupported SamplesPerPixel for JPEG: ${u}`);
|
|
990
992
|
}
|
|
991
|
-
function
|
|
993
|
+
function an(e, t = "") {
|
|
992
994
|
if (!e)
|
|
993
995
|
throw new Error(t);
|
|
994
996
|
}
|
|
995
|
-
async function
|
|
997
|
+
async function sn(e, { format: t, signal: n }) {
|
|
996
998
|
const r = e instanceof Response ? e : new Response(e);
|
|
997
|
-
|
|
999
|
+
an(r.body, "Response does not contain body.");
|
|
998
1000
|
try {
|
|
999
1001
|
return await new Response(r.body.pipeThrough(new DecompressionStream(t), { signal: n })).arrayBuffer();
|
|
1000
1002
|
} catch {
|
|
1001
1003
|
throw n?.throwIfAborted(), new Error(`Failed to decode ${t}`);
|
|
1002
1004
|
}
|
|
1003
1005
|
}
|
|
1004
|
-
async function
|
|
1005
|
-
return
|
|
1006
|
+
async function Qe(e) {
|
|
1007
|
+
return sn(e, { format: "deflate" });
|
|
1006
1008
|
}
|
|
1007
|
-
function
|
|
1009
|
+
function ln(e, t) {
|
|
1008
1010
|
const n = e;
|
|
1009
1011
|
let r = 0, o = e.length - t;
|
|
1010
1012
|
do {
|
|
@@ -1013,7 +1015,7 @@ function tn(e, t) {
|
|
|
1013
1015
|
o -= t;
|
|
1014
1016
|
} while (o > 0);
|
|
1015
1017
|
}
|
|
1016
|
-
function
|
|
1018
|
+
function cn(e, t, n) {
|
|
1017
1019
|
let r = 0, o = e.length;
|
|
1018
1020
|
const i = o / n;
|
|
1019
1021
|
for (; o > t; ) {
|
|
@@ -1026,10 +1028,10 @@ function nn(e, t, n) {
|
|
|
1026
1028
|
for (let l = 0; l < n; l++)
|
|
1027
1029
|
e[n * s + l] = a[(n - l - 1) * i + s];
|
|
1028
1030
|
}
|
|
1029
|
-
function
|
|
1031
|
+
function un(e, t, n, r, o, i, a) {
|
|
1030
1032
|
if (t === _.None)
|
|
1031
1033
|
return e;
|
|
1032
|
-
const s = o / 8, l = a ===
|
|
1034
|
+
const s = o / 8, l = a === M.Separate ? 1 : i;
|
|
1033
1035
|
for (let c = 0; c < r; c++) {
|
|
1034
1036
|
const u = c * l * n * s;
|
|
1035
1037
|
if (u >= e.byteLength)
|
|
@@ -1050,54 +1052,54 @@ function rn(e, t, n, r, o, i, a) {
|
|
|
1050
1052
|
default:
|
|
1051
1053
|
throw new Error(`Predictor 2 not supported for ${o} bits per sample.`);
|
|
1052
1054
|
}
|
|
1053
|
-
|
|
1055
|
+
ln(h, l);
|
|
1054
1056
|
} else if (t === _.FloatingPoint) {
|
|
1055
1057
|
const h = new Uint8Array(e, u, l * n * s);
|
|
1056
|
-
|
|
1058
|
+
cn(h, l, s);
|
|
1057
1059
|
}
|
|
1058
1060
|
}
|
|
1059
1061
|
return e;
|
|
1060
1062
|
}
|
|
1061
|
-
async function
|
|
1063
|
+
async function dn(e) {
|
|
1062
1064
|
return e;
|
|
1063
1065
|
}
|
|
1064
1066
|
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(
|
|
1067
|
+
j.set(f.None, () => Promise.resolve(dn));
|
|
1068
|
+
j.set(f.Deflate, () => Promise.resolve(Qe));
|
|
1069
|
+
j.set(f.DeflateOther, () => Promise.resolve(Qe));
|
|
1068
1070
|
j.set(f.Lzw, () => import("./lzw-BY5a_5nb.js").then((e) => e.decode));
|
|
1069
1071
|
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
|
|
1072
|
+
j.set(f.Jpeg, () => Promise.resolve(ce));
|
|
1073
|
+
j.set(f.Jpeg6, () => Promise.resolve(ce));
|
|
1074
|
+
j.set(f.Webp, () => Promise.resolve(ce));
|
|
1075
|
+
j.set(f.Lerc, () => import("./lerc-C1mQ_Kqq.js").then((e) => e.decode));
|
|
1076
|
+
async function ue(e, t, n) {
|
|
1075
1077
|
const r = j.get(t);
|
|
1076
1078
|
if (!r)
|
|
1077
1079
|
throw new Error(`Unsupported compression: ${t}`);
|
|
1078
1080
|
const i = await (await r())(e, n);
|
|
1079
1081
|
if (i instanceof ArrayBuffer) {
|
|
1080
|
-
const { predictor: a, width: s, height: l, bitsPerSample: c, samplesPerPixel: u, planarConfiguration: h } = n, p =
|
|
1082
|
+
const { predictor: a, width: s, height: l, bitsPerSample: c, samplesPerPixel: u, planarConfiguration: h } = n, p = un(i, a, s, l, c, u, h);
|
|
1081
1083
|
return {
|
|
1082
1084
|
layout: "pixel-interleaved",
|
|
1083
|
-
data:
|
|
1085
|
+
data: pn(p, n)
|
|
1084
1086
|
};
|
|
1085
1087
|
}
|
|
1086
1088
|
return i;
|
|
1087
1089
|
}
|
|
1088
|
-
function
|
|
1090
|
+
function hn(e, t) {
|
|
1089
1091
|
const n = new Uint8Array(e), r = new Uint8Array(t);
|
|
1090
1092
|
for (let o = 0; o < t; o++)
|
|
1091
1093
|
r[o] = n[o >> 3] >> 7 - (o & 7) & 1 ? 255 : 0;
|
|
1092
1094
|
return r;
|
|
1093
1095
|
}
|
|
1094
|
-
function
|
|
1096
|
+
function pn(e, t) {
|
|
1095
1097
|
const { sampleFormat: n, bitsPerSample: r } = t;
|
|
1096
1098
|
switch (n) {
|
|
1097
1099
|
case A.Uint:
|
|
1098
1100
|
switch (r) {
|
|
1099
1101
|
case 1:
|
|
1100
|
-
return
|
|
1102
|
+
return hn(e, t.width * t.height * t.samplesPerPixel);
|
|
1101
1103
|
case 8:
|
|
1102
1104
|
return new Uint8Array(e);
|
|
1103
1105
|
case 16:
|
|
@@ -1127,7 +1129,7 @@ function sn(e, t) {
|
|
|
1127
1129
|
}
|
|
1128
1130
|
throw new Error(`Unsupported sample format/depth: SampleFormat=${n}, BitsPerSample=${r}`);
|
|
1129
1131
|
}
|
|
1130
|
-
class
|
|
1132
|
+
class gn {
|
|
1131
1133
|
name = "source:cache";
|
|
1132
1134
|
maxSize;
|
|
1133
1135
|
/** Number of bytes cached in cacheA, when this overflows maxSize cacheA is moved to cacheB and cacheB is dropped */
|
|
@@ -1150,7 +1152,7 @@ class ln {
|
|
|
1150
1152
|
return o ? (o.hits++, o.promise) : (o = this.cacheB.get(r), o ? (o.hits++, o.saves++, this.size += o.size, this.cacheA.set(r, o), o.promise) : (o = { promise: n(t), hits: 0, saves: 0, size: t.length }, this.size += o.size, this.size > this.maxSize && (this.size = o.size, this.cacheB = this.cacheA, this.cacheA = /* @__PURE__ */ new Map(), this.resets++), this.cacheA.set(r, o), o.promise));
|
|
1151
1153
|
}
|
|
1152
1154
|
}
|
|
1153
|
-
class
|
|
1155
|
+
class U extends Error {
|
|
1154
1156
|
/** Status code for the error eg 403 - Forbidden vs 404 Not found */
|
|
1155
1157
|
code;
|
|
1156
1158
|
/** URL that the status code came from */
|
|
@@ -1166,7 +1168,7 @@ class M extends Error {
|
|
|
1166
1168
|
}
|
|
1167
1169
|
/** Check that a unknown is a FsError */
|
|
1168
1170
|
static is(t) {
|
|
1169
|
-
return t instanceof
|
|
1171
|
+
return t instanceof U ? !0 : typeof t != "object" || t == null ? !1 : "_sourceError" in t && t._sourceError === "SourceError";
|
|
1170
1172
|
}
|
|
1171
1173
|
}
|
|
1172
1174
|
const Q = {
|
|
@@ -1206,7 +1208,7 @@ const Q = {
|
|
|
1206
1208
|
return o;
|
|
1207
1209
|
}
|
|
1208
1210
|
};
|
|
1209
|
-
class
|
|
1211
|
+
class mn {
|
|
1210
1212
|
source;
|
|
1211
1213
|
middleware;
|
|
1212
1214
|
static is(t) {
|
|
@@ -1247,14 +1249,14 @@ class cn {
|
|
|
1247
1249
|
return t({ source: this, offset: n, length: r, signal: o?.signal });
|
|
1248
1250
|
}
|
|
1249
1251
|
}
|
|
1250
|
-
function
|
|
1252
|
+
function fn(e) {
|
|
1251
1253
|
try {
|
|
1252
1254
|
return new URL(e);
|
|
1253
1255
|
} catch {
|
|
1254
1256
|
return null;
|
|
1255
1257
|
}
|
|
1256
1258
|
}
|
|
1257
|
-
class
|
|
1259
|
+
class yn {
|
|
1258
1260
|
name = "source:chunk";
|
|
1259
1261
|
/** Number of bytes to chunk requests into */
|
|
1260
1262
|
chunkSize;
|
|
@@ -1266,7 +1268,7 @@ class dn {
|
|
|
1266
1268
|
return n(t);
|
|
1267
1269
|
const r = Math.floor(t.offset / this.chunkSize), o = Math.ceil((t.offset + t.length) / this.chunkSize), i = t.source.metadata?.size;
|
|
1268
1270
|
if (i != null && t.offset + t.length > i)
|
|
1269
|
-
throw new
|
|
1271
|
+
throw new U(`Request outside of bounds ${Q.toRange(t.offset, t.length)}`, 416, t.source);
|
|
1270
1272
|
const a = r * this.chunkSize, l = (i != null ? Math.min(o * this.chunkSize, i) : o * this.chunkSize) - a, c = t.offset - a;
|
|
1271
1273
|
return o - r > 1 ? (await this.fetchChunks(t, r, o)).slice(c, c + t.length) : t.offset === a && t.length === l ? n(t) : (await n({ ...t, offset: a, length: l })).slice(c, c + t.length);
|
|
1272
1274
|
}
|
|
@@ -1282,7 +1284,7 @@ class dn {
|
|
|
1282
1284
|
return s.buffer;
|
|
1283
1285
|
}
|
|
1284
1286
|
}
|
|
1285
|
-
function
|
|
1287
|
+
function je(e) {
|
|
1286
1288
|
const t = {}, n = e.headers.get("content-length");
|
|
1287
1289
|
n && (t.size = parseInt(n));
|
|
1288
1290
|
const r = e.headers.get("content-range");
|
|
@@ -1304,33 +1306,33 @@ class $ {
|
|
|
1304
1306
|
return this._head ? this._head : (this._head = $.fetch(this.url, { method: "HEAD", headers: this.headers }).then((t) => {
|
|
1305
1307
|
if (!t.ok)
|
|
1306
1308
|
throw delete this._head, new Error(`Failed to HEAD ${this.url.href}`, { cause: { statusCode: t.status, msg: t.statusText } });
|
|
1307
|
-
return this.metadata =
|
|
1309
|
+
return this.metadata = je(t), this.metadata;
|
|
1308
1310
|
}), this._head);
|
|
1309
1311
|
}
|
|
1310
1312
|
async fetch(t, n, r) {
|
|
1311
1313
|
try {
|
|
1312
1314
|
const o = { range: Q.toRange(t, n), ...this.headers }, i = await $.fetch(this.url, { headers: o, signal: r?.signal });
|
|
1313
1315
|
if (!i.ok)
|
|
1314
|
-
throw new
|
|
1315
|
-
const a =
|
|
1316
|
+
throw new U(`Failed to fetch ${this.url.href} ${o.range}`, i.status, this, new Error(i.statusText));
|
|
1317
|
+
const a = je(i);
|
|
1316
1318
|
if (this.metadata == null)
|
|
1317
1319
|
this.metadata = a;
|
|
1318
1320
|
else if (this.metadata.eTag && this.metadata.eTag !== a.eTag)
|
|
1319
|
-
throw new
|
|
1321
|
+
throw new U(`ETag conflict ${this.url.href} ${o.range} expected: ${this.metadata.eTag} got: ${a.eTag}`, 409, this);
|
|
1320
1322
|
return i.arrayBuffer();
|
|
1321
1323
|
} catch (o) {
|
|
1322
|
-
throw
|
|
1324
|
+
throw U.is(o) && o.source === this ? o : new U(`Failed to fetch: ${this.url.href}`, 500, this, o);
|
|
1323
1325
|
}
|
|
1324
1326
|
}
|
|
1325
1327
|
}
|
|
1326
1328
|
$.fetch = (e, t) => fetch(e, t);
|
|
1327
|
-
function
|
|
1329
|
+
function wn(e) {
|
|
1328
1330
|
if (typeof e != "string")
|
|
1329
1331
|
return e;
|
|
1330
|
-
const t =
|
|
1332
|
+
const t = fn(e);
|
|
1331
1333
|
return t || new URL("memory://" + e);
|
|
1332
1334
|
}
|
|
1333
|
-
class
|
|
1335
|
+
class de {
|
|
1334
1336
|
url;
|
|
1335
1337
|
type = "memory";
|
|
1336
1338
|
data;
|
|
@@ -1339,53 +1341,53 @@ class ue {
|
|
|
1339
1341
|
return t instanceof ArrayBuffer ? t : t.byteLength === t.buffer.byteLength ? t.buffer : t.buffer.slice(t.byteOffset, t.byteOffset + t.byteLength);
|
|
1340
1342
|
}
|
|
1341
1343
|
constructor(t, n) {
|
|
1342
|
-
const r =
|
|
1343
|
-
this.url =
|
|
1344
|
+
const r = de.toArrayBuffer(n ?? new Uint8Array());
|
|
1345
|
+
this.url = wn(t), this.data = r, this.metadata = { size: r.byteLength };
|
|
1344
1346
|
}
|
|
1345
1347
|
head() {
|
|
1346
1348
|
return Promise.resolve({ size: this.data.byteLength });
|
|
1347
1349
|
}
|
|
1348
1350
|
fetch(t, n) {
|
|
1349
1351
|
if (t < 0 && (t = this.data.byteLength + t), t > this.data.byteLength)
|
|
1350
|
-
throw new
|
|
1352
|
+
throw new U(`Read offset outside of file bounds range:${Q.toRange(t, n)} fileSize:${this.data.byteLength}`, 416, this);
|
|
1351
1353
|
return Promise.resolve(this.data.slice(t, n == null ? void 0 : t + n));
|
|
1352
1354
|
}
|
|
1353
1355
|
}
|
|
1354
|
-
const
|
|
1355
|
-
[
|
|
1356
|
-
[
|
|
1357
|
-
[
|
|
1358
|
-
},
|
|
1356
|
+
const qe = "https://proj.org/schemas/v0.7/projjson.schema.json", Sn = 1, Pn = 2, H = 32767, Re = 1, bn = 2, Cn = 3, Ln = 4, In = 5, Gn = 6, vn = 7, En = 8, Fn = 9, An = 10, jn = 11, Rn = 12, Mn = 14, Un = 15, On = 16, xn = 17, Kn = 18, Dn = 21, Nn = 22, zn = 24, Bn = 26, _n = 27, Te = 9102, $n = 9101, kn = 9105, Wn = {
|
|
1357
|
+
[Te]: "degree",
|
|
1358
|
+
[$n]: "radian",
|
|
1359
|
+
[kn]: "grad"
|
|
1360
|
+
}, et = 9001, Jn = 9002, Hn = 9003, Vn = {
|
|
1359
1361
|
type: "LinearUnit",
|
|
1360
1362
|
name: "US survey foot",
|
|
1361
1363
|
conversion_factor: 0.30480060960121924
|
|
1362
|
-
},
|
|
1363
|
-
[
|
|
1364
|
-
[
|
|
1365
|
-
[
|
|
1364
|
+
}, Yn = {
|
|
1365
|
+
[et]: "metre",
|
|
1366
|
+
[Jn]: "foot",
|
|
1367
|
+
[Hn]: Vn
|
|
1366
1368
|
};
|
|
1367
|
-
function
|
|
1369
|
+
function Xn(e) {
|
|
1368
1370
|
const t = e.modelType;
|
|
1369
|
-
if (t ===
|
|
1370
|
-
return
|
|
1371
|
-
if (t ===
|
|
1372
|
-
return
|
|
1371
|
+
if (t === Sn)
|
|
1372
|
+
return Qn(e);
|
|
1373
|
+
if (t === Pn)
|
|
1374
|
+
return Zn(e);
|
|
1373
1375
|
throw new Error(`Unsupported GeoTIFF model type: ${t}`);
|
|
1374
1376
|
}
|
|
1375
|
-
function
|
|
1377
|
+
function Zn(e) {
|
|
1376
1378
|
const t = e.geodeticCRS;
|
|
1377
|
-
return t !== null && t !==
|
|
1379
|
+
return t !== null && t !== H ? t : tt(e, qe);
|
|
1378
1380
|
}
|
|
1379
|
-
function
|
|
1381
|
+
function Qn(e) {
|
|
1380
1382
|
const t = e.projectedCRS;
|
|
1381
|
-
return t !== null && t !==
|
|
1383
|
+
return t !== null && t !== H ? t : qn(e);
|
|
1382
1384
|
}
|
|
1383
|
-
function
|
|
1384
|
-
const n =
|
|
1385
|
+
function tt(e, t) {
|
|
1386
|
+
const n = Tn(e);
|
|
1385
1387
|
let r = "Greenwich", o = 0;
|
|
1386
|
-
e.primeMeridian !== null && e.primeMeridian !==
|
|
1388
|
+
e.primeMeridian !== null && e.primeMeridian !== H ? r = `EPSG:${e.primeMeridian}` : e.primeMeridianLongitude !== null && (o = e.primeMeridianLongitude, r = "User-defined");
|
|
1387
1389
|
let i;
|
|
1388
|
-
e.geodeticDatum !== null && e.geodeticDatum !==
|
|
1390
|
+
e.geodeticDatum !== null && e.geodeticDatum !== H ? i = {
|
|
1389
1391
|
type: "GeodeticReferenceFrame",
|
|
1390
1392
|
name: `Unknown datum based upon EPSG ${e.geodeticDatum} ellipsoid`
|
|
1391
1393
|
} : i = {
|
|
@@ -1398,23 +1400,23 @@ function qe(e, t) {
|
|
|
1398
1400
|
type: "GeographicCRS",
|
|
1399
1401
|
name: e.geodeticCitation ?? "User-defined",
|
|
1400
1402
|
datum: i,
|
|
1401
|
-
coordinate_system:
|
|
1403
|
+
coordinate_system: tr(e)
|
|
1402
1404
|
};
|
|
1403
1405
|
return t !== void 0 && (a.$schema = t), a;
|
|
1404
1406
|
}
|
|
1405
|
-
function
|
|
1406
|
-
const t =
|
|
1407
|
+
function qn(e) {
|
|
1408
|
+
const t = tt(e), n = er(e), r = nr(e);
|
|
1407
1409
|
return {
|
|
1408
1410
|
type: "ProjectedCRS",
|
|
1409
|
-
$schema:
|
|
1411
|
+
$schema: qe,
|
|
1410
1412
|
name: e.projectedCitation ?? e.citation ?? "User-defined",
|
|
1411
1413
|
base_crs: t,
|
|
1412
1414
|
conversion: n,
|
|
1413
1415
|
coordinate_system: r
|
|
1414
1416
|
};
|
|
1415
1417
|
}
|
|
1416
|
-
function
|
|
1417
|
-
if (e.ellipsoid !== null && e.ellipsoid !==
|
|
1418
|
+
function Tn(e) {
|
|
1419
|
+
if (e.ellipsoid !== null && e.ellipsoid !== H) {
|
|
1418
1420
|
const n = {
|
|
1419
1421
|
name: `EPSG ellipsoid ${e.ellipsoid}`
|
|
1420
1422
|
};
|
|
@@ -1434,7 +1436,7 @@ function Hn(e) {
|
|
|
1434
1436
|
throw new Error("User-defined ellipsoid requires ellipsoidInvFlattening or ellipsoidSemiMinorAxis");
|
|
1435
1437
|
return t;
|
|
1436
1438
|
}
|
|
1437
|
-
function
|
|
1439
|
+
function er(e) {
|
|
1438
1440
|
const t = e.projMethod;
|
|
1439
1441
|
if (t === null)
|
|
1440
1442
|
throw new Error("User-defined projected CRS requires projMethod");
|
|
@@ -1452,10 +1454,10 @@ function Yn(e) {
|
|
|
1452
1454
|
unit: "unity"
|
|
1453
1455
|
});
|
|
1454
1456
|
switch (t) {
|
|
1455
|
-
case
|
|
1456
|
-
case
|
|
1457
|
-
case
|
|
1458
|
-
const i = t ===
|
|
1457
|
+
case Re:
|
|
1458
|
+
case bn:
|
|
1459
|
+
case _n: {
|
|
1460
|
+
const i = t === Re ? "Transverse Mercator" : "Transverse Mercator (South Orientated)";
|
|
1459
1461
|
return {
|
|
1460
1462
|
name: i,
|
|
1461
1463
|
method: { name: i },
|
|
@@ -1468,10 +1470,10 @@ function Yn(e) {
|
|
|
1468
1470
|
]
|
|
1469
1471
|
};
|
|
1470
1472
|
}
|
|
1471
|
-
case
|
|
1472
|
-
case
|
|
1473
|
-
case
|
|
1474
|
-
case
|
|
1473
|
+
case Cn:
|
|
1474
|
+
case Ln:
|
|
1475
|
+
case In:
|
|
1476
|
+
case Gn: {
|
|
1475
1477
|
const i = "Hotine Oblique Mercator (variant B)";
|
|
1476
1478
|
return {
|
|
1477
1479
|
name: i,
|
|
@@ -1487,7 +1489,7 @@ function Yn(e) {
|
|
|
1487
1489
|
]
|
|
1488
1490
|
};
|
|
1489
1491
|
}
|
|
1490
|
-
case
|
|
1492
|
+
case vn: {
|
|
1491
1493
|
const i = "Mercator (variant A)";
|
|
1492
1494
|
return {
|
|
1493
1495
|
name: i,
|
|
@@ -1501,7 +1503,7 @@ function Yn(e) {
|
|
|
1501
1503
|
]
|
|
1502
1504
|
};
|
|
1503
1505
|
}
|
|
1504
|
-
case
|
|
1506
|
+
case En: {
|
|
1505
1507
|
const i = "Lambert Conic Conformal (2SP)";
|
|
1506
1508
|
return {
|
|
1507
1509
|
name: i,
|
|
@@ -1516,7 +1518,7 @@ function Yn(e) {
|
|
|
1516
1518
|
]
|
|
1517
1519
|
};
|
|
1518
1520
|
}
|
|
1519
|
-
case
|
|
1521
|
+
case Fn: {
|
|
1520
1522
|
const i = "Lambert Conic Conformal (1SP)";
|
|
1521
1523
|
return {
|
|
1522
1524
|
name: i,
|
|
@@ -1530,7 +1532,7 @@ function Yn(e) {
|
|
|
1530
1532
|
]
|
|
1531
1533
|
};
|
|
1532
1534
|
}
|
|
1533
|
-
case
|
|
1535
|
+
case An: {
|
|
1534
1536
|
const i = "Lambert Azimuthal Equal Area";
|
|
1535
1537
|
return {
|
|
1536
1538
|
name: i,
|
|
@@ -1543,7 +1545,7 @@ function Yn(e) {
|
|
|
1543
1545
|
]
|
|
1544
1546
|
};
|
|
1545
1547
|
}
|
|
1546
|
-
case
|
|
1548
|
+
case jn: {
|
|
1547
1549
|
const i = "Albers Equal Area";
|
|
1548
1550
|
return {
|
|
1549
1551
|
name: i,
|
|
@@ -1558,7 +1560,7 @@ function Yn(e) {
|
|
|
1558
1560
|
]
|
|
1559
1561
|
};
|
|
1560
1562
|
}
|
|
1561
|
-
case
|
|
1563
|
+
case Rn: {
|
|
1562
1564
|
const i = "Modified Azimuthal Equidistant";
|
|
1563
1565
|
return {
|
|
1564
1566
|
name: i,
|
|
@@ -1571,7 +1573,7 @@ function Yn(e) {
|
|
|
1571
1573
|
]
|
|
1572
1574
|
};
|
|
1573
1575
|
}
|
|
1574
|
-
case
|
|
1576
|
+
case Mn: {
|
|
1575
1577
|
const i = "Stereographic";
|
|
1576
1578
|
return {
|
|
1577
1579
|
name: i,
|
|
@@ -1585,7 +1587,7 @@ function Yn(e) {
|
|
|
1585
1587
|
]
|
|
1586
1588
|
};
|
|
1587
1589
|
}
|
|
1588
|
-
case
|
|
1590
|
+
case Un: {
|
|
1589
1591
|
const i = "Polar Stereographic (variant B)";
|
|
1590
1592
|
return {
|
|
1591
1593
|
name: i,
|
|
@@ -1598,7 +1600,7 @@ function Yn(e) {
|
|
|
1598
1600
|
]
|
|
1599
1601
|
};
|
|
1600
1602
|
}
|
|
1601
|
-
case
|
|
1603
|
+
case On: {
|
|
1602
1604
|
const i = "Oblique Stereographic";
|
|
1603
1605
|
return {
|
|
1604
1606
|
name: i,
|
|
@@ -1612,7 +1614,7 @@ function Yn(e) {
|
|
|
1612
1614
|
]
|
|
1613
1615
|
};
|
|
1614
1616
|
}
|
|
1615
|
-
case
|
|
1617
|
+
case xn: {
|
|
1616
1618
|
const i = "Equidistant Cylindrical";
|
|
1617
1619
|
return {
|
|
1618
1620
|
name: i,
|
|
@@ -1625,7 +1627,7 @@ function Yn(e) {
|
|
|
1625
1627
|
]
|
|
1626
1628
|
};
|
|
1627
1629
|
}
|
|
1628
|
-
case
|
|
1630
|
+
case Kn: {
|
|
1629
1631
|
const i = "Cassini-Soldner";
|
|
1630
1632
|
return {
|
|
1631
1633
|
name: i,
|
|
@@ -1638,7 +1640,7 @@ function Yn(e) {
|
|
|
1638
1640
|
]
|
|
1639
1641
|
};
|
|
1640
1642
|
}
|
|
1641
|
-
case
|
|
1643
|
+
case Nn: {
|
|
1642
1644
|
const i = "American Polyconic";
|
|
1643
1645
|
return {
|
|
1644
1646
|
name: i,
|
|
@@ -1651,7 +1653,7 @@ function Yn(e) {
|
|
|
1651
1653
|
]
|
|
1652
1654
|
};
|
|
1653
1655
|
}
|
|
1654
|
-
case
|
|
1656
|
+
case zn: {
|
|
1655
1657
|
const i = "Sinusoidal";
|
|
1656
1658
|
return {
|
|
1657
1659
|
name: i,
|
|
@@ -1663,7 +1665,7 @@ function Yn(e) {
|
|
|
1663
1665
|
]
|
|
1664
1666
|
};
|
|
1665
1667
|
}
|
|
1666
|
-
case
|
|
1668
|
+
case Dn: {
|
|
1667
1669
|
const i = "Orthographic";
|
|
1668
1670
|
return {
|
|
1669
1671
|
name: i,
|
|
@@ -1676,7 +1678,7 @@ function Yn(e) {
|
|
|
1676
1678
|
]
|
|
1677
1679
|
};
|
|
1678
1680
|
}
|
|
1679
|
-
case
|
|
1681
|
+
case Bn: {
|
|
1680
1682
|
const i = "New Zealand Map Grid";
|
|
1681
1683
|
return {
|
|
1682
1684
|
name: i,
|
|
@@ -1693,8 +1695,8 @@ function Yn(e) {
|
|
|
1693
1695
|
throw new Error(`Unsupported coordinate transformation type: ${t}`);
|
|
1694
1696
|
}
|
|
1695
1697
|
}
|
|
1696
|
-
function
|
|
1697
|
-
const t =
|
|
1698
|
+
function tr(e) {
|
|
1699
|
+
const t = Wn[e.angularUnits ?? Te] ?? "degree";
|
|
1698
1700
|
return {
|
|
1699
1701
|
subtype: "ellipsoidal",
|
|
1700
1702
|
axis: [
|
|
@@ -1713,8 +1715,8 @@ function Xn(e) {
|
|
|
1713
1715
|
]
|
|
1714
1716
|
};
|
|
1715
1717
|
}
|
|
1716
|
-
function
|
|
1717
|
-
const t =
|
|
1718
|
+
function nr(e) {
|
|
1719
|
+
const t = Yn[e.projLinearUnits ?? et] ?? "metre";
|
|
1718
1720
|
return {
|
|
1719
1721
|
subtype: "Cartesian",
|
|
1720
1722
|
axis: [
|
|
@@ -1723,20 +1725,20 @@ function Zn(e) {
|
|
|
1723
1725
|
]
|
|
1724
1726
|
};
|
|
1725
1727
|
}
|
|
1726
|
-
const
|
|
1727
|
-
async function
|
|
1728
|
+
const rr = 1024 * 1024, or = 16 * 1024 * 1024, Me = 6;
|
|
1729
|
+
async function ir(e, t, n) {
|
|
1728
1730
|
if (t.length === 0)
|
|
1729
1731
|
return [];
|
|
1730
|
-
const r = n?.coalesce ??
|
|
1732
|
+
const r = n?.coalesce ?? rr, o = n?.maxRangeSize ?? or, i = n?.signal, a = ar(t, r, o), s = await lr(e, a, i), l = new Array(t.length);
|
|
1731
1733
|
for (let c = 0; c < t.length; c++) {
|
|
1732
|
-
const u = t[c], h =
|
|
1733
|
-
if (
|
|
1734
|
+
const u = t[c], h = sr(a, u.offset), p = a[h], g = s[h], y = u.offset - p.offset, w = y + u.length;
|
|
1735
|
+
if (w > g.byteLength)
|
|
1734
1736
|
throw new Error(`Failed to fetch bytes from offset:${u.offset} wanted:${u.length} got:${g.byteLength - y}`);
|
|
1735
|
-
l[c] = g.slice(y,
|
|
1737
|
+
l[c] = g.slice(y, w);
|
|
1736
1738
|
}
|
|
1737
1739
|
return l;
|
|
1738
1740
|
}
|
|
1739
|
-
function
|
|
1741
|
+
function ar(e, t, n) {
|
|
1740
1742
|
const r = [...e].sort((a, s) => a.offset - s.offset), o = [];
|
|
1741
1743
|
let i = null;
|
|
1742
1744
|
for (const a of r) {
|
|
@@ -1749,7 +1751,7 @@ function er(e, t, n) {
|
|
|
1749
1751
|
}
|
|
1750
1752
|
return i != null && o.push(i), o;
|
|
1751
1753
|
}
|
|
1752
|
-
function
|
|
1754
|
+
function sr(e, t) {
|
|
1753
1755
|
let n = 0, r = e.length - 1;
|
|
1754
1756
|
for (; n < r; ) {
|
|
1755
1757
|
const o = n + r + 1 >>> 1;
|
|
@@ -1757,41 +1759,41 @@ function tr(e, t) {
|
|
|
1757
1759
|
}
|
|
1758
1760
|
return n;
|
|
1759
1761
|
}
|
|
1760
|
-
async function
|
|
1762
|
+
async function lr(e, t, n) {
|
|
1761
1763
|
const r = new Array(t.length);
|
|
1762
|
-
for (let o = 0; o < t.length; o +=
|
|
1763
|
-
const i = t.slice(o, o +
|
|
1764
|
+
for (let o = 0; o < t.length; o += Me) {
|
|
1765
|
+
const i = t.slice(o, o + Me), a = await Promise.all(i.map((s) => e.fetch(s.offset, s.length, { signal: n })));
|
|
1764
1766
|
for (let s = 0; s < a.length; s++)
|
|
1765
1767
|
r[o + s] = a[s];
|
|
1766
1768
|
}
|
|
1767
1769
|
return r;
|
|
1768
1770
|
}
|
|
1769
|
-
async function
|
|
1770
|
-
const a =
|
|
1771
|
+
async function nt(e, t, n, { boundless: r = !0, pool: o, signal: i } = {}) {
|
|
1772
|
+
const a = dr(e, t, n, { signal: i }), s = e.maskImage != null ? at(e.maskImage, t, n, e.dataSource, {
|
|
1771
1773
|
signal: i,
|
|
1772
1774
|
debug: e._debug ? { label: "mask" } : void 0
|
|
1773
1775
|
}) : Promise.resolve(null), [l, c] = await Promise.all([a, s]);
|
|
1774
|
-
return
|
|
1776
|
+
return rt(e, t, n, l, c, { boundless: r, pool: o });
|
|
1775
1777
|
}
|
|
1776
|
-
async function
|
|
1777
|
-
const { bitsPerSample: s, predictor: l, planarConfiguration: c, sampleFormat: u, lercParameters: h } = e.cachedTags, { sampleFormat: p, bitsPerSample: g } =
|
|
1778
|
+
async function rt(e, t, n, r, o, { boundless: i, pool: a }) {
|
|
1779
|
+
const { bitsPerSample: s, predictor: l, planarConfiguration: c, sampleFormat: u, lercParameters: h } = e.cachedTags, { sampleFormat: p, bitsPerSample: g } = ut(u, s), y = se(e.transform, $e(t * e.tileWidth, n * e.tileHeight)), w = e.image.value(d.SamplesPerPixel) ?? 1, b = {
|
|
1778
1780
|
sampleFormat: p,
|
|
1779
1781
|
bitsPerSample: g,
|
|
1780
|
-
samplesPerPixel:
|
|
1782
|
+
samplesPerPixel: w,
|
|
1781
1783
|
width: e.tileWidth,
|
|
1782
1784
|
height: e.tileHeight,
|
|
1783
1785
|
predictor: l,
|
|
1784
1786
|
planarConfiguration: c,
|
|
1785
1787
|
lercParameters: h
|
|
1786
|
-
}, [
|
|
1787
|
-
|
|
1788
|
-
o != null && e.maskImage != null ?
|
|
1789
|
-
]),
|
|
1790
|
-
...
|
|
1791
|
-
count:
|
|
1788
|
+
}, [E, L] = await Promise.all([
|
|
1789
|
+
ur(r, b, a),
|
|
1790
|
+
o != null && e.maskImage != null ? cr(o, e.maskImage, a) : Promise.resolve(null)
|
|
1791
|
+
]), C = {
|
|
1792
|
+
...E,
|
|
1793
|
+
count: w,
|
|
1792
1794
|
height: e.tileHeight,
|
|
1793
1795
|
width: e.tileWidth,
|
|
1794
|
-
mask:
|
|
1796
|
+
mask: L,
|
|
1795
1797
|
transform: y,
|
|
1796
1798
|
crs: e.crs,
|
|
1797
1799
|
nodata: e.nodata
|
|
@@ -1799,40 +1801,40 @@ async function et(e, t, n, r, o, { boundless: i, pool: a }) {
|
|
|
1799
1801
|
return {
|
|
1800
1802
|
x: t,
|
|
1801
1803
|
y: n,
|
|
1802
|
-
array: i === !0 ?
|
|
1804
|
+
array: i === !0 ? C : mr(e, t, n, C)
|
|
1803
1805
|
};
|
|
1804
1806
|
}
|
|
1805
|
-
async function
|
|
1807
|
+
async function ot(e, t, { boundless: n = !0, pool: r, signal: o } = {}) {
|
|
1806
1808
|
if (t.length === 0)
|
|
1807
1809
|
return [];
|
|
1808
|
-
const i =
|
|
1810
|
+
const i = pr(e, t, { signal: o }), a = e.maskImage != null ? ct(e.maskImage, t, e.dataSource, {
|
|
1809
1811
|
signal: o,
|
|
1810
1812
|
debug: e._debug ? { label: "mask" } : void 0
|
|
1811
1813
|
}) : Promise.resolve(t.map(() => null)), [s, l] = await Promise.all([
|
|
1812
1814
|
i,
|
|
1813
1815
|
a
|
|
1814
1816
|
]);
|
|
1815
|
-
return Promise.all(t.map(([c, u], h) =>
|
|
1817
|
+
return Promise.all(t.map(([c, u], h) => rt(e, c, u, s[h], l[h] ?? null, {
|
|
1816
1818
|
boundless: n,
|
|
1817
1819
|
pool: r
|
|
1818
1820
|
})));
|
|
1819
1821
|
}
|
|
1820
|
-
async function
|
|
1821
|
-
const r = t.value(d.SampleFormat) ?? [1], o = t.value(d.BitsPerSample) ?? [8], { sampleFormat: i, bitsPerSample: a } =
|
|
1822
|
+
async function cr(e, t, n) {
|
|
1823
|
+
const r = t.value(d.SampleFormat) ?? [1], o = t.value(d.BitsPerSample) ?? [8], { sampleFormat: i, bitsPerSample: a } = ut(r, new Uint16Array(o)), { width: s, height: l } = t.tileSize, c = {
|
|
1822
1824
|
sampleFormat: i,
|
|
1823
1825
|
bitsPerSample: a,
|
|
1824
1826
|
samplesPerPixel: t.value(d.SamplesPerPixel) ?? 1,
|
|
1825
1827
|
width: s,
|
|
1826
1828
|
height: l,
|
|
1827
1829
|
predictor: t.value(d.Predictor) ?? 1,
|
|
1828
|
-
planarConfiguration: t.value(d.PlanarConfiguration) ??
|
|
1829
|
-
}, u = (
|
|
1830
|
+
planarConfiguration: t.value(d.PlanarConfiguration) ?? M.Contig
|
|
1831
|
+
}, u = (w, b, E) => n ? n.decode(w, b, E) : ue(w, b, E), { bytes: h, compression: p } = e, g = await u(h, p, c), y = g.layout === "pixel-interleaved" ? g.data : g.bands[0];
|
|
1830
1832
|
if (y instanceof Uint8Array)
|
|
1831
1833
|
return y;
|
|
1832
1834
|
throw new Error("Expected mask data to decode to Uint8Array");
|
|
1833
1835
|
}
|
|
1834
|
-
async function
|
|
1835
|
-
const r = (o, i, a) => n ? n.decode(o, i, a) :
|
|
1836
|
+
async function ur(e, t, n) {
|
|
1837
|
+
const r = (o, i, a) => n ? n.decode(o, i, a) : ue(o, i, a);
|
|
1836
1838
|
if (Array.isArray(e)) {
|
|
1837
1839
|
const o = { ...t, samplesPerPixel: 1 };
|
|
1838
1840
|
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 +1843,11 @@ async function or(e, t, n) {
|
|
|
1841
1843
|
return r(o, i, t);
|
|
1842
1844
|
}
|
|
1843
1845
|
}
|
|
1844
|
-
async function
|
|
1846
|
+
async function dr(e, t, n, { signal: r } = {}) {
|
|
1845
1847
|
const o = e._debug ? { label: "data" } : void 0;
|
|
1846
1848
|
switch (e.cachedTags.planarConfiguration) {
|
|
1847
|
-
case
|
|
1848
|
-
const i = await
|
|
1849
|
+
case M.Contig: {
|
|
1850
|
+
const i = await at(e.image, t, n, e.dataSource, {
|
|
1849
1851
|
signal: r,
|
|
1850
1852
|
debug: o
|
|
1851
1853
|
});
|
|
@@ -1853,33 +1855,33 @@ async function ir(e, t, n, { signal: r } = {}) {
|
|
|
1853
1855
|
throw new Error(`Tile at (${t}, ${n}) not found`);
|
|
1854
1856
|
return i;
|
|
1855
1857
|
}
|
|
1856
|
-
case
|
|
1857
|
-
return await
|
|
1858
|
+
case M.Separate:
|
|
1859
|
+
return await hr(e, t, n, { signal: r });
|
|
1858
1860
|
default:
|
|
1859
1861
|
throw new Error(`Unsupported PlanarConfiguration: ${e.cachedTags.planarConfiguration}`);
|
|
1860
1862
|
}
|
|
1861
1863
|
}
|
|
1862
|
-
async function
|
|
1864
|
+
async function it(e, t, n) {
|
|
1863
1865
|
const { x: r, y: o } = e.image.tileCount, i = r * o, a = e.cachedTags.samplesPerPixel, s = [...Array(a).keys()].map((l) => {
|
|
1864
1866
|
const c = l * i + n * r + t;
|
|
1865
1867
|
return e.image.getTileSize(c);
|
|
1866
1868
|
});
|
|
1867
1869
|
return Promise.all(s);
|
|
1868
1870
|
}
|
|
1869
|
-
async function
|
|
1870
|
-
const o = e._debug ? { label: "data" } : void 0, a = (await
|
|
1871
|
-
const c = await
|
|
1871
|
+
async function hr(e, t, n, { signal: r } = {}) {
|
|
1872
|
+
const o = e._debug ? { label: "data" } : void 0, a = (await it(e, t, n)).map(async ({ offset: s, imageSize: l }) => {
|
|
1873
|
+
const c = await st(e.image, s, l, e.dataSource, { signal: r, debug: o });
|
|
1872
1874
|
if (c === null)
|
|
1873
1875
|
throw new Error(`Tile at (${t}, ${n}) not found`);
|
|
1874
1876
|
return c;
|
|
1875
1877
|
});
|
|
1876
1878
|
return Promise.all(a);
|
|
1877
1879
|
}
|
|
1878
|
-
async function
|
|
1880
|
+
async function pr(e, t, { signal: n } = {}) {
|
|
1879
1881
|
const r = e._debug ? { label: "data" } : void 0;
|
|
1880
1882
|
switch (e.cachedTags.planarConfiguration) {
|
|
1881
|
-
case
|
|
1882
|
-
return (await
|
|
1883
|
+
case M.Contig:
|
|
1884
|
+
return (await ct(e.image, t, e.dataSource, {
|
|
1883
1885
|
signal: n,
|
|
1884
1886
|
debug: r
|
|
1885
1887
|
})).map((i, a) => {
|
|
@@ -1889,24 +1891,24 @@ async function sr(e, t, { signal: n } = {}) {
|
|
|
1889
1891
|
}
|
|
1890
1892
|
return i;
|
|
1891
1893
|
});
|
|
1892
|
-
case
|
|
1893
|
-
return
|
|
1894
|
+
case M.Separate:
|
|
1895
|
+
return gr(e, t, { signal: n });
|
|
1894
1896
|
default:
|
|
1895
1897
|
throw new Error(`Unsupported PlanarConfiguration: ${e.cachedTags.planarConfiguration}`);
|
|
1896
1898
|
}
|
|
1897
1899
|
}
|
|
1898
|
-
async function
|
|
1899
|
-
const r = e._debug ? { label: "data" } : void 0, o = e.cachedTags.samplesPerPixel, a = (await Promise.all(t.map(([l, c]) =>
|
|
1900
|
+
async function gr(e, t, { signal: n } = {}) {
|
|
1901
|
+
const r = e._debug ? { label: "data" } : void 0, o = e.cachedTags.samplesPerPixel, a = (await Promise.all(t.map(([l, c]) => it(e, l, c)))).flatMap((l) => l.map(({ offset: c, imageSize: u }) => ({
|
|
1900
1902
|
offset: c,
|
|
1901
1903
|
byteCount: u
|
|
1902
|
-
}))), s = await
|
|
1904
|
+
}))), s = await lt(e.image, a, e.dataSource, { signal: n, debug: r });
|
|
1903
1905
|
return t.map(([l, c], u) => s.slice(u * o, u * o + o).map((h) => {
|
|
1904
1906
|
if (h === null)
|
|
1905
1907
|
throw new Error(`Tile at (${l}, ${c}) not found`);
|
|
1906
1908
|
return h;
|
|
1907
1909
|
}));
|
|
1908
1910
|
}
|
|
1909
|
-
async function
|
|
1911
|
+
async function at(e, t, n, r, o) {
|
|
1910
1912
|
const { size: i, tileSize: a } = e;
|
|
1911
1913
|
if (a == null)
|
|
1912
1914
|
throw new Error("Tiff is not tiled");
|
|
@@ -1917,9 +1919,9 @@ async function rt(e, t, n, r, o) {
|
|
|
1917
1919
|
if (c >= u)
|
|
1918
1920
|
throw new Error(`Tile index is outside of tile range: ${c} >= ${u}`);
|
|
1919
1921
|
const { offset: h, imageSize: p } = await e.getTileSize(c);
|
|
1920
|
-
return
|
|
1922
|
+
return st(e, h, p, r, o);
|
|
1921
1923
|
}
|
|
1922
|
-
async function
|
|
1924
|
+
async function st(e, t, n, r, o) {
|
|
1923
1925
|
if (n === 0)
|
|
1924
1926
|
return null;
|
|
1925
1927
|
o?.debug !== void 0 && console.log(`[geotiff dataSource] ${o.debug.label}: offset=${t} length=${n}`);
|
|
@@ -1932,7 +1934,7 @@ async function ot(e, t, n, r, o) {
|
|
|
1932
1934
|
compression: a
|
|
1933
1935
|
} : { bytes: i, compression: a };
|
|
1934
1936
|
}
|
|
1935
|
-
async function
|
|
1937
|
+
async function lt(e, t, n, r) {
|
|
1936
1938
|
if (t.length === 0)
|
|
1937
1939
|
return [];
|
|
1938
1940
|
const o = new Array(t.length), i = [], a = [];
|
|
@@ -1945,7 +1947,7 @@ async function it(e, t, n, r) {
|
|
|
1945
1947
|
if (r?.debug !== void 0)
|
|
1946
1948
|
for (const c of i)
|
|
1947
1949
|
console.log(`[geotiff dataSource] ${r.debug.label}: offset=${c.offset} length=${c.length}`);
|
|
1948
|
-
const s = await
|
|
1950
|
+
const s = await ir(n, i, {
|
|
1949
1951
|
coalesce: r?.coalesce,
|
|
1950
1952
|
maxRangeSize: r?.maxRangeSize,
|
|
1951
1953
|
signal: r?.signal
|
|
@@ -1956,7 +1958,7 @@ async function it(e, t, n, r) {
|
|
|
1956
1958
|
}
|
|
1957
1959
|
return o;
|
|
1958
1960
|
}
|
|
1959
|
-
async function
|
|
1961
|
+
async function ct(e, t, n, r) {
|
|
1960
1962
|
if (t.length === 0)
|
|
1961
1963
|
return [];
|
|
1962
1964
|
const { size: o, tileSize: i } = e;
|
|
@@ -1970,9 +1972,9 @@ async function at(e, t, n, r) {
|
|
|
1970
1972
|
throw new Error(`Tile index is outside of tile range: ${g} >= ${l}`);
|
|
1971
1973
|
return g;
|
|
1972
1974
|
}), u = await Promise.all(c.map((h) => e.getTileSize(h)));
|
|
1973
|
-
return
|
|
1975
|
+
return lt(e, u.map((h) => ({ offset: h.offset, byteCount: h.imageSize })), n, r);
|
|
1974
1976
|
}
|
|
1975
|
-
function
|
|
1977
|
+
function mr(e, t, n, r) {
|
|
1976
1978
|
const { width: o, height: i } = e.image.getTileBounds(t, n);
|
|
1977
1979
|
if (o === e.tileWidth && i === e.tileHeight)
|
|
1978
1980
|
return r;
|
|
@@ -2002,7 +2004,7 @@ function T(e, t, n, r, o) {
|
|
|
2002
2004
|
s.set(e.subarray(l * i, l * i + a), l * a);
|
|
2003
2005
|
return s;
|
|
2004
2006
|
}
|
|
2005
|
-
function
|
|
2007
|
+
function ut(e, t) {
|
|
2006
2008
|
const n = new Set(e), r = new Set(t);
|
|
2007
2009
|
if (n.size > 1)
|
|
2008
2010
|
throw new Error("Multiple sample formats are not supported.");
|
|
@@ -2016,7 +2018,7 @@ function st(e, t) {
|
|
|
2016
2018
|
bitsPerSample: i
|
|
2017
2019
|
};
|
|
2018
2020
|
}
|
|
2019
|
-
function
|
|
2021
|
+
function fr(e, { count: t }) {
|
|
2020
2022
|
if (e == null)
|
|
2021
2023
|
return null;
|
|
2022
2024
|
const o = new DOMParser().parseFromString(e, "text/xml").documentElement;
|
|
@@ -2061,11 +2063,11 @@ function ur(e, { count: t }) {
|
|
|
2061
2063
|
}
|
|
2062
2064
|
return { bandStatistics: i, offsets: a, scales: s };
|
|
2063
2065
|
}
|
|
2064
|
-
async function
|
|
2066
|
+
async function yr(e, t = {}) {
|
|
2065
2067
|
const { signal: n } = t, r = e.value(d.Compression);
|
|
2066
2068
|
if (r === null)
|
|
2067
2069
|
throw new Error("Compression tag should always exist.");
|
|
2068
|
-
const [o, i, a, s, l, c, u, h, p, g, y,
|
|
2070
|
+
const [o, i, a, s, l, c, u, h, p, g, y, w, b] = await Promise.all([
|
|
2069
2071
|
e.fetch(d.BitsPerSample, { signal: n }),
|
|
2070
2072
|
e.fetch(d.ColorMap, { signal: n }),
|
|
2071
2073
|
e.fetch(d.GdalNoData, { signal: n }),
|
|
@@ -2079,10 +2081,10 @@ async function dr(e, t = {}) {
|
|
|
2079
2081
|
e.fetch(d.Predictor, { signal: n }),
|
|
2080
2082
|
e.fetch(d.SampleFormat, { signal: n }),
|
|
2081
2083
|
e.fetch(d.SamplesPerPixel, { signal: n })
|
|
2082
|
-
]),
|
|
2083
|
-
throw new Error(`${
|
|
2084
|
+
]), E = (L) => {
|
|
2085
|
+
throw new Error(`${L} tag should always exist.`);
|
|
2084
2086
|
};
|
|
2085
|
-
return o === null &&
|
|
2087
|
+
return o === null && E("BitsPerSample"), b === null && E("SamplesPerPixel"), p === null && E("Photometric"), {
|
|
2086
2088
|
bitsPerSample: new Uint16Array(o),
|
|
2087
2089
|
colorMap: i ? new Uint16Array(i) : void 0,
|
|
2088
2090
|
compression: r,
|
|
@@ -2095,15 +2097,15 @@ async function dr(e, t = {}) {
|
|
|
2095
2097
|
photometric: p,
|
|
2096
2098
|
// PlanarConfiguration defaults to interleaved/chunky/contig
|
|
2097
2099
|
// https://web.archive.org/web/20240329145253/https://www.awaresystems.be/imaging/tiff/tifftags/planarconfiguration.html
|
|
2098
|
-
planarConfiguration: g ??
|
|
2100
|
+
planarConfiguration: g ?? M.Contig,
|
|
2099
2101
|
predictor: y ?? _.None,
|
|
2100
2102
|
// Uint is the default sample format according to the spec
|
|
2101
2103
|
// https://web.archive.org/web/20240329145340/https://www.awaresystems.be/imaging/tiff/tifftags/sampleformat.html
|
|
2102
|
-
sampleFormat:
|
|
2104
|
+
sampleFormat: w ?? [A.Uint],
|
|
2103
2105
|
samplesPerPixel: b
|
|
2104
2106
|
};
|
|
2105
2107
|
}
|
|
2106
|
-
function
|
|
2108
|
+
function wr(e) {
|
|
2107
2109
|
const t = (n) => e.valueGeo(n) ?? null;
|
|
2108
2110
|
return {
|
|
2109
2111
|
// Configuration keys
|
|
@@ -2159,29 +2161,29 @@ function hr(e) {
|
|
|
2159
2161
|
verticalUnits: t(m.VerticalUnitsGeoKey)
|
|
2160
2162
|
};
|
|
2161
2163
|
}
|
|
2162
|
-
function
|
|
2164
|
+
function Sr({ modelTiepoint: e, modelPixelScale: t, modelTransformation: n, rasterType: r }) {
|
|
2163
2165
|
let o;
|
|
2164
2166
|
if (e && t)
|
|
2165
|
-
o =
|
|
2167
|
+
o = Pr(e, t);
|
|
2166
2168
|
else if (n)
|
|
2167
|
-
o =
|
|
2169
|
+
o = br(n);
|
|
2168
2170
|
else
|
|
2169
2171
|
throw new Error("The image does not have an affine transformation.");
|
|
2170
|
-
return r === te.PixelIsPoint && (o = se(o,
|
|
2172
|
+
return r === te.PixelIsPoint && (o = se(o, $e(-0.5, -0.5))), o;
|
|
2171
2173
|
}
|
|
2172
|
-
function
|
|
2174
|
+
function Pr(e, t) {
|
|
2173
2175
|
const n = e[3], r = e[4], o = t[0], i = -t[1];
|
|
2174
2176
|
return [o, 0, n, 0, i, r];
|
|
2175
2177
|
}
|
|
2176
|
-
function
|
|
2178
|
+
function br(e) {
|
|
2177
2179
|
const t = e[3], n = e[7], r = e[1], o = e[4], i = e[0], a = e[5];
|
|
2178
2180
|
return [i, r, t, o, a, n];
|
|
2179
2181
|
}
|
|
2180
|
-
function
|
|
2181
|
-
const o =
|
|
2182
|
+
function dt(e, t, n, r = Math.floor) {
|
|
2183
|
+
const o = Ct(e.transform), [i, a] = ke(o, t, n);
|
|
2182
2184
|
return [r(a), r(i)];
|
|
2183
2185
|
}
|
|
2184
|
-
function
|
|
2186
|
+
function ht(e, t, n, r = "center") {
|
|
2185
2187
|
let o, i;
|
|
2186
2188
|
switch (r) {
|
|
2187
2189
|
case "center":
|
|
@@ -2200,9 +2202,9 @@ function ct(e, t, n, r = "center") {
|
|
|
2200
2202
|
o = n + 1, i = t + 1;
|
|
2201
2203
|
break;
|
|
2202
2204
|
}
|
|
2203
|
-
return
|
|
2205
|
+
return ke(e.transform, o, i);
|
|
2204
2206
|
}
|
|
2205
|
-
class
|
|
2207
|
+
class Cr {
|
|
2206
2208
|
cachedTags;
|
|
2207
2209
|
/** The data source used for fetching tile data. */
|
|
2208
2210
|
dataSource;
|
|
@@ -2257,7 +2259,7 @@ class fr {
|
|
|
2257
2259
|
*/
|
|
2258
2260
|
get transform() {
|
|
2259
2261
|
const t = this.geotiff.transform, n = this.geotiff.width / this.width, r = this.geotiff.height / this.height;
|
|
2260
|
-
return se(t,
|
|
2262
|
+
return se(t, Lt(n, r));
|
|
2261
2263
|
}
|
|
2262
2264
|
/** Image width in pixels. */
|
|
2263
2265
|
get width() {
|
|
@@ -2273,7 +2275,7 @@ class fr {
|
|
|
2273
2275
|
* @param options.signal An optional {@link AbortSignal} to cancel the fetch request.
|
|
2274
2276
|
*/
|
|
2275
2277
|
async fetchTile(t, n, r = {}) {
|
|
2276
|
-
return await
|
|
2278
|
+
return await nt(this, t, n, r);
|
|
2277
2279
|
}
|
|
2278
2280
|
/**
|
|
2279
2281
|
* Fetch multiple tiles in parallel.
|
|
@@ -2288,7 +2290,7 @@ class fr {
|
|
|
2288
2290
|
* @see {@link fetchTile} for single-tile fetching.
|
|
2289
2291
|
*/
|
|
2290
2292
|
async fetchTiles(t, n = {}) {
|
|
2291
|
-
return await
|
|
2293
|
+
return await ot(this, t, n);
|
|
2292
2294
|
}
|
|
2293
2295
|
// TiledMixin
|
|
2294
2296
|
// Transform mixin
|
|
@@ -2302,7 +2304,7 @@ class fr {
|
|
|
2302
2304
|
* @returns [row, col] pixel indices.
|
|
2303
2305
|
*/
|
|
2304
2306
|
index(t, n, r = Math.floor) {
|
|
2305
|
-
return
|
|
2307
|
+
return dt(this, t, n, r);
|
|
2306
2308
|
}
|
|
2307
2309
|
/**
|
|
2308
2310
|
* Get the geographic (x, y) coordinate of the pixel at (row, col).
|
|
@@ -2313,10 +2315,10 @@ class fr {
|
|
|
2313
2315
|
* @returns [x, y] in the CRS.
|
|
2314
2316
|
*/
|
|
2315
2317
|
xy(t, n, r = "center") {
|
|
2316
|
-
return
|
|
2318
|
+
return ht(this, t, n, r);
|
|
2317
2319
|
}
|
|
2318
2320
|
}
|
|
2319
|
-
class
|
|
2321
|
+
class K {
|
|
2320
2322
|
/**
|
|
2321
2323
|
* Reduced-resolution overview levels, sorted finest-to-coarsest.
|
|
2322
2324
|
*
|
|
@@ -2370,7 +2372,7 @@ class x {
|
|
|
2370
2372
|
*/
|
|
2371
2373
|
static async open(t) {
|
|
2372
2374
|
const { dataSource: n, headerSource: r, signal: o, debug: i } = t, a = await new B(r).init({ signal: o });
|
|
2373
|
-
return a.options = void 0,
|
|
2375
|
+
return a.options = void 0, K.fromTiff(a, n, { signal: o, debug: i });
|
|
2374
2376
|
}
|
|
2375
2377
|
/**
|
|
2376
2378
|
* Create a GeoTIFF from an already-initialised Tiff instance.
|
|
@@ -2386,24 +2388,24 @@ class x {
|
|
|
2386
2388
|
const { signal: o, debug: i = !1 } = r, a = t.images;
|
|
2387
2389
|
if (a.length === 0)
|
|
2388
2390
|
throw new Error("TIFF does not contain any IFDs");
|
|
2389
|
-
await Promise.all(a.map((
|
|
2390
|
-
const s = a[0], l =
|
|
2391
|
-
for (let
|
|
2392
|
-
const
|
|
2393
|
-
|
|
2391
|
+
await Promise.all(a.map((L) => L.init(!0, { signal: o })));
|
|
2392
|
+
const s = a[0], l = wr(s), c = /* @__PURE__ */ new Map(), u = /* @__PURE__ */ new Map();
|
|
2393
|
+
for (let L = 1; L < a.length; L++) {
|
|
2394
|
+
const C = a[L], I = C.size, G = `${I.width},${I.height}`;
|
|
2395
|
+
Lr(C) ? u.set(G, C) : c.set(G, C);
|
|
2394
2396
|
}
|
|
2395
2397
|
const h = `${s.size.width},${s.size.height}`, p = u.get(h) ?? null, g = Array.from(c.entries());
|
|
2396
|
-
g.sort((
|
|
2397
|
-
const
|
|
2398
|
-
return G.width * G.height -
|
|
2398
|
+
g.sort((L, C) => {
|
|
2399
|
+
const I = L[1].size, G = C[1].size;
|
|
2400
|
+
return G.width * G.height - I.width * I.height;
|
|
2399
2401
|
});
|
|
2400
|
-
const y = await
|
|
2402
|
+
const y = await yr(s, { signal: o }), w = fr(y.gdalMetadata, {
|
|
2401
2403
|
count: y.samplesPerPixel
|
|
2402
|
-
}), b = new
|
|
2403
|
-
const
|
|
2404
|
-
return new
|
|
2404
|
+
}), b = new K(t, s, p, l, [], y, n, w, i), E = g.map(([L, C]) => {
|
|
2405
|
+
const I = u.get(L) ?? null;
|
|
2406
|
+
return new Cr(b, l, C, I, y, n);
|
|
2405
2407
|
});
|
|
2406
|
-
return b.overviews =
|
|
2408
|
+
return b.overviews = E, b;
|
|
2407
2409
|
}
|
|
2408
2410
|
/**
|
|
2409
2411
|
* Create a GeoTIFF from an ArrayBuffer containing the entire file.
|
|
@@ -2417,8 +2419,8 @@ class x {
|
|
|
2417
2419
|
* @returns A Promise that resolves to a GeoTIFF instance.
|
|
2418
2420
|
*/
|
|
2419
2421
|
static async fromArrayBuffer(t) {
|
|
2420
|
-
const n = new
|
|
2421
|
-
return await
|
|
2422
|
+
const n = new de("memory://input.tif", t);
|
|
2423
|
+
return await K.open({
|
|
2422
2424
|
dataSource: n,
|
|
2423
2425
|
headerSource: n
|
|
2424
2426
|
});
|
|
@@ -2443,11 +2445,11 @@ class x {
|
|
|
2443
2445
|
static async fromUrl(t, { chunkSize: n = 64 * 1024, cacheSize: r = 8 * 1024 * 1024, signal: o, debug: i } = {}) {
|
|
2444
2446
|
const a = new $(t, {});
|
|
2445
2447
|
a.metadata = { size: Number.POSITIVE_INFINITY };
|
|
2446
|
-
const s = new
|
|
2447
|
-
new
|
|
2448
|
-
new
|
|
2448
|
+
const s = new mn(a, [
|
|
2449
|
+
new yn({ size: n }),
|
|
2450
|
+
new gn({ size: r })
|
|
2449
2451
|
]);
|
|
2450
|
-
return await
|
|
2452
|
+
return await K.open({
|
|
2451
2453
|
// Tile data reads bypass the header cache (raw source).
|
|
2452
2454
|
dataSource: a,
|
|
2453
2455
|
headerSource: s,
|
|
@@ -2465,7 +2467,7 @@ class x {
|
|
|
2465
2467
|
* See also {@link GeoTIFF.epsg} for the EPSG code directly from the TIFF tags.
|
|
2466
2468
|
*/
|
|
2467
2469
|
get crs() {
|
|
2468
|
-
return this._crs === void 0 && (this._crs =
|
|
2470
|
+
return this._crs === void 0 && (this._crs = Xn(this.gkd)), this._crs;
|
|
2469
2471
|
}
|
|
2470
2472
|
/** Image width in pixels. */
|
|
2471
2473
|
get width() {
|
|
@@ -2536,7 +2538,7 @@ class x {
|
|
|
2536
2538
|
*/
|
|
2537
2539
|
get transform() {
|
|
2538
2540
|
const { modelPixelScale: t, modelTiepoint: n, modelTransformation: r } = this.cachedTags;
|
|
2539
|
-
return
|
|
2541
|
+
return Sr({
|
|
2540
2542
|
modelTiepoint: n,
|
|
2541
2543
|
modelPixelScale: t,
|
|
2542
2544
|
modelTransformation: r,
|
|
@@ -2554,7 +2556,7 @@ class x {
|
|
|
2554
2556
|
* @param options.signal An optional {@link AbortSignal} to cancel the fetch request.
|
|
2555
2557
|
*/
|
|
2556
2558
|
async fetchTile(t, n, r = {}) {
|
|
2557
|
-
return await
|
|
2559
|
+
return await nt(this, t, n, r);
|
|
2558
2560
|
}
|
|
2559
2561
|
/**
|
|
2560
2562
|
* Fetch multiple tiles in parallel.
|
|
@@ -2569,7 +2571,7 @@ class x {
|
|
|
2569
2571
|
* @see {@link fetchTile} for single-tile fetching.
|
|
2570
2572
|
*/
|
|
2571
2573
|
async fetchTiles(t, n = {}) {
|
|
2572
|
-
return await
|
|
2574
|
+
return await ot(this, t, n);
|
|
2573
2575
|
}
|
|
2574
2576
|
// Transform mixin
|
|
2575
2577
|
/**
|
|
@@ -2582,7 +2584,7 @@ class x {
|
|
|
2582
2584
|
* @returns [row, col] pixel indices.
|
|
2583
2585
|
*/
|
|
2584
2586
|
index(t, n, r = Math.floor) {
|
|
2585
|
-
return
|
|
2587
|
+
return dt(this, t, n, r);
|
|
2586
2588
|
}
|
|
2587
2589
|
/**
|
|
2588
2590
|
* Get the geographic (x, y) coordinate of the pixel at (row, col).
|
|
@@ -2593,14 +2595,14 @@ class x {
|
|
|
2593
2595
|
* @returns [x, y] in the CRS.
|
|
2594
2596
|
*/
|
|
2595
2597
|
xy(t, n, r = "center") {
|
|
2596
|
-
return
|
|
2598
|
+
return ht(this, t, n, r);
|
|
2597
2599
|
}
|
|
2598
2600
|
}
|
|
2599
|
-
function
|
|
2601
|
+
function Lr(e) {
|
|
2600
2602
|
const t = e.value(d.SubFileType), n = e.value(d.Photometric);
|
|
2601
2603
|
return t !== null && (t & J.Mask) !== 0 && n === F.Mask;
|
|
2602
2604
|
}
|
|
2603
|
-
let
|
|
2605
|
+
let Ir = class {
|
|
2604
2606
|
worker;
|
|
2605
2607
|
jobIdCounter = 0;
|
|
2606
2608
|
jobs = /* @__PURE__ */ new Map();
|
|
@@ -2624,14 +2626,14 @@ let wr = class {
|
|
|
2624
2626
|
this.worker.terminate();
|
|
2625
2627
|
}
|
|
2626
2628
|
};
|
|
2627
|
-
const
|
|
2629
|
+
const Gr = typeof navigator < "u" ? navigator.hardwareConcurrency ?? 2 : 2;
|
|
2628
2630
|
class oe {
|
|
2629
2631
|
workerWrappers;
|
|
2630
2632
|
constructor(t = {}) {
|
|
2631
|
-
const { size: n =
|
|
2633
|
+
const { size: n = Gr, createWorker: r } = t;
|
|
2632
2634
|
if (this.workerWrappers = [], r && n > 0)
|
|
2633
2635
|
for (let o = 0; o < n; o++)
|
|
2634
|
-
this.workerWrappers.push(new
|
|
2636
|
+
this.workerWrappers.push(new Ir(r()));
|
|
2635
2637
|
}
|
|
2636
2638
|
/** True when workers are available for off-main-thread decoding. */
|
|
2637
2639
|
get hasWorkers() {
|
|
@@ -2649,7 +2651,7 @@ class oe {
|
|
|
2649
2651
|
*/
|
|
2650
2652
|
async decode(t, n, r) {
|
|
2651
2653
|
if (!this.hasWorkers)
|
|
2652
|
-
return
|
|
2654
|
+
return ue(t, n, r);
|
|
2653
2655
|
const o = this.leastLoaded(), i = {
|
|
2654
2656
|
compression: n,
|
|
2655
2657
|
metadata: r,
|
|
@@ -2670,17 +2672,17 @@ class oe {
|
|
|
2670
2672
|
return t;
|
|
2671
2673
|
}
|
|
2672
2674
|
}
|
|
2673
|
-
let
|
|
2674
|
-
function
|
|
2675
|
-
return
|
|
2675
|
+
let Y = null;
|
|
2676
|
+
function vr() {
|
|
2677
|
+
return Y !== null || (Y = new oe({
|
|
2676
2678
|
createWorker: () => new Worker(new URL(
|
|
2677
2679
|
/* @vite-ignore */
|
|
2678
2680
|
"" + new URL("assets/worker-DtIrTJB7.js", import.meta.url).href,
|
|
2679
2681
|
import.meta.url
|
|
2680
2682
|
), { type: "module" })
|
|
2681
|
-
})),
|
|
2683
|
+
})), Y;
|
|
2682
2684
|
}
|
|
2683
|
-
function
|
|
2685
|
+
function Er(e) {
|
|
2684
2686
|
const { height: t, width: n } = e;
|
|
2685
2687
|
if (e.layout === "band-separate")
|
|
2686
2688
|
throw new Error("Band-separate images not yet implemented.");
|
|
@@ -2698,10 +2700,10 @@ function br(e) {
|
|
|
2698
2700
|
} else
|
|
2699
2701
|
throw new Error(`Unexpected number of channels in raster data: ${e.data.length / (t * n)}`);
|
|
2700
2702
|
}
|
|
2701
|
-
async function
|
|
2702
|
-
return typeof e == "string" || e instanceof URL ? await
|
|
2703
|
+
async function Fr(e) {
|
|
2704
|
+
return typeof e == "string" || e instanceof URL ? await K.fromUrl(e) : e instanceof ArrayBuffer ? await K.fromArrayBuffer(e) : e;
|
|
2703
2705
|
}
|
|
2704
|
-
function
|
|
2706
|
+
function Ar(e, t) {
|
|
2705
2707
|
const [n, r, o, i] = e.bbox, a = [
|
|
2706
2708
|
t.forward([n, r]),
|
|
2707
2709
|
// bottom-left
|
|
@@ -2714,17 +2716,17 @@ function Lr(e, t) {
|
|
|
2714
2716
|
], 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
2717
|
return { west: c, south: u, east: h, north: p };
|
|
2716
2718
|
}
|
|
2717
|
-
const
|
|
2719
|
+
const jr = (
|
|
2718
2720
|
/* glsl */
|
|
2719
2721
|
`
|
|
2720
2722
|
vec3 black_zero_to_rgb(float value) {
|
|
2721
2723
|
return vec3(value, value, value);
|
|
2722
2724
|
}
|
|
2723
2725
|
`
|
|
2724
|
-
),
|
|
2726
|
+
), Rr = {
|
|
2725
2727
|
name: "black-is-zero",
|
|
2726
2728
|
inject: {
|
|
2727
|
-
"fs:#decl":
|
|
2729
|
+
"fs:#decl": jr,
|
|
2728
2730
|
"fs:DECKGL_FILTER_COLOR": (
|
|
2729
2731
|
/* glsl */
|
|
2730
2732
|
`
|
|
@@ -2732,7 +2734,7 @@ const Ir = (
|
|
|
2732
2734
|
`
|
|
2733
2735
|
)
|
|
2734
2736
|
}
|
|
2735
|
-
},
|
|
2737
|
+
}, Mr = (
|
|
2736
2738
|
/* glsl */
|
|
2737
2739
|
`
|
|
2738
2740
|
const vec3 D65 = vec3(
|
|
@@ -2777,10 +2779,10 @@ const Ir = (
|
|
|
2777
2779
|
return clamp(rgb, 0.0, 1.0);
|
|
2778
2780
|
}
|
|
2779
2781
|
`
|
|
2780
|
-
),
|
|
2782
|
+
), Ur = {
|
|
2781
2783
|
name: "cielab-to-rgb",
|
|
2782
2784
|
inject: {
|
|
2783
|
-
"fs:#decl":
|
|
2785
|
+
"fs:#decl": Mr,
|
|
2784
2786
|
"fs:DECKGL_FILTER_COLOR": (
|
|
2785
2787
|
/* glsl */
|
|
2786
2788
|
`
|
|
@@ -2788,7 +2790,7 @@ const Ir = (
|
|
|
2788
2790
|
`
|
|
2789
2791
|
)
|
|
2790
2792
|
}
|
|
2791
|
-
},
|
|
2793
|
+
}, Or = (
|
|
2792
2794
|
/* glsl */
|
|
2793
2795
|
`
|
|
2794
2796
|
vec3 cmykToRgb(vec4 cmyk) {
|
|
@@ -2802,10 +2804,10 @@ const Ir = (
|
|
|
2802
2804
|
);
|
|
2803
2805
|
}
|
|
2804
2806
|
`
|
|
2805
|
-
),
|
|
2807
|
+
), xr = {
|
|
2806
2808
|
name: "cmyk-to-rgb",
|
|
2807
2809
|
inject: {
|
|
2808
|
-
"fs:#decl":
|
|
2810
|
+
"fs:#decl": Or,
|
|
2809
2811
|
"fs:DECKGL_FILTER_COLOR": (
|
|
2810
2812
|
/* glsl */
|
|
2811
2813
|
`
|
|
@@ -2813,17 +2815,17 @@ const Ir = (
|
|
|
2813
2815
|
`
|
|
2814
2816
|
)
|
|
2815
2817
|
}
|
|
2816
|
-
},
|
|
2818
|
+
}, Kr = (
|
|
2817
2819
|
/* glsl */
|
|
2818
2820
|
`
|
|
2819
2821
|
vec3 white_zero_to_rgb(float value) {
|
|
2820
2822
|
return vec3(1.0 - value, 1.0 - value, 1.0 - value);
|
|
2821
2823
|
}
|
|
2822
2824
|
`
|
|
2823
|
-
),
|
|
2825
|
+
), Dr = {
|
|
2824
2826
|
name: "white-is-zero",
|
|
2825
2827
|
inject: {
|
|
2826
|
-
"fs:#decl":
|
|
2828
|
+
"fs:#decl": Kr,
|
|
2827
2829
|
"fs:DECKGL_FILTER_COLOR": (
|
|
2828
2830
|
/* glsl */
|
|
2829
2831
|
`
|
|
@@ -2831,7 +2833,7 @@ const Ir = (
|
|
|
2831
2833
|
`
|
|
2832
2834
|
)
|
|
2833
2835
|
}
|
|
2834
|
-
},
|
|
2836
|
+
}, Nr = {
|
|
2835
2837
|
name: "mask-texture",
|
|
2836
2838
|
inject: {
|
|
2837
2839
|
"fs:#decl": "uniform sampler2D maskTexture;",
|
|
@@ -2849,18 +2851,18 @@ const Ir = (
|
|
|
2849
2851
|
maskTexture: e.maskTexture
|
|
2850
2852
|
})
|
|
2851
2853
|
};
|
|
2852
|
-
function
|
|
2853
|
-
const r =
|
|
2854
|
+
function zr(e, t, n) {
|
|
2855
|
+
const r = Br(e), o = _r(t), i = $r(n), a = `${r}:${i}:${o}`, s = kr[a];
|
|
2854
2856
|
if (!s)
|
|
2855
2857
|
throw new Error(`Unsupported texture format for SamplesPerPixel=${e}, BitsPerSample=${t}, SampleFormat=${n}`);
|
|
2856
2858
|
return s;
|
|
2857
2859
|
}
|
|
2858
|
-
function
|
|
2860
|
+
function Br(e) {
|
|
2859
2861
|
if (e === 1 || e === 2 || e === 3 || e === 4)
|
|
2860
2862
|
return e;
|
|
2861
2863
|
throw new Error(`Unsupported SamplesPerPixel ${e}. Only 1, 2, 3, or 4 are supported.`);
|
|
2862
2864
|
}
|
|
2863
|
-
function
|
|
2865
|
+
function _r(e) {
|
|
2864
2866
|
const t = e[0];
|
|
2865
2867
|
for (let n = 1; n < e.length; n++)
|
|
2866
2868
|
if (e[n] !== t)
|
|
@@ -2869,7 +2871,7 @@ function Kr(e) {
|
|
|
2869
2871
|
throw new Error(`Unsupported BitsPerSample ${t}. Only 8, 16, or 32 are supported.`);
|
|
2870
2872
|
return t;
|
|
2871
2873
|
}
|
|
2872
|
-
function
|
|
2874
|
+
function $r(e) {
|
|
2873
2875
|
const t = e[0];
|
|
2874
2876
|
for (let n = 1; n < e.length; n++)
|
|
2875
2877
|
if (e[n] !== t)
|
|
@@ -2885,7 +2887,7 @@ function xr(e) {
|
|
|
2885
2887
|
throw new Error(`Unsupported SampleFormat ${e}`);
|
|
2886
2888
|
}
|
|
2887
2889
|
}
|
|
2888
|
-
const
|
|
2890
|
+
const kr = {
|
|
2889
2891
|
// 1 byte per pixel
|
|
2890
2892
|
"1:sint:8": "r8sint",
|
|
2891
2893
|
"1:uint:8": "r8uint",
|
|
@@ -2932,21 +2934,21 @@ const Dr = {
|
|
|
2932
2934
|
"4:sint:32": "rgba32sint",
|
|
2933
2935
|
"4:uint:32": "rgba32uint"
|
|
2934
2936
|
};
|
|
2935
|
-
function
|
|
2937
|
+
function Wr(e, t) {
|
|
2936
2938
|
const { sampleFormat: n } = e.cachedTags;
|
|
2937
2939
|
if (n === null)
|
|
2938
2940
|
throw new Error("SampleFormat tag is required to infer render pipeline");
|
|
2939
2941
|
switch (n[0]) {
|
|
2940
2942
|
// Unsigned integers
|
|
2941
2943
|
case A.Uint:
|
|
2942
|
-
return
|
|
2944
|
+
return Jr(e, t);
|
|
2943
2945
|
}
|
|
2944
2946
|
throw new Error(`Inferring render pipeline for non-unsigned integers not yet supported. Found SampleFormat: ${n}`);
|
|
2945
2947
|
}
|
|
2946
|
-
function
|
|
2948
|
+
function Jr(e, t) {
|
|
2947
2949
|
const { bitsPerSample: n, colorMap: r, photometric: o, sampleFormat: i, samplesPerPixel: a, nodata: s } = e.cachedTags, l = [
|
|
2948
2950
|
{
|
|
2949
|
-
module:
|
|
2951
|
+
module: Gt,
|
|
2950
2952
|
props: {
|
|
2951
2953
|
textureName: (g) => g.texture
|
|
2952
2954
|
}
|
|
@@ -2955,18 +2957,18 @@ function zr(e, t) {
|
|
|
2955
2957
|
if (s !== null) {
|
|
2956
2958
|
const g = 2 ** n[0] - 1, y = s / g;
|
|
2957
2959
|
l.push({
|
|
2958
|
-
module:
|
|
2960
|
+
module: vt,
|
|
2959
2961
|
props: { value: y }
|
|
2960
2962
|
});
|
|
2961
2963
|
}
|
|
2962
2964
|
e.maskImage !== null && l.push({
|
|
2963
|
-
module:
|
|
2965
|
+
module: Nr,
|
|
2964
2966
|
props: {
|
|
2965
2967
|
// TODO: how to handle if mask failed to load and is undefined here
|
|
2966
2968
|
maskTexture: (g) => g.mask
|
|
2967
2969
|
}
|
|
2968
2970
|
});
|
|
2969
|
-
const c =
|
|
2971
|
+
const c = Hr({
|
|
2970
2972
|
count: a,
|
|
2971
2973
|
photometric: o,
|
|
2972
2974
|
device: t,
|
|
@@ -2981,71 +2983,71 @@ function zr(e, t) {
|
|
|
2981
2983
|
minFilter: "linear"
|
|
2982
2984
|
};
|
|
2983
2985
|
return { getTileData: async (g, y) => {
|
|
2984
|
-
const { device:
|
|
2986
|
+
const { device: w, x: b, y: E, signal: L, pool: C } = y, I = await g.fetchTile(b, E, {
|
|
2985
2987
|
boundless: !1,
|
|
2986
|
-
pool:
|
|
2987
|
-
signal:
|
|
2988
|
+
pool: C,
|
|
2989
|
+
signal: L
|
|
2988
2990
|
});
|
|
2989
|
-
let { array: G } =
|
|
2990
|
-
const { width:
|
|
2991
|
-
let
|
|
2992
|
-
if (a === 3 && (G =
|
|
2991
|
+
let { array: G } = I;
|
|
2992
|
+
const { width: he, height: pe, mask: q } = G;
|
|
2993
|
+
let ge = a;
|
|
2994
|
+
if (a === 3 && (G = Er(G), ge = 4), G.layout === "band-separate")
|
|
2993
2995
|
throw new Error("Band-separate images not yet implemented.");
|
|
2994
|
-
const
|
|
2996
|
+
const Pt = zr(
|
|
2995
2997
|
// Add one sample for added alpha channel
|
|
2996
|
-
|
|
2998
|
+
ge,
|
|
2997
2999
|
n,
|
|
2998
3000
|
i
|
|
2999
3001
|
);
|
|
3000
3002
|
let me = G.data.byteLength;
|
|
3001
|
-
const
|
|
3003
|
+
const bt = w.createTexture({
|
|
3002
3004
|
data: G.data,
|
|
3003
|
-
format:
|
|
3004
|
-
width:
|
|
3005
|
-
height:
|
|
3005
|
+
format: Pt,
|
|
3006
|
+
width: he,
|
|
3007
|
+
height: pe,
|
|
3006
3008
|
sampler: u
|
|
3007
3009
|
});
|
|
3008
|
-
let
|
|
3009
|
-
return q !== null && (
|
|
3010
|
+
let fe;
|
|
3011
|
+
return q !== null && (fe = w.createTexture({
|
|
3010
3012
|
data: q,
|
|
3011
3013
|
// Single-channel 8-bit texture for the mask
|
|
3012
3014
|
format: "r8unorm",
|
|
3013
|
-
width:
|
|
3014
|
-
height:
|
|
3015
|
+
width: he,
|
|
3016
|
+
height: pe,
|
|
3015
3017
|
// Use nearest filtering for the mask to avoid interpolated edges/halos
|
|
3016
3018
|
sampler: {
|
|
3017
3019
|
minFilter: "nearest",
|
|
3018
3020
|
magFilter: "nearest"
|
|
3019
3021
|
}
|
|
3020
3022
|
}), me += q.byteLength), {
|
|
3021
|
-
texture:
|
|
3022
|
-
mask:
|
|
3023
|
+
texture: bt,
|
|
3024
|
+
mask: fe,
|
|
3023
3025
|
byteLength: me,
|
|
3024
3026
|
height: G.height,
|
|
3025
3027
|
width: G.width
|
|
3026
3028
|
};
|
|
3027
3029
|
}, renderTile: (g) => ({
|
|
3028
|
-
renderPipeline: l.map((y,
|
|
3030
|
+
renderPipeline: l.map((y, w) => Vr(y, g))
|
|
3029
3031
|
}) };
|
|
3030
3032
|
}
|
|
3031
|
-
function
|
|
3033
|
+
function Hr({ count: e, colorMap: t, device: n, photometric: r }) {
|
|
3032
3034
|
if (e === 3 || e === 4)
|
|
3033
3035
|
return null;
|
|
3034
3036
|
switch (r) {
|
|
3035
3037
|
case F.MinIsWhite:
|
|
3036
3038
|
return {
|
|
3037
|
-
module:
|
|
3039
|
+
module: Dr
|
|
3038
3040
|
};
|
|
3039
3041
|
case F.MinIsBlack:
|
|
3040
3042
|
return {
|
|
3041
|
-
module:
|
|
3043
|
+
module: Rr
|
|
3042
3044
|
};
|
|
3043
3045
|
case F.Rgb:
|
|
3044
3046
|
return null;
|
|
3045
3047
|
case F.Palette: {
|
|
3046
3048
|
if (!t)
|
|
3047
3049
|
throw new Error("ColorMap is required for PhotometricInterpretation Palette");
|
|
3048
|
-
const { data: o, width: i, height: a } =
|
|
3050
|
+
const { data: o, width: i, height: a } = kt(t), s = n.createTexture({
|
|
3049
3051
|
dimension: "2d-array",
|
|
3050
3052
|
data: o,
|
|
3051
3053
|
format: "rgba8unorm",
|
|
@@ -3062,7 +3064,7 @@ function Br({ count: e, colorMap: t, device: n, photometric: r }) {
|
|
|
3062
3064
|
}
|
|
3063
3065
|
});
|
|
3064
3066
|
return {
|
|
3065
|
-
module:
|
|
3067
|
+
module: It,
|
|
3066
3068
|
props: {
|
|
3067
3069
|
colormapTexture: s
|
|
3068
3070
|
}
|
|
@@ -3071,19 +3073,19 @@ function Br({ count: e, colorMap: t, device: n, photometric: r }) {
|
|
|
3071
3073
|
// Not sure why cogeotiff calls this "Separated", but it means CMYK
|
|
3072
3074
|
case F.Separated:
|
|
3073
3075
|
return {
|
|
3074
|
-
module:
|
|
3076
|
+
module: xr
|
|
3075
3077
|
};
|
|
3076
3078
|
case F.Ycbcr:
|
|
3077
3079
|
return null;
|
|
3078
3080
|
case F.Cielab:
|
|
3079
3081
|
return {
|
|
3080
|
-
module:
|
|
3082
|
+
module: Ur
|
|
3081
3083
|
};
|
|
3082
3084
|
default:
|
|
3083
3085
|
throw new Error(`Unsupported PhotometricInterpretation ${r}`);
|
|
3084
3086
|
}
|
|
3085
3087
|
}
|
|
3086
|
-
function
|
|
3088
|
+
function Vr(e, t) {
|
|
3087
3089
|
const { module: n, props: r } = e;
|
|
3088
3090
|
if (!r)
|
|
3089
3091
|
return { module: n };
|
|
@@ -3094,11 +3096,11 @@ function _r(e, t) {
|
|
|
3094
3096
|
}
|
|
3095
3097
|
return { module: n, props: o };
|
|
3096
3098
|
}
|
|
3097
|
-
function
|
|
3099
|
+
function Yr(e, t) {
|
|
3098
3100
|
const r = [
|
|
3099
3101
|
...[...e.overviews].reverse(),
|
|
3100
3102
|
e
|
|
3101
|
-
].map((o) => new
|
|
3103
|
+
].map((o) => new Et({
|
|
3102
3104
|
affine: o.transform,
|
|
3103
3105
|
arrayWidth: o.width,
|
|
3104
3106
|
arrayHeight: o.height,
|
|
@@ -3106,7 +3108,7 @@ function $r(e, t) {
|
|
|
3106
3108
|
tileHeight: o.tileHeight,
|
|
3107
3109
|
mpu: t.mpu
|
|
3108
3110
|
}));
|
|
3109
|
-
return new
|
|
3111
|
+
return new Ft({
|
|
3110
3112
|
levels: r,
|
|
3111
3113
|
projectTo3857: t.projectTo3857,
|
|
3112
3114
|
projectFrom3857: t.projectFrom3857,
|
|
@@ -3114,7 +3116,7 @@ function $r(e, t) {
|
|
|
3114
3116
|
projectFrom4326: t.projectFrom4326
|
|
3115
3117
|
});
|
|
3116
3118
|
}
|
|
3117
|
-
class
|
|
3119
|
+
class Xr extends ye {
|
|
3118
3120
|
static layerName = "COGLayer";
|
|
3119
3121
|
// COGLayer's getTileData signature differs from the base class's, so
|
|
3120
3122
|
// `DefaultProps<COGLayerProps>` is not assignable to
|
|
@@ -3122,8 +3124,8 @@ class kr extends fe {
|
|
|
3122
3124
|
// to keep inheritance happy. The only COG-specific default is
|
|
3123
3125
|
// `epsgResolver`; all behavior still flows from the base class.
|
|
3124
3126
|
static defaultProps = {
|
|
3125
|
-
...
|
|
3126
|
-
epsgResolver:
|
|
3127
|
+
...ye.defaultProps,
|
|
3128
|
+
epsgResolver: At
|
|
3127
3129
|
};
|
|
3128
3130
|
initializeState() {
|
|
3129
3131
|
this.setState({});
|
|
@@ -3142,12 +3144,12 @@ class kr extends fe {
|
|
|
3142
3144
|
});
|
|
3143
3145
|
}
|
|
3144
3146
|
async _parseGeoTIFF() {
|
|
3145
|
-
const t = await
|
|
3147
|
+
const t = await Fr(this.props.geotiff), n = t.crs, r = typeof n == "number" ? await this.props.epsgResolver(n) : jt(n), o = we(r, "EPSG:4326"), i = (w, b) => o.forward([w, b], !1), a = (w, b) => o.inverse([w, b], !1), s = we(r, "EPSG:3857"), l = Mt((w, b) => s.forward([w, b], !1), i), c = (w, b) => s.inverse([w, b], !1), u = r.units;
|
|
3146
3148
|
if (!u)
|
|
3147
3149
|
throw new Error("Source projection is missing 'units' property, cannot compute meters per unit");
|
|
3148
|
-
const h =
|
|
3150
|
+
const h = Rt(u, {
|
|
3149
3151
|
semiMajorAxis: r.datum?.a ?? r.a
|
|
3150
|
-
}), p =
|
|
3152
|
+
}), p = Yr(t, {
|
|
3151
3153
|
projectTo4326: i,
|
|
3152
3154
|
projectFrom4326: a,
|
|
3153
3155
|
projectTo3857: l,
|
|
@@ -3155,14 +3157,14 @@ class kr extends fe {
|
|
|
3155
3157
|
mpu: h
|
|
3156
3158
|
});
|
|
3157
3159
|
if (this.props.onGeoTIFFLoad) {
|
|
3158
|
-
const
|
|
3160
|
+
const w = Ar(t, o);
|
|
3159
3161
|
this.props.onGeoTIFFLoad(t, {
|
|
3160
3162
|
projection: r,
|
|
3161
|
-
geographicBounds:
|
|
3163
|
+
geographicBounds: w
|
|
3162
3164
|
});
|
|
3163
3165
|
}
|
|
3164
3166
|
let g, y;
|
|
3165
|
-
(!this.props.getTileData || !this.props.renderTile) && ({ getTileData: g, renderTile: y } =
|
|
3167
|
+
(!this.props.getTileData || !this.props.renderTile) && ({ getTileData: g, renderTile: y } = Wr(t, this.context.device)), this.setState({
|
|
3166
3168
|
geotiff: t,
|
|
3167
3169
|
tilesetDescriptor: p,
|
|
3168
3170
|
defaultGetTileData: g,
|
|
@@ -3188,7 +3190,7 @@ class kr extends fe {
|
|
|
3188
3190
|
x: a,
|
|
3189
3191
|
y: s,
|
|
3190
3192
|
signal: i.signal,
|
|
3191
|
-
pool: this.props.pool ??
|
|
3193
|
+
pool: this.props.pool ?? vr()
|
|
3192
3194
|
});
|
|
3193
3195
|
} : void 0;
|
|
3194
3196
|
}
|
|
@@ -3198,7 +3200,7 @@ class kr extends fe {
|
|
|
3198
3200
|
return t;
|
|
3199
3201
|
}
|
|
3200
3202
|
}
|
|
3201
|
-
const
|
|
3203
|
+
const pt = `var j;
|
|
3202
3204
|
(function(e) {
|
|
3203
3205
|
e[e.Big = 19789] = "Big", e[e.Little = 18761] = "Little";
|
|
3204
3206
|
})(j || (j = {}));
|
|
@@ -3503,8 +3505,8 @@ export {
|
|
|
3503
3505
|
t as C,
|
|
3504
3506
|
S as D
|
|
3505
3507
|
};
|
|
3506
|
-
`, Ue = typeof self < "u" && self.Blob && new Blob(["URL.revokeObjectURL(import.meta.url);",
|
|
3507
|
-
function
|
|
3508
|
+
`, Ue = typeof self < "u" && self.Blob && new Blob(["URL.revokeObjectURL(import.meta.url);", pt], { type: "text/javascript;charset=utf-8" });
|
|
3509
|
+
function Zr(e) {
|
|
3508
3510
|
let t;
|
|
3509
3511
|
try {
|
|
3510
3512
|
if (t = Ue && (self.URL || self.webkitURL).createObjectURL(Ue), !t) throw "";
|
|
@@ -3517,7 +3519,7 @@ function Wr(e) {
|
|
|
3517
3519
|
}), n;
|
|
3518
3520
|
} catch {
|
|
3519
3521
|
return new Worker(
|
|
3520
|
-
"data:text/javascript;charset=utf-8," + encodeURIComponent(
|
|
3522
|
+
"data:text/javascript;charset=utf-8," + encodeURIComponent(pt),
|
|
3521
3523
|
{
|
|
3522
3524
|
type: "module",
|
|
3523
3525
|
name: e?.name
|
|
@@ -3525,7 +3527,77 @@ function Wr(e) {
|
|
|
3525
3527
|
);
|
|
3526
3528
|
}
|
|
3527
3529
|
}
|
|
3528
|
-
|
|
3530
|
+
function Qr(e) {
|
|
3531
|
+
const t = (e ?? "").toLowerCase();
|
|
3532
|
+
return t.startsWith("degree") || t === "deg" ? "degree" : t.includes("foot") || t === "ft" ? "foot" : "metre";
|
|
3533
|
+
}
|
|
3534
|
+
function qr(e) {
|
|
3535
|
+
const [t, n, , r, o] = e;
|
|
3536
|
+
return { x: Math.hypot(t, r), y: Math.hypot(n, o) };
|
|
3537
|
+
}
|
|
3538
|
+
function Tr(e, t, n) {
|
|
3539
|
+
const [, , , , r, o] = e, i = (l) => r * l + o, a = i(t), s = i(t + n);
|
|
3540
|
+
return { north: Math.max(a, s), south: Math.min(a, s) };
|
|
3541
|
+
}
|
|
3542
|
+
function eo(e, t) {
|
|
3543
|
+
const n = qr(e);
|
|
3544
|
+
return Bt({
|
|
3545
|
+
unitsPerPixelX: n.x,
|
|
3546
|
+
unitsPerPixelY: n.y,
|
|
3547
|
+
crsUnits: t
|
|
3548
|
+
});
|
|
3549
|
+
}
|
|
3550
|
+
function Oe(e, t) {
|
|
3551
|
+
const n = We(e, t);
|
|
3552
|
+
return {
|
|
3553
|
+
width: e.width,
|
|
3554
|
+
height: e.height,
|
|
3555
|
+
at: (r, o) => n[o * e.width + r]
|
|
3556
|
+
};
|
|
3557
|
+
}
|
|
3558
|
+
async function to(e) {
|
|
3559
|
+
const { own: t, band: n, x: r, y: o, neighbours: i } = e, a = /* @__PURE__ */ new Map();
|
|
3560
|
+
return await Promise.all(
|
|
3561
|
+
Nt.map(async ({ dx: s, dy: l }) => {
|
|
3562
|
+
const c = r + s, u = o + l;
|
|
3563
|
+
if (c < 0 || u < 0 || c >= i.matrixWidth || u >= i.matrixHeight) return;
|
|
3564
|
+
const h = i.loaded(c, u);
|
|
3565
|
+
a.set(`${s},${l}`, h ?? await i.fetch(c, u));
|
|
3566
|
+
})
|
|
3567
|
+
), zt(Oe(t, n), (s, l) => {
|
|
3568
|
+
const c = a.get(`${s},${l}`);
|
|
3569
|
+
return c ? Oe(c, n) : null;
|
|
3570
|
+
});
|
|
3571
|
+
}
|
|
3572
|
+
const xe = /* @__PURE__ */ new WeakMap(), no = 32;
|
|
3573
|
+
function ro(e, t, n, r) {
|
|
3574
|
+
let o = xe.get(e);
|
|
3575
|
+
o || xe.set(e, o = /* @__PURE__ */ new Map());
|
|
3576
|
+
const i = `${t},${n}`, a = o.get(i);
|
|
3577
|
+
if (a) return a;
|
|
3578
|
+
const s = r().catch(() => null);
|
|
3579
|
+
if (o.set(i, s), o.size > no) {
|
|
3580
|
+
const l = o.keys().next().value;
|
|
3581
|
+
l !== void 0 && o.delete(l);
|
|
3582
|
+
}
|
|
3583
|
+
return s;
|
|
3584
|
+
}
|
|
3585
|
+
function oo(e, t) {
|
|
3586
|
+
return e.createTexture({
|
|
3587
|
+
data: t.data,
|
|
3588
|
+
format: "r32float",
|
|
3589
|
+
width: t.width + 2,
|
|
3590
|
+
height: t.height + 2,
|
|
3591
|
+
// NEAREST: linear filtering of a float texture needs
|
|
3592
|
+
// OES_texture_float_linear, which is not universal (the same constraint
|
|
3593
|
+
// raster-pipeline.ts documents for its band textures).
|
|
3594
|
+
sampler: { minFilter: "nearest", magFilter: "nearest", addressModeU: "clamp-to-edge", addressModeV: "clamp-to-edge" }
|
|
3595
|
+
});
|
|
3596
|
+
}
|
|
3597
|
+
function io(e) {
|
|
3598
|
+
e.shading?.texture.destroy(), e.shading = null;
|
|
3599
|
+
}
|
|
3600
|
+
const V = /* @__PURE__ */ new WeakMap(), gt = /* @__PURE__ */ new WeakMap(), ie = async (e, {
|
|
3529
3601
|
device: t,
|
|
3530
3602
|
x: n,
|
|
3531
3603
|
y: r,
|
|
@@ -3539,39 +3611,58 @@ const Z = /* @__PURE__ */ new WeakMap(), ie = async (e, {
|
|
|
3539
3611
|
o?.aborted && s();
|
|
3540
3612
|
const l = await e.fetchTile(n, r, { boundless: !1, pool: i, signal: o });
|
|
3541
3613
|
o?.aborted && s();
|
|
3542
|
-
const c = l.array, u = e.cachedTags.samplesPerPixel, h = c.layout === "band-separate" ? c.bands.reduce((
|
|
3614
|
+
const c = l.array, u = e.cachedTags.samplesPerPixel, h = c.layout === "band-separate" ? c.bands.reduce((w, b) => w + b.byteLength || 0, 0) : c.data.byteLength, p = {
|
|
3543
3615
|
width: c.width,
|
|
3544
3616
|
height: c.height,
|
|
3545
3617
|
byteLength: h,
|
|
3546
3618
|
device: t,
|
|
3547
3619
|
array: c,
|
|
3548
3620
|
bandTextures: /* @__PURE__ */ new Map(),
|
|
3549
|
-
colormapTexture: await
|
|
3621
|
+
colormapTexture: await Kt(t),
|
|
3550
3622
|
bandCount: u,
|
|
3551
3623
|
nodata: c.nodata
|
|
3552
3624
|
};
|
|
3553
3625
|
if (a) {
|
|
3554
|
-
const
|
|
3626
|
+
const w = le(a.bands, u), b = Dt(p, w);
|
|
3555
3627
|
return p.array = null, p.byteLength = new Set(b).size * c.width * c.height * 4, p;
|
|
3556
3628
|
}
|
|
3557
|
-
let g =
|
|
3558
|
-
g ||
|
|
3629
|
+
let g = V.get(e);
|
|
3630
|
+
g || V.set(e, g = /* @__PURE__ */ new Map());
|
|
3559
3631
|
const y = `${n},${r}`;
|
|
3560
3632
|
return g.set(y, p), p.identifyKey = { image: e, key: y }, p;
|
|
3561
3633
|
};
|
|
3634
|
+
async function ao(e) {
|
|
3635
|
+
const { data: t, image: n, file: r, x: o, y: i, style: a, device: s, pool: l, signal: c } = e, u = t.array;
|
|
3636
|
+
if (!u) return;
|
|
3637
|
+
const h = le(a.bands, t.bandCount)[0], p = V.get(n), g = await to({
|
|
3638
|
+
own: u,
|
|
3639
|
+
band: h,
|
|
3640
|
+
x: o,
|
|
3641
|
+
y: i,
|
|
3642
|
+
neighbours: {
|
|
3643
|
+
matrixWidth: Math.ceil(n.width / n.tileWidth),
|
|
3644
|
+
matrixHeight: Math.ceil(n.height / n.tileHeight),
|
|
3645
|
+
loaded: (C, I) => p?.get(`${C},${I}`)?.array ?? null,
|
|
3646
|
+
fetch: (C, I) => ro(n, C, I, async () => (await n.fetchTile(C, I, { boundless: !1, pool: l })).array)
|
|
3647
|
+
}
|
|
3648
|
+
});
|
|
3649
|
+
if (c?.aborted) return;
|
|
3650
|
+
const y = gt.get(r) ?? "metre", { metresPerTexel: w, latMode: b } = eo(n.transform, y), { north: E, south: L } = Tr(n.transform, i * n.tileHeight, u.height);
|
|
3651
|
+
t.shading = { texture: oo(s, g), width: g.width, height: g.height, north: E, south: L, metresPerTexel: w, latMode: b };
|
|
3652
|
+
}
|
|
3562
3653
|
function ae(e) {
|
|
3563
3654
|
const t = e.bitsPerSample?.[0] ?? 8, n = e.sampleFormat?.[0] ?? 1;
|
|
3564
3655
|
return n === 3 ? `float${t}` : n === 2 ? `int${t}` : `uint${t}`;
|
|
3565
3656
|
}
|
|
3566
|
-
function
|
|
3657
|
+
function mt(e) {
|
|
3567
3658
|
return (e.bitsPerSample?.[0] ?? 8) === 8 && (e.sampleFormat?.[0] ?? 1) === 1;
|
|
3568
3659
|
}
|
|
3569
|
-
const
|
|
3570
|
-
function
|
|
3571
|
-
let n =
|
|
3572
|
-
return n ||
|
|
3660
|
+
const Ke = /* @__PURE__ */ new WeakMap();
|
|
3661
|
+
function so(e, t) {
|
|
3662
|
+
let n = Ke.get(e);
|
|
3663
|
+
return n || Ke.set(e, n = /* @__PURE__ */ new Map()), { get: () => n.get(t), set: (r) => n.set(t, r) };
|
|
3573
3664
|
}
|
|
3574
|
-
function
|
|
3665
|
+
function ft(e, t) {
|
|
3575
3666
|
const n = e?.bandStatistics;
|
|
3576
3667
|
if (!n) return null;
|
|
3577
3668
|
const r = [];
|
|
@@ -3582,10 +3673,10 @@ function ht(e, t) {
|
|
|
3582
3673
|
}
|
|
3583
3674
|
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" };
|
|
3584
3675
|
}
|
|
3585
|
-
async function
|
|
3676
|
+
async function yt(e, t, n) {
|
|
3586
3677
|
const o = (await e.fetchTile(0, 0, { boundless: !1, pool: n })).array, i = o.nodata ?? null, a = [];
|
|
3587
3678
|
for (const s of t) {
|
|
3588
|
-
const l =
|
|
3679
|
+
const l = We(o, s);
|
|
3589
3680
|
let c = 1 / 0, u = -1 / 0;
|
|
3590
3681
|
for (let h = 0; h < l.length; h++) {
|
|
3591
3682
|
const p = l[h];
|
|
@@ -3596,35 +3687,35 @@ async function pt(e, t, n) {
|
|
|
3596
3687
|
}
|
|
3597
3688
|
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" };
|
|
3598
3689
|
}
|
|
3599
|
-
const
|
|
3600
|
-
function
|
|
3690
|
+
const wt = 12;
|
|
3691
|
+
function St(e, t) {
|
|
3601
3692
|
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;
|
|
3602
3693
|
for (let l = 0; l < i; l++)
|
|
3603
|
-
if (o.add(Number(r[l * a])), o.size >
|
|
3694
|
+
if (o.add(Number(r[l * a])), o.size > wt) return null;
|
|
3604
3695
|
const s = (l) => (l >> 8).toString(16).padStart(2, "0");
|
|
3605
3696
|
return [...o].filter((l) => Number.isInteger(l) && l >= 0 && l < n).sort((l, c) => l - c).map((l) => ({
|
|
3606
3697
|
color: `#${s(e[l])}${s(e[n + l])}${s(e[n * 2 + l])}`,
|
|
3607
3698
|
label: String(l)
|
|
3608
3699
|
}));
|
|
3609
3700
|
}
|
|
3610
|
-
const
|
|
3611
|
-
function
|
|
3612
|
-
if (
|
|
3613
|
-
|
|
3701
|
+
const De = /* @__PURE__ */ new WeakSet(), Ne = /* @__PURE__ */ new Set(), ze = /* @__PURE__ */ new Set(), Be = /* @__PURE__ */ new Set();
|
|
3702
|
+
function _e(e, t, n) {
|
|
3703
|
+
if (Ne.has(e)) return;
|
|
3704
|
+
Ne.add(e);
|
|
3614
3705
|
const r = (i) => Array.isArray(i) ? `[${i.map((a) => +a.toFixed(4)).join(", ")}]` : String(+i.toFixed(4)), o = n.source === "stats" ? "from file statistics" : "SAMPLED FROM THE COARSEST OVERVIEW (no GDAL statistics tags) — the window is data-derived and can move if the file is regenerated";
|
|
3615
3706
|
console.warn(`[onlymapjs] "${e}" is ${t} — auto-stretched to [${r(n.min)}, ${r(n.max)}] ${o}. Set min/max (or rescale) explicitly for stable styling.`);
|
|
3616
3707
|
}
|
|
3617
3708
|
let W;
|
|
3618
|
-
function
|
|
3709
|
+
function X() {
|
|
3619
3710
|
if (W) return W;
|
|
3620
3711
|
try {
|
|
3621
|
-
W = new oe({ createWorker: () => new
|
|
3712
|
+
W = new oe({ createWorker: () => new Zr() });
|
|
3622
3713
|
} catch (e) {
|
|
3623
3714
|
console.warn("[onlymapjs] COGLayer: worker decode unavailable — falling back to main-thread decode.", e), W = new oe({});
|
|
3624
3715
|
}
|
|
3625
3716
|
return W;
|
|
3626
3717
|
}
|
|
3627
|
-
class
|
|
3718
|
+
class lo extends Xr {
|
|
3628
3719
|
static layerName = "OmCOGLayer";
|
|
3629
3720
|
// Plain nulls (not `{type:"number", value:null}` specs): deck's typed
|
|
3630
3721
|
// number props reject null defaults with a console warning per instance.
|
|
@@ -3636,16 +3727,27 @@ class Vr extends kr {
|
|
|
3636
3727
|
bands: null,
|
|
3637
3728
|
stretch: null,
|
|
3638
3729
|
gamma: null,
|
|
3639
|
-
reverse: null
|
|
3730
|
+
reverse: null,
|
|
3731
|
+
shading: null,
|
|
3732
|
+
sunAzimuth: null,
|
|
3733
|
+
sunWeight: null,
|
|
3734
|
+
sunElevation: null,
|
|
3735
|
+
zFactor: null
|
|
3640
3736
|
};
|
|
3641
3737
|
constructor(t) {
|
|
3642
|
-
|
|
3738
|
+
const n = t.onGeoTIFFLoad;
|
|
3739
|
+
super({ ...t, pool: t.pool ?? X() }, {
|
|
3740
|
+
// Chained, not replaced: a consumer's own handler still fires.
|
|
3741
|
+
onGeoTIFFLoad: (r, o) => {
|
|
3742
|
+
const i = o?.projection?.units;
|
|
3743
|
+
gt.set(r, Qr(i)), n?.(r, o);
|
|
3744
|
+
},
|
|
3643
3745
|
// Free the per-tile band textures + retained decode on cache eviction
|
|
3644
3746
|
// (the guard makes this a no-op for the unstyled path's upstream tile
|
|
3645
3747
|
// shape); the sprite texture is device-scoped and must NOT die here.
|
|
3646
|
-
onTileUnload: (
|
|
3647
|
-
const
|
|
3648
|
-
!
|
|
3748
|
+
onTileUnload: (r) => {
|
|
3749
|
+
const o = r.data;
|
|
3750
|
+
!o || typeof o != "object" || !("bandTextures" in o) || (io(o), Ut(o), o.identifyKey && V.get(o.identifyKey.image)?.delete(o.identifyKey.key));
|
|
3649
3751
|
}
|
|
3650
3752
|
});
|
|
3651
3753
|
}
|
|
@@ -3699,16 +3801,16 @@ class Vr extends kr {
|
|
|
3699
3801
|
const n = this.omGeotiff();
|
|
3700
3802
|
if (!n) return;
|
|
3701
3803
|
const r = n.cachedTags;
|
|
3702
|
-
n.overviews.length === 0 && !
|
|
3804
|
+
n.overviews.length === 0 && !ze.has(t) && (ze.add(t), this.omReportError(
|
|
3703
3805
|
"warning",
|
|
3704
3806
|
"src",
|
|
3705
3807
|
`"${t}" is a plain (non-cloud-optimized) GeoTIFF — every view re-reads the full image.`,
|
|
3706
3808
|
"Convert once: rio cogeo create in.tif out.tif (or gdal_translate -of COG)."
|
|
3707
3809
|
));
|
|
3708
3810
|
const o = this.omExtra();
|
|
3709
|
-
if (o.bands != null && !
|
|
3811
|
+
if (o.bands != null && !Be.has(t)) {
|
|
3710
3812
|
const i = r.samplesPerPixel ?? 1, a = typeof o.bands == "number" ? [o.bands] : o.bands;
|
|
3711
|
-
Array.isArray(a) && a.some((s) => !Number.isInteger(s) || s < 1 || s > i) && (
|
|
3813
|
+
Array.isArray(a) && a.some((s) => !Number.isInteger(s) || s < 1 || s > i) && (Be.add(t), this.omReportError(
|
|
3712
3814
|
"error",
|
|
3713
3815
|
"bands",
|
|
3714
3816
|
`bands="${JSON.stringify(o.bands)}" but "${t}" has ${i} band${i === 1 ? "" : "s"}.`,
|
|
@@ -3735,7 +3837,9 @@ class Vr extends kr {
|
|
|
3735
3837
|
}
|
|
3736
3838
|
omAuthoredStyled() {
|
|
3737
3839
|
const t = this.omExtra();
|
|
3738
|
-
return t.rescaleMin != null || t.rescaleMax != null || t.colormap != null && t.colormap !== "" || t.nodataOverride != null || t.bands != null || t.stretch != null || t.gamma != null || t.reverse != null ||
|
|
3840
|
+
return t.rescaleMin != null || t.rescaleMax != null || t.colormap != null && t.colormap !== "" || t.nodataOverride != null || t.bands != null || t.stretch != null || t.gamma != null || t.reverse != null || // shading is styling: a plain 8-bit DEM with only `shading` authored must
|
|
3841
|
+
// still enter the styled pipeline, or there is nothing to attach relief to.
|
|
3842
|
+
t.shading != null && t.shading !== "" || t.rescale === "auto";
|
|
3739
3843
|
}
|
|
3740
3844
|
omGeotiff() {
|
|
3741
3845
|
return this.state?.geotiff;
|
|
@@ -3753,23 +3857,23 @@ class Vr extends kr {
|
|
|
3753
3857
|
const n = this.omGeotiff();
|
|
3754
3858
|
if (!n) return !1;
|
|
3755
3859
|
const r = n.cachedTags;
|
|
3756
|
-
return r.colorMap ? !1 : this.omAuthoredStyled() ? !0 : !
|
|
3860
|
+
return r.colorMap ? !1 : this.omAuthoredStyled() ? !0 : !mt(r);
|
|
3757
3861
|
}
|
|
3758
3862
|
/** Resolved auto window, kicking off the one-shot overview sample when stats are absent. Undefined while pending/unavailable. */
|
|
3759
3863
|
omAutoWindow() {
|
|
3760
3864
|
if (!this.omAutoWanted()) return;
|
|
3761
3865
|
const t = this.omGeotiff();
|
|
3762
3866
|
if (!t) return;
|
|
3763
|
-
const n = this.omExtra(), r = t.cachedTags, o =
|
|
3867
|
+
const n = this.omExtra(), r = t.cachedTags, o = le(n.bands, r.samplesPerPixel ?? 1), i = so(t, o.join(",")), a = i.get();
|
|
3764
3868
|
if (a === "pending" || a === null) return;
|
|
3765
3869
|
if (a) return a;
|
|
3766
|
-
const s =
|
|
3870
|
+
const s = ft(t.gdalMetadata, o);
|
|
3767
3871
|
if (s)
|
|
3768
|
-
return i.set(s),
|
|
3872
|
+
return i.set(s), _e(n.geotiff ?? "", ae(r), s), this.omPublishWindow(s, o), s;
|
|
3769
3873
|
i.set("pending");
|
|
3770
3874
|
const l = t.overviews[t.overviews.length - 1] ?? t;
|
|
3771
|
-
|
|
3772
|
-
i.set(c), c && (
|
|
3875
|
+
yt(l, o, this.props.pool ?? X()).then((c) => {
|
|
3876
|
+
i.set(c), c && (_e(n.geotiff ?? "", ae(r), c), this.omPublishWindow(c, o));
|
|
3773
3877
|
try {
|
|
3774
3878
|
this.setState({ omAutoWindowTick: this.state?.omAutoWindowTick === 1 ? 2 : 1 });
|
|
3775
3879
|
} catch {
|
|
@@ -3814,32 +3918,32 @@ class Vr extends kr {
|
|
|
3814
3918
|
if (i < 0 || a < 0 || i >= n.height || a >= n.width) return null;
|
|
3815
3919
|
const s = n.cachedTags.samplesPerPixel ?? 1, l = [n, ...n.overviews];
|
|
3816
3920
|
for (const c of l) {
|
|
3817
|
-
const u =
|
|
3921
|
+
const u = V.get(c);
|
|
3818
3922
|
if (!u || u.size === 0) continue;
|
|
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),
|
|
3820
|
-
if (!
|
|
3821
|
-
const b = Math.min(
|
|
3923
|
+
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), w = u.get(`${g},${y}`);
|
|
3924
|
+
if (!w?.array) continue;
|
|
3925
|
+
const b = Math.min(w.width - 1, p - g * c.tileWidth), E = Math.min(w.height - 1, h - y * c.tileHeight), L = Ot(w.array, b, E, s), C = w.nodata;
|
|
3822
3926
|
return {
|
|
3823
|
-
values:
|
|
3824
|
-
bands:
|
|
3825
|
-
nodata:
|
|
3927
|
+
values: L,
|
|
3928
|
+
bands: L.map((I, G) => G + 1),
|
|
3929
|
+
nodata: C != null && L.every((I) => I === C)
|
|
3826
3930
|
};
|
|
3827
3931
|
}
|
|
3828
3932
|
return null;
|
|
3829
3933
|
}
|
|
3830
3934
|
updateState(t) {
|
|
3831
|
-
super.updateState(t),
|
|
3935
|
+
super.updateState(t), _t(this.props.id, (n) => this.identify(n)), this.omMaybePaletteLegend();
|
|
3832
3936
|
}
|
|
3833
3937
|
/** One-shot palette legend derivation per opened file (phase 5). */
|
|
3834
3938
|
omMaybePaletteLegend() {
|
|
3835
3939
|
const t = this.omGeotiff();
|
|
3836
|
-
if (!t ||
|
|
3940
|
+
if (!t || De.has(t)) return;
|
|
3837
3941
|
const n = t.cachedTags;
|
|
3838
3942
|
if (!n.colorMap) return;
|
|
3839
|
-
|
|
3943
|
+
De.add(t);
|
|
3840
3944
|
const r = n.colorMap;
|
|
3841
|
-
(t.overviews[t.overviews.length - 1] ?? t).fetchTile(0, 0, { boundless: !1, pool: this.props.pool ??
|
|
3842
|
-
const a =
|
|
3945
|
+
(t.overviews[t.overviews.length - 1] ?? t).fetchTile(0, 0, { boundless: !1, pool: this.props.pool ?? X() }).then((i) => {
|
|
3946
|
+
const a = St(r, i.array);
|
|
3843
3947
|
if (!a || a.length === 0) return;
|
|
3844
3948
|
const s = this.props.onPaletteLegend;
|
|
3845
3949
|
s?.(a);
|
|
@@ -3847,24 +3951,30 @@ class Vr extends kr {
|
|
|
3847
3951
|
});
|
|
3848
3952
|
}
|
|
3849
3953
|
finalizeState(t) {
|
|
3850
|
-
|
|
3954
|
+
$t(this.props.id), super.finalizeState(t);
|
|
3851
3955
|
}
|
|
3852
3956
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
3853
3957
|
_getTileDataCallback() {
|
|
3854
3958
|
if (!this.omStyledActive()) return super._getTileDataCallback();
|
|
3855
3959
|
const t = this.omGeotiff();
|
|
3856
3960
|
if (!t) return;
|
|
3857
|
-
const n = this.props.pool ??
|
|
3858
|
-
return async (
|
|
3859
|
-
const { x:
|
|
3860
|
-
|
|
3961
|
+
const n = this.props.pool ?? X(), r = this.omEffectiveStyle(), o = r.shading === "hillshade", i = this.props.identify === "off" && !o ? { bands: r.bands } : void 0;
|
|
3962
|
+
return async (a, s) => {
|
|
3963
|
+
const { x: l, y: c, z: u } = a.index, h = u === t.overviews.length ? t : t.overviews[t.overviews.length - 1 - u], p = await ie(h, { device: s.device, x: l, y: c, signal: s.signal, pool: n, dropDecode: i });
|
|
3964
|
+
if (o)
|
|
3965
|
+
try {
|
|
3966
|
+
await ao({ data: p, image: h, file: t, x: l, y: c, style: r, device: s.device, pool: n, signal: s.signal });
|
|
3967
|
+
} catch {
|
|
3968
|
+
p.shading = null;
|
|
3969
|
+
}
|
|
3970
|
+
return p;
|
|
3861
3971
|
};
|
|
3862
3972
|
}
|
|
3863
3973
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
3864
3974
|
_renderTileCallback() {
|
|
3865
3975
|
if (!this.omStyledActive()) return super._renderTileCallback();
|
|
3866
3976
|
const t = this.omEffectiveStyle();
|
|
3867
|
-
return (n) => n ?
|
|
3977
|
+
return (n) => n ? xt(n, t) : null;
|
|
3868
3978
|
}
|
|
3869
3979
|
/**
|
|
3870
3980
|
* identify="off" bakes the selection into fetch-time textures, so a bands
|
|
@@ -3879,23 +3989,23 @@ class Vr extends kr {
|
|
|
3879
3989
|
renderLayers() {
|
|
3880
3990
|
const t = super.renderLayers();
|
|
3881
3991
|
if (!t || !this.omStyledActive()) return t;
|
|
3882
|
-
const
|
|
3883
|
-
return Array.isArray(t) ? t.map(
|
|
3992
|
+
const n = this.props.identify === "off", r = this.omEffectiveStyle().shading === "hillshade" ? "+hs" : "", o = (n ? `off:${JSON.stringify(this.omEffectiveStyle().bands ?? null)}` : "retained") + r, i = (a) => a && typeof a.clone == "function" && a.props?.getTileData ? a.clone({ updateTriggers: { ...a.props.updateTriggers ?? {}, getTileData: o } }) : a;
|
|
3993
|
+
return Array.isArray(t) ? t.map(i) : i(t);
|
|
3884
3994
|
}
|
|
3885
3995
|
}
|
|
3886
|
-
const
|
|
3996
|
+
const fo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
3887
3997
|
__proto__: null,
|
|
3888
|
-
OmCOGLayer:
|
|
3889
|
-
PALETTE_LEGEND_MAX_CLASSES:
|
|
3998
|
+
OmCOGLayer: lo,
|
|
3999
|
+
PALETTE_LEGEND_MAX_CLASSES: wt,
|
|
3890
4000
|
dtypeName: ae,
|
|
3891
|
-
isUint8:
|
|
4001
|
+
isUint8: mt,
|
|
3892
4002
|
omGetTileData: ie,
|
|
3893
|
-
overviewWindow:
|
|
3894
|
-
paletteLegendEntries:
|
|
3895
|
-
statsWindow:
|
|
4003
|
+
overviewWindow: yt,
|
|
4004
|
+
paletteLegendEntries: St,
|
|
4005
|
+
statsWindow: ft
|
|
3896
4006
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
3897
4007
|
export {
|
|
3898
4008
|
f as C,
|
|
3899
4009
|
j as D,
|
|
3900
|
-
|
|
4010
|
+
fo as r
|
|
3901
4011
|
};
|