@mapcatch/util 2.2.11 → 2.2.12
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.
|
@@ -86047,11 +86047,12 @@ class GeoidCoordinateTransformer {
|
|
|
86047
86047
|
if (!fs.existsSync(o))
|
|
86048
86048
|
throw new Error("tiff not exists");
|
|
86049
86049
|
this.destroy(), this.tiff = await geotiff.fromFile(o), this.image = await this.tiff.getImage(), this.width = this.image.getWidth(), this.height = this.image.getHeight();
|
|
86050
|
-
const l = this.image.getGeoKeys(), s = VAFgVHdDsUKZGZRjaSIfx.toProj4(l), [c, m] = this.image.getOrigin(), [p, H] = this.image.getResolution(), d = p * this.width,
|
|
86051
|
-
this.projection = proj4("WGS84", s.proj4), this.coord2pixel = ([
|
|
86052
|
-
|
|
86053
|
-
|
|
86054
|
-
|
|
86050
|
+
const l = this.image.getGeoKeys(), s = VAFgVHdDsUKZGZRjaSIfx.toProj4(l), [c, m] = this.image.getOrigin(), [p, H] = this.image.getResolution(), d = this.image.getBoundingBox(), x = p * this.width, Y = H * this.height;
|
|
86051
|
+
this.projection = proj4("WGS84", s.proj4), this.coord2pixel = ([e0, _0]) => {
|
|
86052
|
+
(d[0] > 180 || d[2] > 180) && e0 < 0 ? e0 = e0 + 360 : (d[0] < -180 || d[2] < -180) && e0 > 0 && (e0 = e0 - 360);
|
|
86053
|
+
let { x: E0, y: n0 } = this.projection.forward({ x: e0, y: _0 }), l0 = (E0 - c) / x, A0 = (n0 - m) / Y;
|
|
86054
|
+
const T0 = this.width * l0, J = this.height * A0, o0 = Math.floor(T0), q = Math.floor(J);
|
|
86055
|
+
return o0 < 0 || o0 >= this.width || q < 0 || q >= this.height ? null : [T0, J, o0, q];
|
|
86055
86056
|
}, this.memory && (this.data = await this.image.readRasters({ interleave: !0, samples: [0] }));
|
|
86056
86057
|
}
|
|
86057
86058
|
destroy() {
|