diff --git a/README.md b/README.md index febacbb0..e2c0696f 100755 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ [npm-url]: https://npmjs.org/package/s2-tools [crate-image]: https://img.shields.io/crates/v/s2-tools.svg?logo=rust&logoColor=white [crate-url]: https://crates.io/crates/s2-tools -[bundle-image]: https://img.shields.io/bundlejs/size/s2-tools?exports=s2-tools +[bundle-image]: https://img.shields.io/bundlejs/size/s2-tools [bundle-url]: https://bundlejs.com/?q=s2-tools&treeshake=%5B%7B+s2-tools+%7D%5D [downloads-image]: https://img.shields.io/npm/dm/s2-tools.svg [downloads-url]: https://www.npmjs.com/package/s2-tools diff --git a/assets/code-coverage.svg b/assets/code-coverage.svg index 9d42fe5e..59ba6baf 100644 --- a/assets/code-coverage.svg +++ b/assets/code-coverage.svg @@ -12,7 +12,7 @@ code-cov code-cov - 95.95% - 95.95% + 95.49% + 95.49% \ No newline at end of file diff --git a/assets/doc-coverage.svg b/assets/doc-coverage.svg index 703d7bb4..2da42d58 100644 --- a/assets/doc-coverage.svg +++ b/assets/doc-coverage.svg @@ -11,7 +11,7 @@ document document - 98% - 98% + 97% + 97% \ No newline at end of file diff --git a/package.json b/package.json index d40b983c..b491fec1 100755 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "s2-tools", - "version": "0.1.1", + "version": "0.1.2", "description": "A collection of geospatial tools primarily designed for WGS84, Web Mercator, and S2.", "type": "module", "keywords": [ diff --git a/src/converters/toJSON/index.ts b/src/converters/toJSON/index.ts index 92fb6bf9..69aac4c8 100644 --- a/src/converters/toJSON/index.ts +++ b/src/converters/toJSON/index.ts @@ -1,7 +1,7 @@ import { convert } from '../../geometry/convert'; import { mergeBBoxes } from '../../geometry'; -import type { FeatureIterator } from 's2-tools/readers'; +import type { FeatureIterator } from '../../readers'; import type { Writer } from '../../writers'; import type { BBOX, Projection, VectorFeatures } from '../../geometry'; diff --git a/src/dataStructures/pointCluster.ts b/src/dataStructures/pointCluster.ts index 66402ba2..3202b134 100644 --- a/src/dataStructures/pointCluster.ts +++ b/src/dataStructures/pointCluster.ts @@ -1,6 +1,6 @@ import { Tile } from '../dataStructures'; import { convert } from '../geometry/convert'; -import { fromS2Points } from 's2-tools/geometry/s1/chordAngle'; +import { fromS2Points } from '../geometry/s1/chordAngle'; import { PointShape as Point, PointIndex } from './pointIndex'; import { addMut, diff --git a/src/proj4/datum.ts b/src/proj4/datum.ts index 05e6f438..cf65e9fe 100644 --- a/src/proj4/datum.ts +++ b/src/proj4/datum.ts @@ -13,9 +13,9 @@ import { SRS_WGS84_SEMIMINOR, } from './constants'; -import type { DatumParams } from 's2-tools/readers/wkt'; -import type { NadSubGrid } from 's2-tools/readers/nadgrid'; -import type { VectorPoint } from 's2-tools/geometry'; +import type { DatumParams } from '../readers/wkt'; +import type { NadSubGrid } from '../readers/nadgrid'; +import type { VectorPoint } from '../geometry'; import type { ProjectionParams, ProjectionTransform, Transformer } from '.'; const { abs, sin, cos, sqrt, atan2, atan, PI, floor } = Math; diff --git a/src/proj4/parseCode.ts b/src/proj4/parseCode.ts index 1d16322c..5cbb8ec9 100644 --- a/src/proj4/parseCode.ts +++ b/src/proj4/parseCode.ts @@ -7,9 +7,9 @@ import { deriveEccentricity, deriveSphere, } from './constants'; -import { isWKTProjection, parseWKTProjection } from 's2-tools/readers/wkt'; +import { isWKTProjection, parseWKTProjection } from '../readers/wkt'; -import type { DatumParams } from 's2-tools/readers/wkt'; +import type { DatumParams } from '../readers/wkt'; import type { ProjectionParams } from './projections'; import type { Transformer } from './transformer'; diff --git a/src/proj4/projections/aea.ts b/src/proj4/projections/aea.ts index 2a830f60..211117f9 100644 --- a/src/proj4/projections/aea.ts +++ b/src/proj4/projections/aea.ts @@ -2,7 +2,7 @@ import { EPSLN } from '../constants'; import { ProjectionBase } from './base'; import { adjustLon, asinz, msfnz, qsfnz } from '../common'; -import type { VectorPoint } from 's2-tools/geometry'; +import type { VectorPoint } from '../../geometry'; import type { ProjectionParams, ProjectionTransform } from '.'; const { abs, pow, sin, cos, sqrt, atan2, asin, log } = Math; diff --git a/src/proj4/projections/aeqd.ts b/src/proj4/projections/aeqd.ts index 390ce1bc..61471a1f 100644 --- a/src/proj4/projections/aeqd.ts +++ b/src/proj4/projections/aeqd.ts @@ -2,7 +2,7 @@ import { ProjectionBase } from './base'; import { EPSLN, HALF_PI } from '../constants'; import { adjustLon, asinz, e0fn, e1fn, e2fn, e3fn, gN, imlfn, mlfn } from '../common'; -import type { VectorPoint } from 's2-tools/geometry'; +import type { VectorPoint } from '../../geometry'; import type { ProjectionParams, ProjectionTransform } from '.'; const { abs, pow, sin, cos, sqrt, atan2, asin, acos, PI, tan, atan } = Math; diff --git a/src/proj4/projections/base.ts b/src/proj4/projections/base.ts index d8b25bfb..adedf25f 100644 --- a/src/proj4/projections/base.ts +++ b/src/proj4/projections/base.ts @@ -1,9 +1,9 @@ import { D2R, PJD_NODATUM, R2D } from '../constants'; -import type { DatumParams } from 's2-tools/readers/wkt'; -import type { GridDefinition } from 's2-tools/readers/nadgrid'; +import type { DatumParams } from '../../readers/wkt'; +import type { GridDefinition } from '../../readers/nadgrid'; import type { ProjectionTransform } from '.'; -import type { VectorPoint } from 's2-tools/geometry'; +import type { VectorPoint } from '../../geometry'; /** Define the projection with all it's variable components */ export interface ProjectionParams { diff --git a/src/proj4/projections/bonne.ts b/src/proj4/projections/bonne.ts index 412b1d6a..d536839b 100644 --- a/src/proj4/projections/bonne.ts +++ b/src/proj4/projections/bonne.ts @@ -3,7 +3,7 @@ import { ProjectionBase } from './base'; import { adjustLat, adjustLon, hypot, pjEnfn, pjInvMlfn, pjMlfn } from '../common'; import type { En } from '../common'; -import type { VectorPoint } from 's2-tools/geometry'; +import type { VectorPoint } from '../../geometry'; import type { ProjectionParams, ProjectionTransform } from '.'; const EPS10 = 1e-10; diff --git a/src/proj4/projections/cass.ts b/src/proj4/projections/cass.ts index 8ac7873b..b8a8d8fc 100644 --- a/src/proj4/projections/cass.ts +++ b/src/proj4/projections/cass.ts @@ -2,7 +2,7 @@ import { ProjectionBase } from './base'; import { EPSLN, HALF_PI } from '../constants'; import { adjustLat, adjustLon, e0fn, e1fn, e2fn, e3fn, gN, imlfn, mlfn } from '../common'; -import type { VectorPoint } from 's2-tools/geometry'; +import type { VectorPoint } from '../../geometry'; import type { ProjectionParams, ProjectionTransform } from '.'; const { abs, sin, cos, asin, atan2, tan, pow } = Math; diff --git a/src/proj4/projections/cea.ts b/src/proj4/projections/cea.ts index 883028c4..d0c57550 100644 --- a/src/proj4/projections/cea.ts +++ b/src/proj4/projections/cea.ts @@ -1,7 +1,7 @@ import { ProjectionBase } from './base'; import { adjustLon, iqsfnz, msfnz, qsfnz } from '../common'; -import type { VectorPoint } from 's2-tools/geometry'; +import type { VectorPoint } from '../../geometry'; import type { ProjectionParams, ProjectionTransform } from '.'; const { sin, cos, asin } = Math; diff --git a/src/proj4/projections/eqc.ts b/src/proj4/projections/eqc.ts index e14f20a5..29cfcd3c 100644 --- a/src/proj4/projections/eqc.ts +++ b/src/proj4/projections/eqc.ts @@ -1,7 +1,7 @@ import { ProjectionBase } from '.'; import { adjustLat, adjustLon } from '../common'; -import type { VectorPoint } from 's2-tools/geometry'; +import type { VectorPoint } from '../../geometry'; import type { ProjectionParams, ProjectionTransform } from '.'; /** diff --git a/src/proj4/projections/eqdc.ts b/src/proj4/projections/eqdc.ts index ffa05155..f277831d 100644 --- a/src/proj4/projections/eqdc.ts +++ b/src/proj4/projections/eqdc.ts @@ -2,7 +2,7 @@ import { EPSLN } from '../constants'; import { ProjectionBase } from '.'; import { adjustLat, adjustLon, e0fn, e1fn, e2fn, e3fn, imlfn, mlfn, msfnz } from '../common'; -import type { VectorPoint } from 's2-tools/geometry'; +import type { VectorPoint } from '../../geometry'; import type { ProjectionParams, ProjectionTransform } from '.'; const { abs, sin, cos, sqrt, atan2 } = Math; diff --git a/src/proj4/projections/eqearth.ts b/src/proj4/projections/eqearth.ts index 8d3ae5af..9d7340a0 100644 --- a/src/proj4/projections/eqearth.ts +++ b/src/proj4/projections/eqearth.ts @@ -30,7 +30,7 @@ import { ProjectionBase } from '.'; import { adjustLon } from '../common'; -import type { VectorPoint } from 's2-tools/geometry'; +import type { VectorPoint } from '../../geometry'; import type { ProjectionParams, ProjectionTransform } from '.'; const { abs, sin, cos, sqrt, asin } = Math; diff --git a/src/proj4/projections/equi.ts b/src/proj4/projections/equi.ts index 5fc903b1..d823ebbf 100644 --- a/src/proj4/projections/equi.ts +++ b/src/proj4/projections/equi.ts @@ -1,7 +1,7 @@ import { ProjectionBase } from '.'; import { adjustLon } from '../common'; -import type { VectorPoint } from 's2-tools/geometry'; +import type { VectorPoint } from '../../geometry'; import type { ProjectionParams, ProjectionTransform } from '.'; /** diff --git a/src/proj4/projections/etmerc.ts b/src/proj4/projections/etmerc.ts index 074e1518..f48d49a6 100644 --- a/src/proj4/projections/etmerc.ts +++ b/src/proj4/projections/etmerc.ts @@ -4,7 +4,7 @@ import { TransverseMercator } from './tmerc'; import { adjustLon, asinhy, clens, clensCmplx, gatg, hypot, sinh } from '../common'; -import type { VectorPoint } from 's2-tools/geometry'; +import type { VectorPoint } from '../../geometry'; import type { ProjectionParams, ProjectionTransform } from '.'; const { abs, pow, sin, cos, sqrt, atan2, tan, atan } = Math; diff --git a/src/proj4/projections/gauss.ts b/src/proj4/projections/gauss.ts index d2ce9d3b..90ceae61 100644 --- a/src/proj4/projections/gauss.ts +++ b/src/proj4/projections/gauss.ts @@ -2,7 +2,7 @@ import { ProjectionBase } from '.'; import { srat } from '../common'; import { HALF_PI, QUART_PI } from '../constants'; -import type { VectorPoint } from 's2-tools/geometry'; +import type { VectorPoint } from '../../geometry'; import type { ProjectionParams, ProjectionTransform } from '.'; const { abs, pow, sin, cos, sqrt, asin, tan, atan } = Math; diff --git a/src/proj4/projections/geocent.ts b/src/proj4/projections/geocent.ts index 1456af09..740031f1 100644 --- a/src/proj4/projections/geocent.ts +++ b/src/proj4/projections/geocent.ts @@ -1,7 +1,7 @@ import { ProjectionBase } from '.'; import { geocentricToGeodetic, geodeticToGeocentric } from '../datum'; -import type { VectorPoint } from 's2-tools/geometry'; +import type { VectorPoint } from '../../geometry'; import type { ProjectionParams, ProjectionTransform } from '.'; /** Geocentric Projection */ diff --git a/src/proj4/projections/geos.ts b/src/proj4/projections/geos.ts index b8e1bdb0..77ae41ee 100644 --- a/src/proj4/projections/geos.ts +++ b/src/proj4/projections/geos.ts @@ -1,7 +1,7 @@ import { ProjectionBase } from '.'; import { hypot } from '../common'; -import type { VectorPoint } from 's2-tools/geometry'; +import type { VectorPoint } from '../../geometry'; import type { ProjectionParams, ProjectionTransform } from '.'; const { sin, cos, sqrt, tan, atan, atan2 } = Math; diff --git a/src/proj4/projections/gnom.ts b/src/proj4/projections/gnom.ts index 6afbc8e7..ae696df4 100644 --- a/src/proj4/projections/gnom.ts +++ b/src/proj4/projections/gnom.ts @@ -2,7 +2,7 @@ import { EPSLN } from '../constants'; import { ProjectionBase } from '.'; import { adjustLon, asinz } from '../common'; -import type { VectorPoint } from 's2-tools/geometry'; +import type { VectorPoint } from '../../geometry'; import type { ProjectionParams, ProjectionTransform } from '.'; const { abs, sin, cos, sqrt, atan2 } = Math; diff --git a/src/proj4/projections/gstmerc.ts b/src/proj4/projections/gstmerc.ts index 1a66e155..af62f256 100644 --- a/src/proj4/projections/gstmerc.ts +++ b/src/proj4/projections/gstmerc.ts @@ -1,7 +1,7 @@ import { ProjectionBase } from '.'; import { cosh, invlatiso, latiso, sinh } from '../common'; -import type { VectorPoint } from 's2-tools/geometry'; +import type { VectorPoint } from '../../geometry'; import type { ProjectionParams, ProjectionTransform } from '.'; const { pow, sin, cos, sqrt, atan, asin } = Math; diff --git a/src/proj4/projections/index.ts b/src/proj4/projections/index.ts index 6daf6f95..22cef98f 100644 --- a/src/proj4/projections/index.ts +++ b/src/proj4/projections/index.ts @@ -36,8 +36,8 @@ import { VanDerGrinten } from './vandg'; import { ProjectionBase } from './base'; -import type { DatumParams } from 's2-tools/readers/wkt'; -import type { GridDefinition } from 's2-tools/readers/nadgrid'; +import type { DatumParams } from '../../readers/wkt'; +import type { GridDefinition } from '../../readers/nadgrid'; import type { VectorPoint } from 's2json-spec'; export * from './aea'; diff --git a/src/proj4/projections/krovak.ts b/src/proj4/projections/krovak.ts index 8ade45ab..3e419efa 100644 --- a/src/proj4/projections/krovak.ts +++ b/src/proj4/projections/krovak.ts @@ -1,7 +1,7 @@ import { ProjectionBase } from '.'; import { adjustLon } from '../common'; -import type { VectorPoint } from 's2-tools/geometry'; +import type { VectorPoint } from '../../geometry'; import type { ProjectionParams, ProjectionTransform } from '.'; const { abs, pow, sin, cos, sqrt, atan2, asin, tan, atan } = Math; diff --git a/src/proj4/projections/laea.ts b/src/proj4/projections/laea.ts index adf34163..149cb7e5 100644 --- a/src/proj4/projections/laea.ts +++ b/src/proj4/projections/laea.ts @@ -2,7 +2,7 @@ import { ProjectionBase } from '.'; import { EPSLN, HALF_PI, QUART_PI } from '../constants'; import { adjustLon, qsfnz } from '../common'; -import type { VectorPoint } from 's2-tools/geometry'; +import type { VectorPoint } from '../../geometry'; import type { ProjectionParams, ProjectionTransform } from '.'; export const S_POLE = 1; diff --git a/src/proj4/projections/lcc.ts b/src/proj4/projections/lcc.ts index 1d62d67d..ec09c8be 100644 --- a/src/proj4/projections/lcc.ts +++ b/src/proj4/projections/lcc.ts @@ -2,7 +2,7 @@ import { ProjectionBase } from '.'; import { EPSLN, HALF_PI } from '../constants'; import { adjustLon, msfnz, phi2z, sign, tsfnz } from '../common'; -import type { VectorPoint } from 's2-tools/geometry'; +import type { VectorPoint } from '../../geometry'; import type { ProjectionParams, ProjectionTransform } from '.'; const { abs, pow, sin, cos, sqrt, atan2, log, PI } = Math; diff --git a/src/proj4/projections/merc.ts b/src/proj4/projections/merc.ts index 2b50212c..bc016451 100644 --- a/src/proj4/projections/merc.ts +++ b/src/proj4/projections/merc.ts @@ -2,7 +2,7 @@ import { ProjectionBase } from './base'; import { EPSLN, HALF_PI, QUART_PI } from '../constants'; import { adjustLon, msfnz, phi2z, tsfnz } from '../common'; -import type { VectorPoint } from 's2-tools/geometry'; +import type { VectorPoint } from '../../geometry'; import type { ProjectionParams, ProjectionTransform } from '.'; const { abs, sin, cos, sqrt, log, tan, atan, exp } = Math; diff --git a/src/proj4/projections/mill.ts b/src/proj4/projections/mill.ts index bf2f0f9c..9b893923 100644 --- a/src/proj4/projections/mill.ts +++ b/src/proj4/projections/mill.ts @@ -1,7 +1,7 @@ import { ProjectionBase } from '.'; import { adjustLon } from '../common'; -import type { VectorPoint } from 's2-tools/geometry'; +import type { VectorPoint } from '../../geometry'; import type { ProjectionParams, ProjectionTransform } from '.'; const { tan, atan, PI, log, exp } = Math; diff --git a/src/proj4/projections/moll.ts b/src/proj4/projections/moll.ts index b20073b0..31796c25 100644 --- a/src/proj4/projections/moll.ts +++ b/src/proj4/projections/moll.ts @@ -2,7 +2,7 @@ import { EPSLN } from '../constants'; import { ProjectionBase } from '.'; import { adjustLon } from '../common'; -import type { VectorPoint } from 's2-tools/geometry'; +import type { VectorPoint } from '../../geometry'; import type { ProjectionParams, ProjectionTransform } from '.'; const { abs, PI, sin, cos, asin } = Math; diff --git a/src/proj4/projections/nzmg.ts b/src/proj4/projections/nzmg.ts index b12f9aa0..e10a912a 100644 --- a/src/proj4/projections/nzmg.ts +++ b/src/proj4/projections/nzmg.ts @@ -1,7 +1,7 @@ import { ProjectionBase } from '.'; import { SEC_TO_RAD } from '../constants'; -import type { VectorPoint } from 's2-tools/geometry'; +import type { VectorPoint } from '../../geometry'; import type { ProjectionParams, ProjectionTransform } from '.'; /** diff --git a/src/proj4/projections/omerc.ts b/src/proj4/projections/omerc.ts index 82c7511c..3f9b889a 100644 --- a/src/proj4/projections/omerc.ts +++ b/src/proj4/projections/omerc.ts @@ -2,7 +2,7 @@ import { ProjectionBase } from '.'; import { D2R, EPSLN, HALF_PI, QUART_PI, TWO_PI } from '../constants'; import { adjustLon, phi2z, tsfnz } from '../common'; -import type { VectorPoint } from 's2-tools/geometry'; +import type { VectorPoint } from '../../geometry'; import type { ProjectionParams, ProjectionTransform } from '.'; const { abs, pow, sin, cos, sqrt, atan2, asin, log, atan, PI, tan, exp } = Math; diff --git a/src/proj4/projections/ortho.ts b/src/proj4/projections/ortho.ts index 1cf9fe64..2e95cbef 100644 --- a/src/proj4/projections/ortho.ts +++ b/src/proj4/projections/ortho.ts @@ -2,7 +2,7 @@ import { ProjectionBase } from '.'; import { EPSLN, HALF_PI } from '../constants'; import { adjustLon, asinz } from '../common'; -import type { VectorPoint } from 's2-tools/geometry'; +import type { VectorPoint } from '../../geometry'; import type { ProjectionParams, ProjectionTransform } from '.'; const { abs, sin, cos, sqrt, atan2 } = Math; diff --git a/src/proj4/projections/poly.ts b/src/proj4/projections/poly.ts index a0369fce..bb83b171 100644 --- a/src/proj4/projections/poly.ts +++ b/src/proj4/projections/poly.ts @@ -2,7 +2,7 @@ import { EPSLN } from '../constants'; import { ProjectionBase } from '.'; import { adjustLat, adjustLon, e0fn, e1fn, e2fn, e3fn, gN, mlfn } from '../common'; -import type { VectorPoint } from 's2-tools/geometry'; +import type { VectorPoint } from '../../geometry'; import type { ProjectionParams, ProjectionTransform } from '.'; const { abs, pow, sin, cos, sqrt, asin, tan } = Math; diff --git a/src/proj4/projections/qsc.ts b/src/proj4/projections/qsc.ts index 040ae1ec..953a92b0 100644 --- a/src/proj4/projections/qsc.ts +++ b/src/proj4/projections/qsc.ts @@ -1,7 +1,7 @@ import { ProjectionBase } from '.'; import { EPSLN, HALF_PI, QUART_PI, SPI, TWO_PI } from '../constants'; -import type { VectorPoint } from 's2-tools/geometry'; +import type { VectorPoint } from '../../geometry'; import type { ProjectionParams, ProjectionTransform } from '.'; const { abs, sin, cos, sqrt, atan2, atan, tan, acos } = Math; diff --git a/src/proj4/projections/robin.ts b/src/proj4/projections/robin.ts index 95829174..9a0edbbc 100644 --- a/src/proj4/projections/robin.ts +++ b/src/proj4/projections/robin.ts @@ -2,7 +2,7 @@ import { ProjectionBase } from '.'; import { adjustLon } from '../common'; import { D2R, EPSLN, HALF_PI, R2D } from '../constants'; -import type { VectorPoint } from 's2-tools/geometry'; +import type { VectorPoint } from '../../geometry'; import type { ProjectionParams, ProjectionTransform } from '.'; const { abs, floor } = Math; diff --git a/src/proj4/projections/sinu.ts b/src/proj4/projections/sinu.ts index bde82f37..1206cfbf 100644 --- a/src/proj4/projections/sinu.ts +++ b/src/proj4/projections/sinu.ts @@ -3,7 +3,7 @@ import { EPSLN, HALF_PI } from '../constants'; import { adjustLat, adjustLon, asinz, pjEnfn, pjInvMlfn, pjMlfn } from '../common'; import type { En } from '../common'; -import type { VectorPoint } from 's2-tools/geometry'; +import type { VectorPoint } from '../../geometry'; import type { ProjectionParams, ProjectionTransform } from '.'; const { abs, sin, cos, sqrt, asin } = Math; diff --git a/src/proj4/projections/somerc.ts b/src/proj4/projections/somerc.ts index 2418402a..7b894c8f 100644 --- a/src/proj4/projections/somerc.ts +++ b/src/proj4/projections/somerc.ts @@ -1,6 +1,6 @@ import { ProjectionBase } from '.'; -import type { VectorPoint } from 's2-tools/geometry'; +import type { VectorPoint } from '../../geometry'; import type { ProjectionParams, ProjectionTransform } from '.'; const { abs, pow, sin, cos, sqrt, asin, atan, exp, log, tan, PI } = Math; diff --git a/src/proj4/projections/stere.ts b/src/proj4/projections/stere.ts index 95554ea4..e758dd57 100644 --- a/src/proj4/projections/stere.ts +++ b/src/proj4/projections/stere.ts @@ -2,7 +2,7 @@ import { ProjectionBase } from '.'; import { EPSLN, HALF_PI } from '../constants'; import { adjustLon, msfnz, phi2z, sign, tsfnz } from '../common'; -import type { VectorPoint } from 's2-tools/geometry'; +import type { VectorPoint } from '../../geometry'; import type { ProjectionParams, ProjectionTransform } from '.'; const { abs, pow, sin, cos, sqrt, atan2, asin, tan, atan, PI } = Math; diff --git a/src/proj4/projections/sterea.ts b/src/proj4/projections/sterea.ts index ba59b2df..cfeb1423 100644 --- a/src/proj4/projections/sterea.ts +++ b/src/proj4/projections/sterea.ts @@ -1,7 +1,7 @@ import { GaussKruger } from './gauss'; import { adjustLon, hypot } from '../common'; -import type { VectorPoint } from 's2-tools/geometry'; +import type { VectorPoint } from '../../geometry'; import type { ProjectionParams, ProjectionTransform } from '.'; const { sin, cos, atan2, asin } = Math; diff --git a/src/proj4/projections/tmerc.ts b/src/proj4/projections/tmerc.ts index 23f878e8..455684a3 100644 --- a/src/proj4/projections/tmerc.ts +++ b/src/proj4/projections/tmerc.ts @@ -6,7 +6,7 @@ import { EPSLN, HALF_PI } from '../constants'; import { adjustLon, pjEnfn, pjInvMlfn, pjMlfn, sign } from '../common'; import type { En } from '../common'; -import type { VectorPoint } from 's2-tools/geometry'; +import type { VectorPoint } from '../../geometry'; import type { ProjectionParams, ProjectionTransform } from '.'; const { abs, pow, sin, cos, sqrt, atan2, asin, log, tan, acos, exp } = Math; diff --git a/src/proj4/projections/tpers.ts b/src/proj4/projections/tpers.ts index b340efa4..db637244 100644 --- a/src/proj4/projections/tpers.ts +++ b/src/proj4/projections/tpers.ts @@ -2,7 +2,7 @@ import { ProjectionBase } from '.'; import { hypot } from '../common'; import { D2R, EPSLN, HALF_PI } from '../constants'; -import type { VectorPoint } from 's2-tools/geometry'; +import type { VectorPoint } from '../../geometry'; import type { ProjectionParams, ProjectionTransform } from '.'; const { abs, sin, cos, sqrt, atan2, asin } = Math; diff --git a/src/proj4/projections/vandg.ts b/src/proj4/projections/vandg.ts index f23d6400..75cbc1c8 100644 --- a/src/proj4/projections/vandg.ts +++ b/src/proj4/projections/vandg.ts @@ -2,7 +2,7 @@ import { ProjectionBase } from '.'; import { EPSLN, HALF_PI } from '../constants'; import { adjustLon, asinz } from '../common'; -import type { VectorPoint } from 's2-tools/geometry'; +import type { VectorPoint } from '../../geometry'; import type { ProjectionParams, ProjectionTransform } from '.'; const { abs, PI, sin, cos, sqrt, tan, acos } = Math; diff --git a/src/proj4/transformer.ts b/src/proj4/transformer.ts index b1aa2216..61de01b6 100644 --- a/src/proj4/transformer.ts +++ b/src/proj4/transformer.ts @@ -4,7 +4,7 @@ import { parseProj } from './parseCode'; import { ALL_DEFINITIONS, DEFAULT_DEFINITIONS, WGS84 } from './projections'; import { checkNotWGS, datumTransform } from './datum'; -import type { VectorPoint } from 's2-tools/geometry'; +import type { VectorPoint } from '../geometry'; import type { ProjectionParams, ProjectionTransform, diff --git a/src/readers/csv/index.ts b/src/readers/csv/index.ts index 4fb0766b..13c79dff 100644 --- a/src/readers/csv/index.ts +++ b/src/readers/csv/index.ts @@ -1,5 +1,5 @@ import type { FeatureIterator, Reader } from '..'; -import type { Properties, VectorFeature, VectorPoint } from 's2-tools/geometry'; +import type { Properties, VectorFeature, VectorPoint } from '../../geometry'; /** User defined options on how to parse the CSV file */ export interface CSVReaderOptions { diff --git a/src/readers/geotiff/decoder.ts b/src/readers/geotiff/decoder.ts index 78dc286b..b938e312 100644 --- a/src/readers/geotiff/decoder.ts +++ b/src/readers/geotiff/decoder.ts @@ -1,5 +1,5 @@ import { jpegDecoder } from './jpeg'; -import { decompressStream, lzwDecoder } from 's2-tools/util'; +import { decompressStream, lzwDecoder } from '../../util'; /** What to expect from the decoder */ export type Decoder = diff --git a/src/readers/geotiff/image.ts b/src/readers/geotiff/image.ts index 20a952b1..48a503b0 100644 --- a/src/readers/geotiff/image.ts +++ b/src/readers/geotiff/image.ts @@ -12,7 +12,7 @@ import type { VectorMultiPoint, VectorMultiPointGeometry, VectorPoint, -} from 's2-tools/geometry'; +} from '../../geometry'; /** Metadata for a GeoTIFF image */ export interface GeoTIFFMetadata { diff --git a/src/readers/geotiff/index.ts b/src/readers/geotiff/index.ts index c3ede805..79febcc9 100644 --- a/src/readers/geotiff/index.ts +++ b/src/readers/geotiff/index.ts @@ -5,7 +5,7 @@ import { GeoTIFFImage } from './image'; import type { Reader } from '..'; import type { GeoTIFFMetadata, RGBA } from './image'; -import type { Properties, VectorFeature, VectorMultiPointGeometry } from 's2-tools/geometry'; +import type { Properties, VectorFeature, VectorMultiPointGeometry } from '../../geometry'; export * from './color'; export * from './constants'; diff --git a/src/readers/json/index.ts b/src/readers/json/index.ts index b5441c4d..95517bc4 100644 --- a/src/readers/json/index.ts +++ b/src/readers/json/index.ts @@ -1,5 +1,5 @@ import type { FeatureIterator, Reader } from '..'; -import type { Features, JSONCollection } from 's2-tools/geometry'; +import type { Features, JSONCollection } from '../../geometry'; /** Standard Buffer Reader for (Geo|S2)JSON */ export class BufferJSONReader implements FeatureIterator { diff --git a/src/readers/nadgrid.ts b/src/readers/nadgrid.ts index 926f3409..8e5b49a9 100644 --- a/src/readers/nadgrid.ts +++ b/src/readers/nadgrid.ts @@ -1,11 +1,6 @@ import type { Reader } from '.'; -import type { - FeatureCollection, - VectorFeature, - VectorMultiPoint, - VectorPoint, -} from 's2-tools/geometry'; +import type { FeatureCollection, VectorFeature, VectorMultiPoint, VectorPoint } from '../geometry'; /** * Resources for details of NTv2 file formats: diff --git a/src/readers/osm/blob.ts b/src/readers/osm/blob.ts index ca007d4e..44b74c76 100644 --- a/src/readers/osm/blob.ts +++ b/src/readers/osm/blob.ts @@ -1,6 +1,6 @@ -import { decompressStream } from 's2-tools/util'; +import { decompressStream } from '../../util'; -import type { Pbf as Protobuf } from 's2-tools/readers/protobuf'; +import type { Pbf as Protobuf } from '../../readers/protobuf'; export const MAX_HEADER_SIZE = 64 * 1024; diff --git a/src/readers/osm/headerBlock.ts b/src/readers/osm/headerBlock.ts index 71bc9115..651ae3bd 100644 --- a/src/readers/osm/headerBlock.ts +++ b/src/readers/osm/headerBlock.ts @@ -1,4 +1,4 @@ -import type { BBox } from 's2-tools/geometry'; +import type { BBox } from '../../geometry'; import type { Pbf as Protobuf } from '../protobuf'; /** OSM Header Block */ diff --git a/src/readers/osm/index.ts b/src/readers/osm/index.ts index b55ede66..b86e7261 100644 --- a/src/readers/osm/index.ts +++ b/src/readers/osm/index.ts @@ -1,7 +1,7 @@ import { HeaderBlock } from './headerBlock'; -import { KV } from 's2-tools/dataStore'; +import { KV } from '../../dataStore'; import { PrimitiveBlock } from './primitive'; -import { Pbf as Protobuf } from 's2-tools/readers/protobuf'; +import { Pbf as Protobuf } from '../../readers/protobuf'; import { intermediateRelationToVectorFeature } from './relation'; import { intermediateWayToVectorFeature } from './way'; import { mergeRelationIfExists } from './node'; @@ -13,8 +13,8 @@ import type { OSMHeader } from './headerBlock'; import type { FeatureIterator, Reader } from '..'; import type { IntermediateNodeMember, IntermediateRelation } from './relation'; import type { IntermediateWay, WayNodes } from './way'; -import type { KVStore, KVStoreConstructor } from 's2-tools/dataStore'; -import type { VectorFeature, VectorPoint } from 's2-tools/geometry'; +import type { KVStore, KVStoreConstructor } from '../../dataStore'; +import type { VectorFeature, VectorPoint } from '../../geometry'; export type * from './blob'; export type * from './headerBlock'; diff --git a/src/readers/osm/info.ts b/src/readers/osm/info.ts index 70e2f516..bdce956b 100644 --- a/src/readers/osm/info.ts +++ b/src/readers/osm/info.ts @@ -1,5 +1,5 @@ import type { PrimitiveBlock } from './primitive'; -import type { Pbf as Protobuf } from 's2-tools/readers/protobuf'; +import type { Pbf as Protobuf } from '../../readers/protobuf'; /** * diff --git a/src/readers/osm/node.ts b/src/readers/osm/node.ts index 7c053353..da6e6935 100644 --- a/src/readers/osm/node.ts +++ b/src/readers/osm/node.ts @@ -1,13 +1,13 @@ import { intermediateRelationToVectorFeature } from './relation'; -import { mergeBBoxes } from 's2-tools/geometry'; +import { mergeBBoxes } from '../../geometry'; import { DenseInfo, Info } from './info'; import type { OSMReader } from '.'; import type { PrimitiveBlock } from './primitive'; -import type { Pbf as Protobuf } from 's2-tools/readers/protobuf'; +import type { Pbf as Protobuf } from '../../readers/protobuf'; import type { Metadata } from './primitive'; -import type { BBox, VectorFeature, VectorPoint } from 's2-tools/geometry'; +import type { BBox, VectorFeature, VectorPoint } from '../../geometry'; /** * @param feature diff --git a/src/readers/osm/primitive.ts b/src/readers/osm/primitive.ts index b9771b09..309d7099 100644 --- a/src/readers/osm/primitive.ts +++ b/src/readers/osm/primitive.ts @@ -3,7 +3,7 @@ import { DenseNodes, Node } from './node'; import { Relation, getNodeRelationPairs } from './relation'; import type { IntermediateNodeMember } from './relation'; -import type { Pbf as Protobuf } from 's2-tools/readers/protobuf'; +import type { Pbf as Protobuf } from '../../readers/protobuf'; import type { InfoBlock, OSMReader } from '.'; /** The expected metadata in the VectorFeature for all types (node, way, relation) */ diff --git a/src/readers/osm/relation.ts b/src/readers/osm/relation.ts index b3e99016..01a5b021 100644 --- a/src/readers/osm/relation.ts +++ b/src/readers/osm/relation.ts @@ -1,8 +1,8 @@ import { Info, InfoBlock } from './info'; -import { fromMultiLineString, fromMultiPolygon } from 's2-tools/geometry'; +import { fromMultiLineString, fromMultiPolygon } from '../../geometry'; import type { OSMReader } from '.'; -import type { Pbf as Protobuf } from 's2-tools/readers/protobuf'; +import type { Pbf as Protobuf } from '../../readers/protobuf'; import type { Metadata, PrimitiveBlock } from './primitive'; import type { @@ -14,7 +14,7 @@ import type { VectorMultiPolygon, VectorPoint, VectorPolygon, -} from 's2-tools/geometry'; +} from '../../geometry'; /** An intermediate vector feature where the ways and nodes haven't been resolved yet. */ export interface IntermediateRelation { diff --git a/src/readers/osm/way.ts b/src/readers/osm/way.ts index 7851c207..f567dca9 100644 --- a/src/readers/osm/way.ts +++ b/src/readers/osm/way.ts @@ -1,9 +1,9 @@ import { Info } from './info'; -import { extendBBox } from 's2-tools/geometry'; +import { extendBBox } from '../../geometry'; import type { Metadata } from './primitive'; import type { PrimitiveBlock } from './primitive'; -import type { Pbf as Protobuf } from 's2-tools/readers/protobuf'; +import type { Pbf as Protobuf } from '../../readers/protobuf'; import type { InfoBlock, OSMReader } from '.'; import type { @@ -12,7 +12,7 @@ import type { VectorFeature, VectorGeometry, VectorLineString, -} from 's2-tools/geometry'; +} from '../../geometry'; /** Linebased node reference store */ export type WayNodes = number[]; diff --git a/src/readers/pmtiles/pmtiles.ts b/src/readers/pmtiles/pmtiles.ts index 9818a502..1cb69a6e 100644 --- a/src/readers/pmtiles/pmtiles.ts +++ b/src/readers/pmtiles/pmtiles.ts @@ -1,6 +1,6 @@ import { readVarint } from './varint'; -import type { Point } from 's2-tools/geometry'; +import type { Point } from '../../geometry'; /** A tile, in the format of ZXY. */ export type FlatTile = [zoom: number, x: number, y: number]; diff --git a/src/readers/shapefile/dbf.ts b/src/readers/shapefile/dbf.ts index 7dd295f7..4a1a9584 100644 --- a/src/readers/shapefile/dbf.ts +++ b/src/readers/shapefile/dbf.ts @@ -1,4 +1,4 @@ -import type { Properties } from 's2-tools/geometry'; +import type { Properties } from '../../geometry'; import type { Reader } from '..'; /** The Header data explaining the contents of the DBF file */ diff --git a/src/readers/shapefile/file.ts b/src/readers/shapefile/file.ts index d05acf52..57de8b6e 100644 --- a/src/readers/shapefile/file.ts +++ b/src/readers/shapefile/file.ts @@ -1,11 +1,11 @@ import DataBaseFile from './dbf'; import FileReader from '../file'; import Shapefile from './shp'; -import { Transformer } from 's2-tools/proj4'; +import { Transformer } from '../../proj4'; import { fromGzip } from '.'; import { exists, readFile } from 'fs/promises'; -import type { ProjectionTransformDefinition } from 's2-tools/proj4'; +import type { ProjectionTransformDefinition } from '../../proj4'; export * from './dbf'; export * from './shp'; diff --git a/src/readers/shapefile/index.ts b/src/readers/shapefile/index.ts index f12bd224..ee130d35 100644 --- a/src/readers/shapefile/index.ts +++ b/src/readers/shapefile/index.ts @@ -1,10 +1,10 @@ import { BufferReader } from '..'; import DataBaseFile from './dbf'; import ShapeFile from './shp'; -import { Transformer } from 's2-tools/proj4'; -import { iterItems } from 's2-tools/util'; +import { Transformer } from '../../proj4'; +import { iterItems } from '../../util'; -import type { ProjectionTransformDefinition } from 's2-tools/proj4'; +import type { ProjectionTransformDefinition } from '../../proj4'; export { default as DataBaseFile } from './dbf'; export { default as ShapeFile } from './shp'; diff --git a/src/readers/shapefile/mmap.ts b/src/readers/shapefile/mmap.ts index 313d01dc..c850ff46 100644 --- a/src/readers/shapefile/mmap.ts +++ b/src/readers/shapefile/mmap.ts @@ -1,7 +1,7 @@ import DataBaseFile from './dbf'; import MMapReader from '../mmap'; import Shapefile from './shp'; -import { Transformer } from 's2-tools/proj4'; +import { Transformer } from '../../proj4'; import { exists, readFile } from 'fs/promises'; export * from './dbf'; diff --git a/src/readers/shapefile/shp.ts b/src/readers/shapefile/shp.ts index 5a802a09..51c2888d 100644 --- a/src/readers/shapefile/shp.ts +++ b/src/readers/shapefile/shp.ts @@ -1,8 +1,8 @@ // Implements https://www.esri.com/content/dam/esrisites/sitecore-archive/Files/Pdfs/library/whitepapers/pdfs/shapefile.pdf -import { extendBBox } from 's2-tools/geometry'; +import { extendBBox } from '../../geometry'; import type DataBaseFile from './dbf'; -import type { Transformer } from 's2-tools/proj4'; +import type { Transformer } from '../../proj4'; import type { BBOX, BBox3D, @@ -18,7 +18,7 @@ import type { VectorPoint, VectorPointGeometry, VectorPolygonGeometry, -} from 's2-tools/geometry'; +} from '../../geometry'; import type { FeatureIterator, Reader } from '..'; /** A Shapefile Header describing the internal data */ diff --git a/src/readers/wkt/geometry.ts b/src/readers/wkt/geometry.ts index 93ba108c..8495c5a5 100644 --- a/src/readers/wkt/geometry.ts +++ b/src/readers/wkt/geometry.ts @@ -7,7 +7,7 @@ import type { VectorMultiPolygon, VectorPoint, VectorPointGeometry, -} from 's2-tools/geometry'; +} from '../../geometry'; /** * diff --git a/src/readers/wkt/projection.ts b/src/readers/wkt/projection.ts index 3d7c8bbc..621f7cce 100644 --- a/src/readers/wkt/projection.ts +++ b/src/readers/wkt/projection.ts @@ -1,7 +1,7 @@ import { degToRad } from '../../geometry'; import { parseWKTObject } from '.'; -import type { ProjectionParams } from 's2-tools/proj4'; +import type { ProjectionParams } from '../../proj4'; import type { WKTObject, WKTValue } from '.'; /** diff --git a/src/tools/delaunator.ts b/src/tools/delaunator.ts index 7e606f18..b50fb293 100644 --- a/src/tools/delaunator.ts +++ b/src/tools/delaunator.ts @@ -1,6 +1,6 @@ import { incirclefast, orient2d } from '../geometry/predicates'; -import type { Point, VectorPoint } from 's2-tools/geometry'; +import type { Point, VectorPoint } from '../geometry'; const EPSILON = Math.pow(2, -52); diff --git a/src/writers/pmtiles/pmtiles.ts b/src/writers/pmtiles/pmtiles.ts index 3fe408e9..499912e8 100644 --- a/src/writers/pmtiles/pmtiles.ts +++ b/src/writers/pmtiles/pmtiles.ts @@ -1,7 +1,7 @@ -import { HEADER_SIZE_BYTES } from 's2-tools/readers/pmtiles'; +import { HEADER_SIZE_BYTES } from '../../readers/pmtiles'; import { writeVarint } from './varint'; -import type { Entry, Header } from 's2-tools/readers/pmtiles'; +import type { Entry, Header } from '../../readers/pmtiles'; /** * @param header - the header object diff --git a/src/writers/pmtiles/s2pmtiles.ts b/src/writers/pmtiles/s2pmtiles.ts index 40ffad78..1b8021de 100644 --- a/src/writers/pmtiles/s2pmtiles.ts +++ b/src/writers/pmtiles/s2pmtiles.ts @@ -1,7 +1,7 @@ -import { S2_HEADER_SIZE_BYTES } from 's2-tools/readers/pmtiles'; +import { S2_HEADER_SIZE_BYTES } from '../../readers/pmtiles'; import { headerToBytes, setUint64 } from './pmtiles'; -import type { S2Header } from 's2-tools/readers/pmtiles'; +import type { S2Header } from '../../readers/pmtiles'; /** * @param header - the header object diff --git a/src/writers/pmtiles/varint.ts b/src/writers/pmtiles/varint.ts index 6c1375f6..25317491 100644 --- a/src/writers/pmtiles/varint.ts +++ b/src/writers/pmtiles/varint.ts @@ -1,4 +1,4 @@ -import type { VarintBufPos } from 's2-tools/readers/pmtiles'; +import type { VarintBufPos } from '../../readers/pmtiles'; /** * Write a varint. Can be max 64-bits. Numbers are coerced to an unsigned diff --git a/src/writers/pmtiles/writer.ts b/src/writers/pmtiles/writer.ts index 43ebb8a2..1e5fb576 100644 --- a/src/writers/pmtiles/writer.ts +++ b/src/writers/pmtiles/writer.ts @@ -6,10 +6,10 @@ import { S2_HEADER_SIZE_BYTES, S2_ROOT_SIZE, zxyToTileID, -} from 's2-tools/readers/pmtiles'; +} from '../../readers/pmtiles'; import { headerToBytes, serializeDir } from './pmtiles'; -import type { Entry, Header, S2Entries, S2Header, TileType } from 's2-tools/readers/pmtiles'; +import type { Entry, Header, S2Entries, S2Header, TileType } from '../../readers/pmtiles'; import type { Face, Metadata } from 's2-tilejson'; import type { TileWriter, Writer } from '..'; diff --git a/testScript.ts b/testScript.ts deleted file mode 100644 index ee9c9ec9..00000000 --- a/testScript.ts +++ /dev/null @@ -1,83 +0,0 @@ -const numArray: number[] = new Array(1_000_000); -const bigintArray: bigint[] = new Array(1_000_000); -const uint64Array: BigUint64Array = new BigUint64Array(1_000_000); -const float64Array: Float64Array = new Float64Array(1_000_000); - -// Initialize the array with random numbers -for (let i = 0; i < numArray.length; i++) { - numArray[i] = Math.random() * 1_000_000; -} - -// Initialize the array with random BigInts -for (let i = 0; i < bigintArray.length; i++) { - bigintArray[i] = BigInt(Math.floor(Math.random() * 1_000_000)); -} - -// Initialize the array with random BigUint64s -for (let i = 0; i < uint64Array.length; i++) { - uint64Array[i] = BigInt(Math.floor(Math.random() * 1_000_000)); -} - -const firstElement = numArray[0]; -let greaterCount = 0; -let lessCount = 0; - -let start = Bun.nanoseconds(); -// Compare each element with the first element -for (let i = 1; i < numArray.length; i++) { - if (numArray[i] > firstElement) { - greaterCount++; - } else if (numArray[i] < firstElement) { - lessCount++; - } -} -let end = Bun.nanoseconds(); -console.log(`Number: ${(end - start) / 1e6} ms`); - -const firstBigint = bigintArray[0]; -let greaterCountBigint = 0; -let lessCountBigint = 0; - -start = Bun.nanoseconds(); -// Compare each element with the first element -for (let i = 1; i < bigintArray.length; i++) { - if (bigintArray[i] > firstBigint) { - greaterCountBigint++; - } else if (bigintArray[i] < firstBigint) { - lessCountBigint++; - } -} -end = Bun.nanoseconds(); -console.log(`BigInt: ${(end - start) / 1e6} ms`); - -const firstUint64 = uint64Array[0]; -let greaterCountUint64 = 0; -let lessCountUint64 = 0; - -start = Bun.nanoseconds(); -// Compare each element with the first element -for (let i = 1; i < uint64Array.length; i++) { - if (uint64Array[i] > firstUint64) { - greaterCountUint64++; - } else if (uint64Array[i] < firstUint64) { - lessCountUint64++; - } -} -end = Bun.nanoseconds(); -console.log(`Uint64: ${(end - start) / 1e6} ms`); - -const firstFloat64 = float64Array[0]; -let greaterCountFloat64 = 0; -let lessCountFloat64 = 0; - -start = Bun.nanoseconds(); -// Compare each element with the first element -for (let i = 1; i < float64Array.length; i++) { - if (float64Array[i] > firstFloat64) { - greaterCountFloat64++; - } else if (float64Array[i] < firstFloat64) { - lessCountFloat64++; - } -} -end = Bun.nanoseconds(); -console.log(`Float64: ${(end - start) / 1e6} ms`); diff --git a/tmpTests.ts b/tmpTests.ts deleted file mode 100644 index ec257c11..00000000 --- a/tmpTests.ts +++ /dev/null @@ -1,199 +0,0 @@ -import proj4 from './proj4js-master/lib/index'; -// import proj4 from './proj4js-master/dist/proj4-src.js'; -import { Transformer, injectAllDefinitions } from './src/proj4' - -// proj4.defs([ -// ["EPSG:102018", "+proj=gnom +lat_0=90 +lon_0=0 +x_0=6300000 +y_0=6300000 +ellps=WGS84 +datum=WGS84 +units=m +no_defs"], -// ["testmerc", "+proj=merc +lon_0=5.937 +lat_ts=45.027 +ellps=sphere"], -// ["testmerc2", "+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +units=m +k=1.0 +nadgrids=@null +no_defs"] -// ]); -// proj4.defs('esriOnline', 'PROJCS["WGS_1984_Web_Mercator_Auxiliary_Sphere",GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137.0,298.257223563]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Mercator_Auxiliary_Sphere"],PARAMETER["False_Easting",0.0],PARAMETER["False_Northing",0.0],PARAMETER["Central_Meridian",0.0],PARAMETER["Standard_Parallel_1",0.0],PARAMETER["Auxiliary_Sphere_Type",0.0],UNIT["Meter",1.0]]'); -// proj4.defs('testings', 'GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137,298.257223563]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]]') - - - - - - -// const PROJECTION_STRING = '+proj=gstmerc +lon_0=0 +x_0=0 +y_0=0 +R=6371008.7714 +datum=WGS84 +units=m +no_defs' - -// proj4.defs('testings', PROJECTION_STRING) -// const testCase = { -// code: 'testings', -// ll: [-112.50042920000004, 42.036926809999976], -// xy: [-5380950.902080743, -7434667.860047833], -// } -// // const proj = new proj4.Proj(testCase.code); -// // const rsltA = proj4.transform(proj4.WGS84, proj, testCase.ll); -// // const rsltA = proj4.transform(proj, proj4.WGS84, testCase.xy); -// // console.log('OLD: ', rsltA) - -// console.log('\n\n') -// console.log('-----------------------------------------------------------------') -// console.log('\n\n') - -// const transform = new Transformer(); -// injectAllDefinitions(transform); -// transform.setSource(PROJECTION_STRING) -// const rsltB = transform.inverse({ x: testCase.ll[0], y: testCase.ll[1], z: testCase.ll[2] }); -// // const rsltB = transform.forward({ x: testCase.xy[0], y: testCase.xy[1], z: testCase.xy[2] }); -// console.log('NEW: ', rsltB) - -// console.log('\n\n\n\n\n\n') - -// console.log('OLD: ', rsltA) -// console.log('NEW: ', rsltB) - -const enu = '+proj=longlat +axis=enu'; -const esu = '+proj=longlat +axis=esu'; -const wnu = '+proj=longlat +axis=wnu'; -const transform = new Transformer(enu, esu); -injectAllDefinitions(transform); -// var result = proj4(enu, esu).forward({ x: 40, y: 50 }, true); -const result = transform.forward({ x: 40, y: 50 }, true); -console.log(result) - -// { -// projName: "cea", -// datumCode: "WGS84", -// units: "m", -// no_defs: true, -// type: "crs", -// datum_params: [ "0", "0", "0" ], -// ellps: "WGS84", -// datumName: "WGS84", -// k0: 0.8667510025721987, -// axis: "enu", -// init: [Function: init], -// forward: [Function: forward], -// inverse: [Function: inverse], -// names: [ "cea" ], -// a: 6378137, -// b: 6356752.314245179, -// rf: 298.257223563, -// sphere: undefined, -// es: 0.006694379990141316, -// e: 0.08181919084262149, -// ep2: 0.006739496742276434, -// datum: { -// datum_type: 4, -// datum_params: [ 0, 0, 0 ], -// a: 6378137, -// b: 6356752.314245179, -// es: 0.006694379990141316, -// ep2: 0.006739496742276434, -// }, -// } - -// // ------------------------------------ - -// { -// name: "Equal_Area_Cylindrical", -// projName: undefined, -// datumCode: "WGS84", -// datumType: 4, -// datumParams: [ 0, 0, 0, 0, 0, 0, 0 ], -// srsCode: "", -// lon0: 0, -// lon1: 0, -// lon2: 0, -// long0: 0, -// long1: 0, -// longc: 0, -// lat0: 0, -// lat1: 0, -// lat2: 0, -// latTs: 0.5235987755982988, -// a: 6378137, -// b: 6356752.314245179, -// e: 0.08181919084262149, -// x0: 0, -// y0: 0, -// k: undefined, -// k0: 1, -// rf: 298.257223563, -// rA: false, -// rc: undefined, -// es: 0.006694379990141316, -// ep2: 0.006739496742276434, -// alpha: undefined, -// gamma: undefined, -// zone: undefined, -// rectifiedGridAngle: undefined, -// utmSouth: false, -// toMeter: undefined, -// units: "m", -// fromGreenwich: 0, -// approx: false, -// axis: "enu", -// nadgrids: "@null", -// sphere: false, -// ellps: "WGS84", -// noDefs: true, -// type: "crs", -// forward: [Function: forward], -// inverse: [Function: inverse], -// } - - - - - - -// const Rn = 6378137 / (Math.sqrt(1.0e0 - es * Sin2_Lat)); -// console.log('SUB A', a, Sin_Lat, Cos_Lat, Sin2_Lat, Rn) -// // 6378137 0.8453038511165344 0.5342858778664806 0.7145386007124441 6393446.513163418 - -// es, f 0.006694380022900686 0.003352810681182268 -// N NP K0 0.0016792203946287192 0.0000028197811337370315 0.9996 0.997924968703673 -// es, f 0.006674372231802045 0.0033427731821747556 -// N NP K0 0.0016741848011149636 0.0000028028947482843505 1 0.998329312961542 - -// es, f 0.006694380022900686 0.003352810681182268 -// N NP K0 0.0016792203946287192 0.0000028197811337370315 1 0.9983242984230422 - -// es, f 0.006694380022900686 -// N NP K0 1 0.9983242984230422 - -// console.log('\n\n\n\n\n\n\n'); - - - -// const transform = new Transformer(); -// transform.setSource('+proj=merc +lon_0=5.937 +lat_ts=45.027 +ellps=sphere') - -// const result = transform.forward({ x: -45007.0787624, y: 4151725.59875 }) -// console.log('result', result) -// const backwards = transform.inverse(result) -// console.log('backwards', backwards) - - -// Benchmarking: - -// create n number of points as both an array and vectorpoint - -// const n = 50_000_000 - -// const vectorPoints = Array.from({ length: n }, (_, i) => { -// // all the x-y values have to be between -180 and 180 and -80 and 80 -// const x = Math.random() * 360 - 180 -// const y = Math.min(Math.max(Math.random() * 180 - 90, -80), 80) -// return { x, y } -// }) -// const arrayPoints = vectorPoints.map((p) => [p.x, p.y]) - -// let start = Bun.nanoseconds() -// for (const point of arrayPoints) { -// proj4.transform(proj4.WGS84, proj, proj4.toPoint(point)); -// } -// let end = Bun.nanoseconds() -// let seconds = (end - start) / 1_000_000_000 -// console.log('Proj4JS', seconds) - -// start = Bun.nanoseconds() -// for (const point of vectorPoints) { -// transform.inverse(point) -// } -// end = Bun.nanoseconds() -// seconds = (end - start) / 1_000_000_000 -// console.log('Transformer', seconds) diff --git a/tmpTests2.ts b/tmpTests2.ts deleted file mode 100644 index 30cdb6a1..00000000 --- a/tmpTests2.ts +++ /dev/null @@ -1,44 +0,0 @@ -// import { fromArrayBuffer } from './geotiff/src/geotiff'; - -// const tiff = await fromArrayBuffer(await Bun.file('./tests/readers/geotiff/fixtures/initial.tiff').arrayBuffer()); -// const image = await tiff.getImage(); -// const data = await image.readRasters({ interleave: true }); - -// console.log(data); - -// export function test(a: number): number { -// return a; -// } - -// import { NadGrid } from './src/readers/nadgrid'; -// import nadgrid from './proj4js-master/lib/nadgrid'; -// import MMapReader from './src/readers/mmap'; - -const data = await Bun.file('./tests/proj4/fixtures/BETA2007.gsb').arrayBuffer(); - -// const gridA = nadgrid('BETA2007.gsb', data); -// const { ll: llA, del: delA, lim: limA, count: countA, cvs: cvsA } = gridA.subgrids[0]; - -// const gridB = new NadGrid('BETA2007.gsb', new MMapReader('./tests/proj4/fixtures/BETA2007.gsb')); -// const subGridB1 = gridB.subgrids[0]; -// const { ll: llB, del: delB, lim: limB, count: countB, cvs: cvsB } = subGridB1; -// console.log('ll', llA, llB); -// console.log('del', delA, delB); -// console.log('lim', limA, limB); -// console.log('count', countA, countB); -// console.log('cvs', cvsA, cvsB); - -import proj4 from './proj4js-master/lib/'; - -proj4.nadgrid('BETA2007.gsb', data); - -// ['EPSG:31466', 'EPSG:25832', 2559552, 5670982, 349757.381712518, 5671004.065049540, 0.01, 0.01], - -// proj4.defs('EPSG:31466', '+proj=tmerc +lat_0=0 +lon_0=6 +k=1 +x_0=2500000 +y_0=0 +ellps=bessel +nadgrids=BETA2007.gsb +units=m +no_defs +type=crs'); -// proj4.defs('EPSG:25832', '+proj=utm +zone=32 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs +type=crs'); - -proj4.defs('EPSG:31466', '+proj=tmerc +lat_0=0 +lon_0=6 +k=1 +x_0=2500000 +y_0=0 +ellps=bessel +nadgrids=BETA2007.gsb +units=m +no_defs +type=crs'); -proj4.defs('EPSG:25832', '+proj=utm +zone=32 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs +type=crs') - -const res = proj4('EPSG:31466', 'EPSG:25832', [2559552, 5670982]); -console.log('res', res) diff --git a/tsconfig.eslint.json b/tsconfig.eslint.json index c2bc6a9a..a936c64e 100644 --- a/tsconfig.eslint.json +++ b/tsconfig.eslint.json @@ -35,10 +35,15 @@ "s2-tools": ["./src"], "s2-tools/*": ["./src/*"], "converters/*": ["./src/converters/*"], - "db/*": ["./src/db/*"], + "db/*": ["src/dataStore/*"], + "dataStore/*": ["src/dataStore/*"], "geometry/*": ["./src/geometry/*"], - "predicates/*": ["./src/predicates/*"], - "readers/*": ["./src/readers/*"] + "proj4/*": ["src/proj4/*"], + "readers/*": ["./src/readers/*"], + "space/*": ["./src/space/*"], + "tools/*": ["./src/tools/*"], + "util/*": ["./src/util/*"], + "writers/*": ["./src/writers/*"] }, // "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */ // "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */ diff --git a/tsconfig.json b/tsconfig.json index 87d05a13..a6a633f2 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -36,9 +36,14 @@ "s2-tools/*": ["./src/*"], "converters/*": ["./src/converters/*"], "db/*": ["src/dataStore/*"], + "dataStore/*": ["src/dataStore/*"], "geometry/*": ["./src/geometry/*"], - "predicates/*": ["./src/predicates/*"], - "readers/*": ["./src/readers/*"] + "proj4/*": ["src/proj4/*"], + "readers/*": ["./src/readers/*"], + "space/*": ["./src/space/*"], + "tools/*": ["./src/tools/*"], + "util/*": ["./src/util/*"], + "writers/*": ["./src/writers/*"] }, // "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */ // "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */