@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, x = H * this.height;
86051
- this.projection = proj4("WGS84", s.proj4), this.coord2pixel = ([Y, e0]) => {
86052
- let { x: _0, y: E0 } = this.projection.forward({ x: Y, y: e0 }), n0 = (_0 - c) / d, l0 = (E0 - m) / x;
86053
- const A0 = this.width * n0, T0 = this.height * l0, J = Math.floor(A0), o0 = Math.floor(T0);
86054
- return J < 0 || J >= this.width || o0 < 0 || o0 >= this.height ? null : [A0, T0, J, o0];
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() {