@ac-kit/math-map-projection 0.1.0 → 0.3.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 +111 -0
- package/README.md +51 -7
- package/dist/conic/conic-equal-area.d.ts.map +1 -1
- package/dist/conic/conic-equal-area.js.map +1 -1
- package/dist/cylindrical/index.d.ts +1 -0
- package/dist/cylindrical/index.d.ts.map +1 -1
- package/dist/cylindrical/index.js +1 -0
- package/dist/cylindrical/index.js.map +1 -1
- package/dist/cylindrical/transverse-mercator.d.ts +32 -0
- package/dist/cylindrical/transverse-mercator.d.ts.map +1 -0
- package/dist/cylindrical/transverse-mercator.js +103 -0
- package/dist/cylindrical/transverse-mercator.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/projection.d.ts +20 -11
- package/dist/projection.d.ts.map +1 -1
- package/dist/projection.js +70 -10
- package/dist/projection.js.map +1 -1
- package/dist/tile/_web-mercator.d.ts +11 -0
- package/dist/tile/_web-mercator.d.ts.map +1 -0
- package/dist/tile/_web-mercator.js +12 -0
- package/dist/tile/_web-mercator.js.map +1 -0
- package/dist/tile/index.d.ts +3 -0
- package/dist/tile/index.d.ts.map +1 -0
- package/dist/tile/index.js +3 -0
- package/dist/tile/index.js.map +1 -0
- package/dist/tile/tile-matrix-sets.d.ts +23 -0
- package/dist/tile/tile-matrix-sets.d.ts.map +1 -0
- package/dist/tile/tile-matrix-sets.js +73 -0
- package/dist/tile/tile-matrix-sets.js.map +1 -0
- package/dist/tile/web-mercator.d.ts +87 -0
- package/dist/tile/web-mercator.d.ts.map +1 -0
- package/dist/tile/web-mercator.js +166 -0
- package/dist/tile/web-mercator.js.map +1 -0
- package/package.json +11 -8
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,116 @@
|
|
|
1
1
|
# @ac-kit/math-map-projection
|
|
2
2
|
|
|
3
|
+
## 0.3.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 5c203e7: Web Mercator and the registered tile matrix sets of web maps, over
|
|
8
|
+
`@ac-kit/math-grid`'s tile model. Depends on `@ac-kit/math-grid` and
|
|
9
|
+
`@ac-kit/math-geodesy`.
|
|
10
|
+
|
|
11
|
+
- `WEB_MERCATOR_QUAD` (OGC WebMercatorQuad: EPSG:3857, levels 0 to 24, radius
|
|
12
|
+
from `ELLIPSOID_WGS84`) and `WORLD_CRS84_QUAD` (OGC WorldCRS84Quad: CRS84,
|
|
13
|
+
levels 0 to 23, two tiles at level 0), with computed cell sizes that halve
|
|
14
|
+
exactly from level to level.
|
|
15
|
+
- `webMercatorProject` and `webMercatorUnproject`, with their in-place
|
|
16
|
+
`…Array` forms: longitude and latitude in radians to EPSG:3857 metres and
|
|
17
|
+
back; `WEB_MERCATOR_MAX_LATITUDE` is the square's latitude limit, `atan(sinh
|
|
18
|
+
π)` radians.
|
|
19
|
+
- `webMercatorTileAt(out, coords, level)` gives the tile of a longitude and
|
|
20
|
+
latitude as tile servers count it (longitudes wrapped, latitudes beyond the
|
|
21
|
+
limit on the edge rows), and `webMercatorTileLongitudeLatitudeBounds(out,
|
|
22
|
+
tile)` its extent in radians; `RangeError` for a level outside 0 to 24.
|
|
23
|
+
- `webMercatorGroundResolution(latitude, zoom)` and
|
|
24
|
+
`webMercatorScaleDenominator(latitude, zoom, pixelSizeM?)` give the metres per
|
|
25
|
+
pixel and the scale at a latitude and a continuous zoom.
|
|
26
|
+
|
|
27
|
+
### Patch Changes
|
|
28
|
+
|
|
29
|
+
- Updated dependencies [5c203e7]
|
|
30
|
+
- Updated dependencies [5c203e7]
|
|
31
|
+
- Updated dependencies [5c203e7]
|
|
32
|
+
- Updated dependencies [5c203e7]
|
|
33
|
+
- Updated dependencies [5c203e7]
|
|
34
|
+
- Updated dependencies [5c203e7]
|
|
35
|
+
- Updated dependencies [5c203e7]
|
|
36
|
+
- Updated dependencies [5c203e7]
|
|
37
|
+
- Updated dependencies [5c203e7]
|
|
38
|
+
- Updated dependencies [5c203e7]
|
|
39
|
+
- Updated dependencies [5c203e7]
|
|
40
|
+
- Updated dependencies [5c203e7]
|
|
41
|
+
- Updated dependencies [5c203e7]
|
|
42
|
+
- Updated dependencies [5c203e7]
|
|
43
|
+
- Updated dependencies [5c203e7]
|
|
44
|
+
- Updated dependencies [5c203e7]
|
|
45
|
+
- Updated dependencies [5c203e7]
|
|
46
|
+
- Updated dependencies [5c203e7]
|
|
47
|
+
- Updated dependencies [5c203e7]
|
|
48
|
+
- Updated dependencies [5c203e7]
|
|
49
|
+
- @ac-kit/core@0.14.0
|
|
50
|
+
- @ac-kit/math-geodesy@0.2.0
|
|
51
|
+
- @ac-kit/math-geometry@0.5.0
|
|
52
|
+
- @ac-kit/math-grid@0.5.0
|
|
53
|
+
- @ac-kit/math-linear@0.5.0
|
|
54
|
+
- @ac-kit/math-scalar@0.5.0
|
|
55
|
+
|
|
56
|
+
## 0.2.0
|
|
57
|
+
|
|
58
|
+
### Minor Changes
|
|
59
|
+
|
|
60
|
+
- 0b4fe43: `projectionCreate` builds `transverse-mercator`, the spherical transverse
|
|
61
|
+
Mercator (as d3-geo's `geoTransverseMercator`; `rotate: [−λ₀, 0]` puts the
|
|
62
|
+
central meridian on `λ₀`), and the geometry functions cut its lines and
|
|
63
|
+
polygons at its own seam, the far half of the equator. The dedicated
|
|
64
|
+
`transverseMercatorProject`, `…Unproject`, `…ProjectArray` and
|
|
65
|
+
`…UnprojectArray` (Snyder §8) map longitude–latitude pairs centred on longitude
|
|
66
|
+
0, with x evaluated through `asinh` so that it stays finite and accurate up to
|
|
67
|
+
the two singular points (`(π/2, 10⁻⁹)` gives 21.4164, not ∞). `projectionCreate` throws `UnsupportedError` from `@ac-kit/core` for the one
|
|
68
|
+
kind of `ProjectionKind` still without an implementation, the composite
|
|
69
|
+
`albers-usa`, and a `RangeError` only for an unknown kind (it threw a
|
|
70
|
+
`RangeError` for both).
|
|
71
|
+
|
|
72
|
+
### Patch Changes
|
|
73
|
+
|
|
74
|
+
- Updated dependencies [0b4fe43]
|
|
75
|
+
- Updated dependencies [0b4fe43]
|
|
76
|
+
- Updated dependencies [0b4fe43]
|
|
77
|
+
- Updated dependencies [0b4fe43]
|
|
78
|
+
- Updated dependencies [0b4fe43]
|
|
79
|
+
- Updated dependencies [0b4fe43]
|
|
80
|
+
- Updated dependencies [0b4fe43]
|
|
81
|
+
- Updated dependencies [0b4fe43]
|
|
82
|
+
- Updated dependencies [0b4fe43]
|
|
83
|
+
- Updated dependencies [0b4fe43]
|
|
84
|
+
- Updated dependencies [0b4fe43]
|
|
85
|
+
- Updated dependencies [0b4fe43]
|
|
86
|
+
- Updated dependencies [0b4fe43]
|
|
87
|
+
- Updated dependencies [0b4fe43]
|
|
88
|
+
- Updated dependencies [0b4fe43]
|
|
89
|
+
- Updated dependencies [0b4fe43]
|
|
90
|
+
- Updated dependencies [0b4fe43]
|
|
91
|
+
- Updated dependencies [0b4fe43]
|
|
92
|
+
- Updated dependencies [0b4fe43]
|
|
93
|
+
- Updated dependencies [0b4fe43]
|
|
94
|
+
- Updated dependencies [0b4fe43]
|
|
95
|
+
- Updated dependencies [0b4fe43]
|
|
96
|
+
- Updated dependencies [0b4fe43]
|
|
97
|
+
- Updated dependencies [0b4fe43]
|
|
98
|
+
- Updated dependencies [0b4fe43]
|
|
99
|
+
- Updated dependencies [0b4fe43]
|
|
100
|
+
- Updated dependencies [0b4fe43]
|
|
101
|
+
- Updated dependencies [0b4fe43]
|
|
102
|
+
- Updated dependencies [0b4fe43]
|
|
103
|
+
- Updated dependencies [0b4fe43]
|
|
104
|
+
- Updated dependencies [0b4fe43]
|
|
105
|
+
- Updated dependencies [0b4fe43]
|
|
106
|
+
- Updated dependencies [0b4fe43]
|
|
107
|
+
- Updated dependencies [0b4fe43]
|
|
108
|
+
- Updated dependencies [0b4fe43]
|
|
109
|
+
- @ac-kit/core@0.13.0
|
|
110
|
+
- @ac-kit/math-geometry@0.4.0
|
|
111
|
+
- @ac-kit/math-linear@0.4.0
|
|
112
|
+
- @ac-kit/math-scalar@0.4.0
|
|
113
|
+
|
|
3
114
|
## 0.1.0
|
|
4
115
|
|
|
5
116
|
### Minor Changes
|
package/README.md
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
# @ac-kit/math-map-projection
|
|
2
2
|
|
|
3
|
-
Point maps between the sphere and the plane — map and sky projections,
|
|
4
|
-
cutting, resampling and graticules a map needs
|
|
5
|
-
building are not here. Earth or sky: a
|
|
6
|
-
sphere, and `stereographicProjectArray`
|
|
7
|
-
0.16 ms.
|
|
3
|
+
Point maps between the sphere and the plane — map and sky projections, the
|
|
4
|
+
cutting, resampling and graticules a map needs, and the Web Mercator tile
|
|
5
|
+
matrix sets; styling and GeoJSON path building are not here. Earth or sky: a
|
|
6
|
+
star chart is a map of the celestial sphere, and `stereographicProjectArray`
|
|
7
|
+
projects 120 000 stars in about 0.16 ms.
|
|
8
8
|
|
|
9
9
|
```ts
|
|
10
10
|
import {
|
|
@@ -47,7 +47,9 @@ const lines = projectionGraticule(projection);
|
|
|
47
47
|
- **Domains give `NaN`.** The antipode of a stereographic view, the far side of
|
|
48
48
|
an orthographic one, the horizon of a gnomonic one; a latitude beyond the
|
|
49
49
|
poles; `NaN` in, `NaN` out; never a throw (a creator of a parameter record, or
|
|
50
|
-
a bulk length mismatch, throws `RangeError`). The poles of Mercator are
|
|
50
|
+
a bulk length mismatch, throws `RangeError`). The poles of Mercator are
|
|
51
|
+
`±∞`; the transverse Mercator's two singular points are not doubles, so its
|
|
52
|
+
x stays finite and accurate up to them (±38.03 at `(±Math.PI / 2, 0)`).
|
|
51
53
|
- **Huge and tiny scales hold.** An inverse of a point at `1e300` or `1e-300`
|
|
52
54
|
gives a unit vector, not `NaN` or a zero (the scale is kept in range).
|
|
53
55
|
- **One container type per parameter** (a `Vec2`, a `Float64Array`), as in
|
|
@@ -59,12 +61,15 @@ const lines = projectionGraticule(projection);
|
|
|
59
61
|
| -------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- |
|
|
60
62
|
| `stereographic…`, `orthographic…`, `gnomonic…`, `azimuthalEquidistant…`, `azimuthalEqualArea…` (`Project`, `Unproject`, `ProjectArray`, `UnprojectArray`, `Radius`, `Angle`, `…_DOMAIN_ANGLE`) | The five azimuthal projections of unit vectors; the array forms fuse a view rotation (one pass) |
|
|
61
63
|
| `AzimuthalProjectionKind`, `azimuthalRadius`, `azimuthalAngle`, `azimuthalDomainAngle` | The same by name, for a chart that picks its projection from data |
|
|
62
|
-
| `equirectangular…`, `mercator…`, `equalEarth…`, `naturalEarth…` (`Project`, `Unproject`, `ProjectArray`, `UnprojectArray`)
|
|
64
|
+
| `equirectangular…`, `mercator…`, `transverseMercator…`, `equalEarth…`, `naturalEarth…` (`Project`, `Unproject`, `ProjectArray`, `UnprojectArray`) | Longitude–latitude projections (the transverse Mercator on the sphere); in-place arrays |
|
|
63
65
|
| `conicEqualAreaCreate`, `conicConformalCreate`, `conicEquidistantCreate`, `ALBERS_PARALLELS`, `conic…Project`, `…Unproject`, `…Array` | The conics: constants computed once into a `ConicProjection`, then the same four functions |
|
|
64
66
|
| `projectionCreate(spec, options?)` | A closure from a `ProjectionSpec` (rotation, parallels, centre) with `project`, `unproject` and their array forms |
|
|
65
67
|
| `projectionPolylineProject`, `projectionPolygonProject` | Lines and polygons cut at the antimeridian or the clip circle, then sampled until straight |
|
|
66
68
|
| `graticuleCreate`, `projectionGraticule`, `projectionOutline` | The graticule and the outline of a map |
|
|
67
69
|
| `VertexRuns`, `vertexRunsFromArrays`, `PROJECTION_MAXIMUM_VERTICES` | The packed layout of lines and rings, and the most vertices a result holds |
|
|
70
|
+
| `WEB_MERCATOR_QUAD`, `WORLD_CRS84_QUAD` | The OGC tile matrix sets of web maps, for `@ac-kit/math-grid`'s `tile…` functions |
|
|
71
|
+
| `webMercatorProject`, `webMercatorUnproject` (and `…Array`), `WEB_MERCATOR_MAX_LATITUDE` | EPSG:3857 in metres |
|
|
72
|
+
| `webMercatorTileAt`, `webMercatorTileLongitudeLatitudeBounds`, `webMercatorGroundResolution`, `webMercatorScaleDenominator` | Tiles from longitudes and latitudes, their extents back, and the ground scale at a latitude and zoom |
|
|
68
73
|
|
|
69
74
|
Which projection for what: the **stereographic** keeps angles and turns circles
|
|
70
75
|
into circles (sky charts, polar maps); the **orthographic** is the globe seen
|
|
@@ -74,6 +79,45 @@ the **azimuthal equidistant** keeps distances from the centre; the
|
|
|
74
79
|
areas; **Mercator** and the **Lambert conformal conic** keep angles;
|
|
75
80
|
**equirectangular** and **Natural Earth** compromise.
|
|
76
81
|
|
|
82
|
+
## Web Mercator tiles
|
|
83
|
+
|
|
84
|
+
EPSG:3857 is the spherical Mercator on a sphere of WGS 84's equatorial radius
|
|
85
|
+
(`ELLIPSOID_WGS84` of `@ac-kit/math-geodesy`), in metres:
|
|
86
|
+
`webMercatorProject` takes radians like every function here. `WEB_MERCATOR_QUAD`
|
|
87
|
+
(levels 0 to 24) and `WORLD_CRS84_QUAD` (levels 0 to 23, 2 × 1 tiles at level
|
|
88
|
+
0) are the OGC registered tile matrix sets, with computed cell sizes, so every
|
|
89
|
+
level halves the last exactly; use them with `@ac-kit/math-grid`'s `tileAt`,
|
|
90
|
+
`tileBounds`, `tileNeighbours`, `tilesCoveringBox` and `tileQuadkey`.
|
|
91
|
+
|
|
92
|
+
`webMercatorTileAt` counts as tile servers do: a longitude outside `[−π, π]`
|
|
93
|
+
wraps, a latitude beyond `WEB_MERCATOR_MAX_LATITUDE` (85.051°) goes to the edge
|
|
94
|
+
row, the antimeridian at `+π` to the last column. The ground resolution and
|
|
95
|
+
scale denominator take a continuous zoom, for a map drawn between levels.
|
|
96
|
+
|
|
97
|
+
```ts
|
|
98
|
+
import {
|
|
99
|
+
webMercatorGroundResolution,
|
|
100
|
+
webMercatorTileAt,
|
|
101
|
+
webMercatorTileLongitudeLatitudeBounds,
|
|
102
|
+
} from "@ac-kit/math-map-projection";
|
|
103
|
+
import { box2Create, longitudeLatitudeOf } from "@ac-kit/math-geometry";
|
|
104
|
+
import { tileQuadkey } from "@ac-kit/math-grid";
|
|
105
|
+
|
|
106
|
+
const degrees = Math.PI / 180;
|
|
107
|
+
const tile = webMercatorTileAt(
|
|
108
|
+
{ level: 0, col: 0, row: 0 },
|
|
109
|
+
longitudeLatitudeOf(2.35 * degrees, 48.85 * degrees),
|
|
110
|
+
12,
|
|
111
|
+
); // { level: 12, col: 2074, row: 1409 }
|
|
112
|
+
tileQuadkey(tile); // "120220011012"
|
|
113
|
+
webMercatorTileLongitudeLatitudeBounds(box2Create(), tile); // west, south, east, north (radians)
|
|
114
|
+
webMercatorGroundResolution(48.85 * degrees, 12.5); // ≈ 17.78 m per pixel
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
Checked against `mercantile` (Python, BSD-3-Clause; a dev oracle through a
|
|
118
|
+
generated fixture, never a source): tiles and quadkeys equal, bounds within
|
|
119
|
+
`1e−9`° and metres within `1e−6` m.
|
|
120
|
+
|
|
77
121
|
## Cutting, resampling, graticules
|
|
78
122
|
|
|
79
123
|
`projectionPolygonProject` and `projectionPolylineProject` take the packed
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conic-equal-area.d.ts","sourceRoot":"","sources":["../../src/conic/conic-equal-area.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,iBAAiB,EACjB,yBAAyB,EACzB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAG9D,OAAO,EAKN,KAAK,eAAe,EAGpB,MAAM,aAAa,CAAC;AAIrB;;;;;;;;;;;GAWG;AAEH;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,EAAE,SAAS,CAAC,MAAM,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"conic-equal-area.d.ts","sourceRoot":"","sources":["../../src/conic/conic-equal-area.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,iBAAiB,EACjB,yBAAyB,EACzB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAG9D,OAAO,EAKN,KAAK,eAAe,EAGpB,MAAM,aAAa,CAAC;AAIrB;;;;;;;;;;;GAWG;AAEH;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,EAAE,SAAS,CAAC,MAAM,EAAE,MAAM,CAGrD,CAAC;AAEH;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CACnC,iBAAiB,EAAE,MAAM,EACzB,iBAAiB,EAAE,MAAM,GACvB,eAAe,CAoBjB;AA8CD,qDAAqD;AACrD,wBAAgB,qBAAqB,CACpC,GAAG,EAAE,IAAI,EACT,MAAM,EAAE,yBAAyB,EACjC,UAAU,EAAE,eAAe,GACzB,IAAI,CAKN;AAED;;;GAGG;AACH,wBAAgB,uBAAuB,CACtC,GAAG,EAAE,iBAAiB,EACtB,KAAK,EAAE,YAAY,EACnB,UAAU,EAAE,eAAe,GACzB,iBAAiB,CAKnB;AAED;;;;;;;GAOG;AACH,wBAAgB,0BAA0B,CAAC,CAAC,SAAS,YAAY,EAChE,GAAG,EAAE,CAAC,EACN,KAAK,EAAE,YAAY,EACnB,UAAU,EAAE,eAAe,GACzB,CAAC,CAYH;AAED;;;;;;;GAOG;AACH,wBAAgB,4BAA4B,CAAC,CAAC,SAAS,YAAY,EAClE,GAAG,EAAE,CAAC,EACN,KAAK,EAAE,YAAY,EACnB,UAAU,EAAE,eAAe,GACzB,CAAC,CAYH"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conic-equal-area.js","sourceRoot":"","sources":["../../src/conic/conic-equal-area.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EACN,gBAAgB,EAChB,wBAAwB,EACxB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AC,GAAG,KAAK,EACT,KAAK,CAAC,CAAC,GAAG,KAAK,CAAE,EACjB,KAAK,CAAC,CAAC,GAAG,KAAK,GAAG,CAAC,CAAE,EACrB,UAAU,CACV,CAAC;IACH,CAAC;IACD,OAAO,GAAG,CAAC;AACZ,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,4BAA4B,CAC3C,GAAM,EACN,KAAmB,EACnB,UAA2B;IAE3B,MAAM,KAAK,GAAG,aAAa,CAAC,8BAA8B,EAAE,GAAG,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;IAC9E,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,KAAK,EAAE,KAAK,EAAE,EAAE,CAAC;QAC5C,UAAU,CACT,GAAG,EACH,CAAC,GAAG,KAAK,EACT,KAAK,CAAC,CAAC,GAAG,KAAK,CAAE,EACjB,KAAK,CAAC,CAAC,GAAG,KAAK,GAAG,CAAC,CAAE,EACrB,UAAU,CACV,CAAC;IACH,CAAC;IACD,OAAO,GAAG,CAAC;AACZ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cylindrical/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,eAAe,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cylindrical/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,eAAe,CAAC;AAC9B,cAAc,0BAA0B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/cylindrical/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,eAAe,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/cylindrical/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,eAAe,CAAC;AAC9B,cAAc,0BAA0B,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { LongitudeLatitude, ReadonlyLongitudeLatitude } from "@ac-kit/math-geometry";
|
|
2
|
+
import type { ReadonlyVec2, Vec2 } from "@ac-kit/math-linear";
|
|
3
|
+
/**
|
|
4
|
+
* Writes the plane point of `coords` into `out`; finite for every finite input,
|
|
5
|
+
* x growing without bound towards the singular points `(±π/2, 0)`.
|
|
6
|
+
*/
|
|
7
|
+
export declare function transverseMercatorProject(out: Vec2, coords: ReadonlyLongitudeLatitude): Vec2;
|
|
8
|
+
/**
|
|
9
|
+
* Writes the longitude and latitude of the plane point `point` into `out`
|
|
10
|
+
* (`atan2(sinh x, cos y)` and `asin(sin y / cosh x)`; `x = ±∞` is one of the
|
|
11
|
+
* two singular points); a point with `|y| > π` gives `NaN`.
|
|
12
|
+
*/
|
|
13
|
+
export declare function transverseMercatorUnproject(out: LongitudeLatitude, point: ReadonlyVec2): LongitudeLatitude;
|
|
14
|
+
/**
|
|
15
|
+
* Writes the plane point of every longitude–latitude pair of `input` into `out`
|
|
16
|
+
* (as many numbers), as {@link transverseMercatorProject} does for one. `out`
|
|
17
|
+
* may be `input`. O(n).
|
|
18
|
+
*
|
|
19
|
+
* @returns `out`.
|
|
20
|
+
* @throws {RangeError} Unless `out` and `input` have the same even length.
|
|
21
|
+
*/
|
|
22
|
+
export declare function transverseMercatorProjectArray<T extends Float64Array>(out: T, input: Float64Array): T;
|
|
23
|
+
/**
|
|
24
|
+
* Writes the longitude–latitude pair of every plane point of `input` into `out`
|
|
25
|
+
* (as many numbers), as {@link transverseMercatorUnproject} does for one. `out`
|
|
26
|
+
* may be `input`. O(n).
|
|
27
|
+
*
|
|
28
|
+
* @returns `out`.
|
|
29
|
+
* @throws {RangeError} Unless `out` and `input` have the same even length.
|
|
30
|
+
*/
|
|
31
|
+
export declare function transverseMercatorUnprojectArray<T extends Float64Array>(out: T, input: Float64Array): T;
|
|
32
|
+
//# sourceMappingURL=transverse-mercator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transverse-mercator.d.ts","sourceRoot":"","sources":["../../src/cylindrical/transverse-mercator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,iBAAiB,EACjB,yBAAyB,EACzB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAqC9D;;;GAGG;AACH,wBAAgB,yBAAyB,CACxC,GAAG,EAAE,IAAI,EACT,MAAM,EAAE,yBAAyB,GAC/B,IAAI,CAYN;AAED;;;;GAIG;AACH,wBAAgB,2BAA2B,CAC1C,GAAG,EAAE,iBAAiB,EACtB,KAAK,EAAE,YAAY,GACjB,iBAAiB,CAOnB;AAED;;;;;;;GAOG;AACH,wBAAgB,8BAA8B,CAAC,CAAC,SAAS,YAAY,EACpE,GAAG,EAAE,CAAC,EACN,KAAK,EAAE,YAAY,GACjB,CAAC,CAuBH;AAED;;;;;;;GAOG;AACH,wBAAgB,gCAAgC,CAAC,CAAC,SAAS,YAAY,EACtE,GAAG,EAAE,CAAC,EACN,KAAK,EAAE,YAAY,GACjB,CAAC,CAkBH"}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { elementCount_ } from "../_array-length.js";
|
|
2
|
+
/**
|
|
3
|
+
* The transverse Mercator projection on the sphere (Snyder, _Map Projections —
|
|
4
|
+
* A Working Manual_, 1987, §8, spherical form, equations 8-1 to 8-7): the
|
|
5
|
+
* Mercator projection turned a quarter so that the central meridian, longitude
|
|
6
|
+
* 0, plays the equator's part: conformal, true to scale along that meridian,
|
|
7
|
+
* the base of UTM for a narrow zone around it. The plane x is `atanh(cos φ ·
|
|
8
|
+
* sin λ)` and y is `atan2(tan φ, cos λ)`, in radians: the two points of the
|
|
9
|
+
* equator a quarter turn from the central meridian are singular (x → ±∞), and
|
|
10
|
+
* the image is the strip `−π < y ≤ π`. x is evaluated as `asinh(cos φ · sin λ /
|
|
11
|
+
* hypot(sin φ, cos φ · cos λ))`, the same function, which keeps its accuracy
|
|
12
|
+
* near the meridian a quarter turn away, where `cos φ · sin λ` rounds to 1 and
|
|
13
|
+
* `atanh` would give ∞ (`(π/2, 10⁻⁹)` is 21.4164). No double is a singular
|
|
14
|
+
* point, so x is finite for every finite input: at `(±Math.PI / 2, 0)`, which
|
|
15
|
+
* misses π/2 by 6 × 10⁻¹⁷, it is ±38.03. Inputs are longitude–latitude pairs in
|
|
16
|
+
* radians (any longitude: the map is periodic in it); a latitude outside
|
|
17
|
+
* `[−π/2, π/2]` gives `NaN`, as does a `NaN` component. The ellipsoidal form
|
|
18
|
+
* (the Krüger series of UTM) is another projection.
|
|
19
|
+
*/
|
|
20
|
+
// x from cos φ: 1 − (cos φ sin λ)² is sin² φ + (cos φ cos λ)², a sum of
|
|
21
|
+
// squares with no cancellation.
|
|
22
|
+
function transverseX_(cosLatitude, sinLatitude, longitude, cosLongitudeTerm) {
|
|
23
|
+
return Math.asinh((cosLatitude * Math.sin(longitude)) /
|
|
24
|
+
Math.hypot(sinLatitude, cosLongitudeTerm));
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Writes the plane point of `coords` into `out`; finite for every finite input,
|
|
28
|
+
* x growing without bound towards the singular points `(±π/2, 0)`.
|
|
29
|
+
*/
|
|
30
|
+
export function transverseMercatorProject(out, coords) {
|
|
31
|
+
const longitude = coords[0];
|
|
32
|
+
const latitude = coords[1];
|
|
33
|
+
const cosLatitude = Math.cos(latitude);
|
|
34
|
+
const sinLatitude = Math.sin(latitude);
|
|
35
|
+
const cosLongitudeTerm = cosLatitude * Math.cos(longitude);
|
|
36
|
+
const valid = Math.abs(latitude) <= Math.PI / 2;
|
|
37
|
+
out[0] = valid
|
|
38
|
+
? transverseX_(cosLatitude, sinLatitude, longitude, cosLongitudeTerm)
|
|
39
|
+
: Number.NaN;
|
|
40
|
+
out[1] = valid ? Math.atan2(sinLatitude, cosLongitudeTerm) : Number.NaN;
|
|
41
|
+
return out;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Writes the longitude and latitude of the plane point `point` into `out`
|
|
45
|
+
* (`atan2(sinh x, cos y)` and `asin(sin y / cosh x)`; `x = ±∞` is one of the
|
|
46
|
+
* two singular points); a point with `|y| > π` gives `NaN`.
|
|
47
|
+
*/
|
|
48
|
+
export function transverseMercatorUnproject(out, point) {
|
|
49
|
+
const x = point[0];
|
|
50
|
+
const y = point[1];
|
|
51
|
+
const valid = Math.abs(y) <= Math.PI && !Number.isNaN(x);
|
|
52
|
+
out[0] = valid ? Math.atan2(Math.sinh(x), Math.cos(y)) : Number.NaN;
|
|
53
|
+
out[1] = valid ? Math.asin(Math.sin(y) / Math.cosh(x)) : Number.NaN;
|
|
54
|
+
return out;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Writes the plane point of every longitude–latitude pair of `input` into `out`
|
|
58
|
+
* (as many numbers), as {@link transverseMercatorProject} does for one. `out`
|
|
59
|
+
* may be `input`. O(n).
|
|
60
|
+
*
|
|
61
|
+
* @returns `out`.
|
|
62
|
+
* @throws {RangeError} Unless `out` and `input` have the same even length.
|
|
63
|
+
*/
|
|
64
|
+
export function transverseMercatorProjectArray(out, input) {
|
|
65
|
+
const count = elementCount_("transverseMercatorProjectArray", out, input, 2, 2);
|
|
66
|
+
for (let index = 0; index < count; index++) {
|
|
67
|
+
const longitude = input[2 * index];
|
|
68
|
+
const latitude = input[2 * index + 1];
|
|
69
|
+
const cosLatitude = Math.cos(latitude);
|
|
70
|
+
const sinLatitude = Math.sin(latitude);
|
|
71
|
+
const cosLongitudeTerm = cosLatitude * Math.cos(longitude);
|
|
72
|
+
const valid = Math.abs(latitude) <= Math.PI / 2;
|
|
73
|
+
out[2 * index] = valid
|
|
74
|
+
? transverseX_(cosLatitude, sinLatitude, longitude, cosLongitudeTerm)
|
|
75
|
+
: Number.NaN;
|
|
76
|
+
out[2 * index + 1] = valid
|
|
77
|
+
? Math.atan2(sinLatitude, cosLongitudeTerm)
|
|
78
|
+
: Number.NaN;
|
|
79
|
+
}
|
|
80
|
+
return out;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Writes the longitude–latitude pair of every plane point of `input` into `out`
|
|
84
|
+
* (as many numbers), as {@link transverseMercatorUnproject} does for one. `out`
|
|
85
|
+
* may be `input`. O(n).
|
|
86
|
+
*
|
|
87
|
+
* @returns `out`.
|
|
88
|
+
* @throws {RangeError} Unless `out` and `input` have the same even length.
|
|
89
|
+
*/
|
|
90
|
+
export function transverseMercatorUnprojectArray(out, input) {
|
|
91
|
+
const count = elementCount_("transverseMercatorUnprojectArray", out, input, 2, 2);
|
|
92
|
+
for (let index = 0; index < count; index++) {
|
|
93
|
+
const x = input[2 * index];
|
|
94
|
+
const y = input[2 * index + 1];
|
|
95
|
+
const valid = Math.abs(y) <= Math.PI && !Number.isNaN(x);
|
|
96
|
+
out[2 * index] = valid ? Math.atan2(Math.sinh(x), Math.cos(y)) : Number.NaN;
|
|
97
|
+
out[2 * index + 1] = valid
|
|
98
|
+
? Math.asin(Math.sin(y) / Math.cosh(x))
|
|
99
|
+
: Number.NaN;
|
|
100
|
+
}
|
|
101
|
+
return out;
|
|
102
|
+
}
|
|
103
|
+
//# sourceMappingURL=transverse-mercator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transverse-mercator.js","sourceRoot":"","sources":["../../src/cylindrical/transverse-mercator.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD;;;;;;;;;;;;;;;;;GAiBG;AAEH,wEAAwE;AACxE,gCAAgC;AAChC,SAAS,YAAY,CACpB,WAAmB,EACnB,WAAmB,EACnB,SAAiB,EACjB,gBAAwB;IAExB,OAAO,IAAI,CAAC,KAAK,CAChB,CAAC,WAAW,GAAG,IAAI,CAAC,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,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YACvC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC;IACf,CAAC;IACD,OAAO,GAAG,CAAC;AACZ,CAAC"}
|
package/dist/index.d.ts
CHANGED
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,kBAAkB,CAAC;AACjC,cAAc,wBAAwB,CAAC;AACvC,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC;AAChC,cAAc,+BAA+B,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,kBAAkB,CAAC;AACjC,cAAc,wBAAwB,CAAC;AACvC,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC;AAChC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,iBAAiB,CAAC"}
|
package/dist/index.js
CHANGED
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,kBAAkB,CAAC;AACjC,cAAc,wBAAwB,CAAC;AACvC,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC;AAChC,cAAc,+BAA+B,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,kBAAkB,CAAC;AACjC,cAAc,wBAAwB,CAAC;AACvC,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC;AAChC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,iBAAiB,CAAC"}
|
package/dist/projection.d.ts
CHANGED
|
@@ -2,8 +2,9 @@ import { type LongitudeLatitude, type ReadonlyLongitudeLatitude } from "@ac-kit/
|
|
|
2
2
|
import { type ReadonlyMat3x3, type ReadonlyVec2, type Vec2 } from "@ac-kit/math-linear";
|
|
3
3
|
/**
|
|
4
4
|
* The names of the map projections, those `model-chart`'s `ProjectionKind` uses
|
|
5
|
-
* (a structural twin: its values are accepted here). `
|
|
6
|
-
*
|
|
5
|
+
* (a structural twin: its values are accepted here). The composite `albers-usa`
|
|
6
|
+
* is not built yet ({@link projectionCreate} throws for it);
|
|
7
|
+
* `transverse-mercator` is the spherical form.
|
|
7
8
|
*/
|
|
8
9
|
export type ProjectionKind = "equirectangular" | "mercator" | "transverse-mercator" | "albers" | "albers-usa" | "conic-conformal" | "conic-equal-area" | "conic-equidistant" | "azimuthal-equal-area" | "azimuthal-equidistant" | "gnomonic" | "orthographic" | "stereographic" | "natural-earth" | "equal-earth";
|
|
9
10
|
/**
|
|
@@ -61,8 +62,10 @@ export type Projection = Readonly<{
|
|
|
61
62
|
/** The cap's angular radius for an azimuthal projection, `Infinity` otherwise. */
|
|
62
63
|
clipAngle: number;
|
|
63
64
|
/**
|
|
64
|
-
* Longitude–latitude to rotated unit vectors: the rotation applied first
|
|
65
|
-
*
|
|
65
|
+
* Longitude–latitude to rotated unit vectors: the rotation applied first, the
|
|
66
|
+
* spec's `rotate` and, for `transverse-mercator`, the quarter turn about the
|
|
67
|
+
* centre's axis that brings the central meridian onto the rotated equator (so
|
|
68
|
+
* the cut is the far half of the equator). Do not change it.
|
|
66
69
|
*/
|
|
67
70
|
rotation: ReadonlyMat3x3;
|
|
68
71
|
/**
|
|
@@ -94,14 +97,20 @@ export type Projection = Readonly<{
|
|
|
94
97
|
* Makes a projection from a spec, once (it computes constants and scratch
|
|
95
98
|
* values, and allocates the closures), for a chart that picks its projection
|
|
96
99
|
* from data. Each projection's own dedicated functions are the faster way when
|
|
97
|
-
* the kind is known.
|
|
100
|
+
* the kind is known. `transverse-mercator` is the spherical form
|
|
101
|
+
* (`transverseMercatorProject`), built as the Mercator of the sphere turned a
|
|
102
|
+
* quarter after `rotate`, as d3-geo's `geoTransverseMercator` does: `rotate:
|
|
103
|
+
* [−λ₀, 0]` puts the central meridian on `λ₀`. Its `center` is a point of the
|
|
104
|
+
* rotated sphere, as for every kind, where d3-geo reads it in the turned frame
|
|
105
|
+
* (`[−φ, λ]` there).
|
|
98
106
|
*
|
|
99
|
-
* @throws {
|
|
100
|
-
* `albers-usa`)
|
|
101
|
-
*
|
|
102
|
-
*
|
|
103
|
-
*
|
|
104
|
-
*
|
|
107
|
+
* @throws {UnsupportedError} For a kind not built yet (the composite
|
|
108
|
+
* `albers-usa`).
|
|
109
|
+
* @throws {RangeError} For an unknown kind, a non-finite `rotate`, `parallels`
|
|
110
|
+
* or `center`, a latitude among them (`rotate[1]`, `center[1]`, `parallels`)
|
|
111
|
+
* outside `[−90, 90]` or a `center` longitude outside `[−180, 180]` (checked
|
|
112
|
+
* before any conversion, so that none folds over a pole), parallels the conic
|
|
113
|
+
* families cannot use, or a `clipAngle` outside `(0, domain angle]`.
|
|
105
114
|
*/
|
|
106
115
|
export declare function projectionCreate(spec: ProjectionSpec, options?: ProjectionOptions): Projection;
|
|
107
116
|
//# sourceMappingURL=projection.d.ts.map
|
package/dist/projection.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"projection.d.ts","sourceRoot":"","sources":["../src/projection.ts"],"names":[],"mappings":"AACA,OAAO,EACN,KAAK,iBAAiB,EAGtB,KAAK,yBAAyB,EAE9B,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAON,KAAK,cAAc,EACnB,KAAK,YAAY,EAEjB,KAAK,IAAI,EAKT,MAAM,qBAAqB,CAAC;AA2D7B
|
|
1
|
+
{"version":3,"file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CAAC,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,yBAAyB,GAAG,IAAI,CAAC;IAC5D,8EAA8E;IAC9E,SAAS,CAAC,GAAG,EAAE,iBAAiB,EAAE,KAAK,EAAE,YAAY,GAAG,iBAAiB,CAAC;IAC1E;;;OAGG;IACH,YAAY,CAAC,CAAC,SAAS,YAAY,EAAE,GAAG,EAAE,CAAC,EAAE,KAAK,EAAE,YAAY,GAAG,CAAC,CAAC;IACrE;;;OAGG;IACH,cAAc,CAAC,CAAC,SAAS,YAAY,EAAE,GAAG,EAAE,CAAC,EAAE,KAAK,EAAE,YAAY,GAAG,CAAC,CAAC;IACvE;;;;;OAKG;IACH,cAAc,CAAC,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,yBAAyB,GAAG,IAAI,CAAC;CACnE,CAAC,CAAC;AA6OH;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,gBAAgB,CAC/B,IAAI,EAAE,cAAc,EACpB,OAAO,GAAE,iBAAsB,GAC7B,UAAU,CAkNZ"}
|
package/dist/projection.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { describeValue } from "@ac-kit/core";
|
|
1
|
+
import { describeValue, UnsupportedError } from "@ac-kit/core";
|
|
2
2
|
import { longitudeLatitudeCreate, longitudeLatitudeFromVec3, vec3FromLongitudeLatitude, } from "@ac-kit/math-geometry";
|
|
3
3
|
import { mat3x3Create, mat3x3FromRotationX, mat3x3FromRotationY, mat3x3FromRotationZ, mat3x3Multiply, vec2Create, vec2Of, vec3Create, } from "@ac-kit/math-linear";
|
|
4
4
|
import { angleNormalizeRad, DEG_TO_RAD } from "@ac-kit/math-scalar";
|
|
@@ -15,6 +15,27 @@ import { equirectangularProject, equirectangularUnproject, } from "./cylindrical
|
|
|
15
15
|
import { mercatorProject, mercatorUnproject } from "./cylindrical/mercator.js";
|
|
16
16
|
import { equalEarthProject, equalEarthUnproject, } from "./pseudo-cylindrical/equal-earth.js";
|
|
17
17
|
import { naturalEarthProject, naturalEarthUnproject, } from "./pseudo-cylindrical/natural-earth.js";
|
|
18
|
+
// The kinds of `ProjectionKind` that have no implementation yet.
|
|
19
|
+
const UNBUILT_KINDS_ = new Set(["albers-usa"]);
|
|
20
|
+
// The quarter turn about +X that the transverse Mercator applies after the
|
|
21
|
+
// spec's rotation, taking (X, Y, Z) to (X, −Z, Y): the central meridian's
|
|
22
|
+
// plane becomes the equator's, so that the Mercator of the turned sphere is
|
|
23
|
+
// the transverse Mercator, and the geometry functions' antimeridian of the
|
|
24
|
+
// turned sphere is the projection's own cut, the far half of the equator.
|
|
25
|
+
// Column-major, as `Mat3x3`.
|
|
26
|
+
function quarterTurn_() {
|
|
27
|
+
const matrix = mat3x3Create();
|
|
28
|
+
matrix[0] = 1;
|
|
29
|
+
matrix[1] = 0;
|
|
30
|
+
matrix[2] = 0;
|
|
31
|
+
matrix[3] = 0;
|
|
32
|
+
matrix[4] = 0;
|
|
33
|
+
matrix[5] = 1;
|
|
34
|
+
matrix[6] = 0;
|
|
35
|
+
matrix[7] = -1;
|
|
36
|
+
matrix[8] = 0;
|
|
37
|
+
return matrix;
|
|
38
|
+
}
|
|
18
39
|
const AZIMUTHAL_ = new Map([
|
|
19
40
|
[
|
|
20
41
|
"stereographic",
|
|
@@ -89,6 +110,24 @@ function longitudeLatitudeRaw_(spec) {
|
|
|
89
110
|
};
|
|
90
111
|
case "mercator":
|
|
91
112
|
return { project: mercatorProject, unproject: mercatorUnproject };
|
|
113
|
+
case "transverse-mercator": {
|
|
114
|
+
// The Mercator of the quarter-turned sphere, its plane turned back:
|
|
115
|
+
// x is the Mercator y, y minus the Mercator x.
|
|
116
|
+
const turned = vec2Create();
|
|
117
|
+
return {
|
|
118
|
+
project: (out, coords) => {
|
|
119
|
+
mercatorProject(turned, coords);
|
|
120
|
+
out[0] = turned[1];
|
|
121
|
+
out[1] = -turned[0];
|
|
122
|
+
return out;
|
|
123
|
+
},
|
|
124
|
+
unproject: (out, point) => {
|
|
125
|
+
turned[0] = -point[1];
|
|
126
|
+
turned[1] = point[0];
|
|
127
|
+
return mercatorUnproject(out, turned);
|
|
128
|
+
},
|
|
129
|
+
};
|
|
130
|
+
}
|
|
92
131
|
case "equal-earth":
|
|
93
132
|
return { project: equalEarthProject, unproject: equalEarthUnproject };
|
|
94
133
|
case "natural-earth":
|
|
@@ -167,17 +206,28 @@ function rotationFrom_(rotate) {
|
|
|
167
206
|
* Makes a projection from a spec, once (it computes constants and scratch
|
|
168
207
|
* values, and allocates the closures), for a chart that picks its projection
|
|
169
208
|
* from data. Each projection's own dedicated functions are the faster way when
|
|
170
|
-
* the kind is known.
|
|
209
|
+
* the kind is known. `transverse-mercator` is the spherical form
|
|
210
|
+
* (`transverseMercatorProject`), built as the Mercator of the sphere turned a
|
|
211
|
+
* quarter after `rotate`, as d3-geo's `geoTransverseMercator` does: `rotate:
|
|
212
|
+
* [−λ₀, 0]` puts the central meridian on `λ₀`. Its `center` is a point of the
|
|
213
|
+
* rotated sphere, as for every kind, where d3-geo reads it in the turned frame
|
|
214
|
+
* (`[−φ, λ]` there).
|
|
171
215
|
*
|
|
172
|
-
* @throws {
|
|
173
|
-
* `albers-usa`)
|
|
174
|
-
*
|
|
175
|
-
*
|
|
176
|
-
*
|
|
177
|
-
*
|
|
216
|
+
* @throws {UnsupportedError} For a kind not built yet (the composite
|
|
217
|
+
* `albers-usa`).
|
|
218
|
+
* @throws {RangeError} For an unknown kind, a non-finite `rotate`, `parallels`
|
|
219
|
+
* or `center`, a latitude among them (`rotate[1]`, `center[1]`, `parallels`)
|
|
220
|
+
* outside `[−90, 90]` or a `center` longitude outside `[−180, 180]` (checked
|
|
221
|
+
* before any conversion, so that none folds over a pole), parallels the conic
|
|
222
|
+
* families cannot use, or a `clipAngle` outside `(0, domain angle]`.
|
|
178
223
|
*/
|
|
179
224
|
export function projectionCreate(spec, options = {}) {
|
|
180
|
-
const { matrix: rotation, identity } = rotationFrom_(spec.rotate);
|
|
225
|
+
const { matrix: rotation, identity: rotationIdentity } = rotationFrom_(spec.rotate);
|
|
226
|
+
const transverse = spec.kind === "transverse-mercator";
|
|
227
|
+
if (transverse) {
|
|
228
|
+
mat3x3Multiply(rotation, quarterTurn_(), rotation);
|
|
229
|
+
}
|
|
230
|
+
const identity = rotationIdentity && !transverse;
|
|
181
231
|
if (spec.center !== undefined) {
|
|
182
232
|
assertDegrees_("center", spec.center, [2], [180, 90]);
|
|
183
233
|
}
|
|
@@ -187,7 +237,10 @@ export function projectionCreate(spec, options = {}) {
|
|
|
187
237
|
const azimuthal = AZIMUTHAL_.get(spec.kind);
|
|
188
238
|
const flat = azimuthal === undefined ? longitudeLatitudeRaw_(spec) : undefined;
|
|
189
239
|
if (azimuthal === undefined && flat === undefined) {
|
|
190
|
-
|
|
240
|
+
if (UNBUILT_KINDS_.has(spec.kind)) {
|
|
241
|
+
throw new UnsupportedError(`projectionCreate: the projection kind "${spec.kind}" is not built yet (the composite of insets comes with wave 3).`);
|
|
242
|
+
}
|
|
243
|
+
throw new RangeError(`projectionCreate: the projection kind ${describeValue(spec.kind)} is unknown.`);
|
|
191
244
|
}
|
|
192
245
|
let clipAngle = Number.POSITIVE_INFINITY;
|
|
193
246
|
if (azimuthal !== undefined) {
|
|
@@ -215,6 +268,13 @@ export function projectionCreate(spec, options = {}) {
|
|
|
215
268
|
let shiftY = 0;
|
|
216
269
|
if (spec.center !== undefined) {
|
|
217
270
|
vec3FromLongitudeLatitude(SCRATCH_VECTOR_, longitudeLatitudeOfDegrees_(spec.center[0], spec.center[1]));
|
|
271
|
+
if (transverse) {
|
|
272
|
+
// The centre is a point of the spec's rotated sphere; the quarter turn
|
|
273
|
+
// follows.
|
|
274
|
+
const y = SCRATCH_VECTOR_[1];
|
|
275
|
+
SCRATCH_VECTOR_[1] = -SCRATCH_VECTOR_[2];
|
|
276
|
+
SCRATCH_VECTOR_[2] = y;
|
|
277
|
+
}
|
|
218
278
|
rawProjectVector(SCRATCH_POINT_, SCRATCH_VECTOR_);
|
|
219
279
|
shiftX = SCRATCH_POINT_[0];
|
|
220
280
|
shiftY = SCRATCH_POINT_[1];
|
package/dist/projection.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"projection.js","sourceRoot":"","sources":["../src/projection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EAEN,uBAAuB,EACvB,yBAAyB,EAEzB,yBAAyB,GACzB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAEN,YAAY,EACZ,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,EACnB,cAAc,EAMd,UAAU,EACV,MAAM,EACN,UAAU,GACV,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEpE,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EACN,iCAAiC,EACjC,yBAAyB,EACzB,2BAA2B,GAC3B,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EACN,kCAAkC,EAClC,2BAA2B,EAC3B,6BAA6B,GAC7B,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EACN,qBAAqB,EACrB,eAAe,EACf,iBAAiB,GACjB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACN,yBAAyB,EACzB,mBAAmB,EACnB,qBAAqB,GACrB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EACN,0BAA0B,EAC1B,oBAAoB,EACpB,sBAAsB,GACtB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EACN,oBAAoB,EACpB,qBAAqB,EACrB,uBAAuB,GACvB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACN,gBAAgB,EAChB,oBAAoB,EACpB,qBAAqB,EACrB,uBAAuB,GACvB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EACN,sBAAsB,EACtB,uBAAuB,EACvB,yBAAyB,GACzB,MAAM,8BAA8B,C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,GAAG,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;AAExC,SAAS,2BAA2B,CACnC,SAAiB,EACjB,QAAgB;IAEhB,eAAe,CAAC,CAAC,CAAC,GAAG,SAAS,GAAG,UAAU,CAAC;IAC5C,eAAe,CAAC,CAAC,CAAC,GAAG,QAAQ,GAAG,UAAU,CAAC;IAC3C,OAAO,eAAe,CAAC;AACxB,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/** The sphere radius of EPSG:3857, WGS 84's equatorial radius, metres. */
|
|
2
|
+
export declare const WEB_MERCATOR_RADIUS_: number;
|
|
3
|
+
/**
|
|
4
|
+
* Half the side of the Web Mercator square, `π · a` metres: the plane x of the
|
|
5
|
+
* antimeridian and the plane y of the latitude limit. `2π · a` rounds to twice
|
|
6
|
+
* it exactly, so the side is exact too.
|
|
7
|
+
*/
|
|
8
|
+
export declare const WEB_MERCATOR_HALF_SIDE_: number;
|
|
9
|
+
/** The side of a WebMercatorQuad tile in cells. */
|
|
10
|
+
export declare const WEB_MERCATOR_TILE_SIZE_ = 256;
|
|
11
|
+
//# sourceMappingURL=_web-mercator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_web-mercator.d.ts","sourceRoot":"","sources":["../../src/tile/_web-mercator.ts"],"names":[],"mappings":"AAEA,0EAA0E;AAC1E,eAAO,MAAM,oBAAoB,QAAiC,CAAC;AAEnE;;;;GAIG;AACH,eAAO,MAAM,uBAAuB,QAAiC,CAAC;AAEtE,mDAAmD;AACnD,eAAO,MAAM,uBAAuB,MAAM,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ELLIPSOID_WGS84 } from "@ac-kit/math-geodesy";
|
|
2
|
+
/** The sphere radius of EPSG:3857, WGS 84's equatorial radius, metres. */
|
|
3
|
+
export const WEB_MERCATOR_RADIUS_ = ELLIPSOID_WGS84.semiMajorAxisM;
|
|
4
|
+
/**
|
|
5
|
+
* Half the side of the Web Mercator square, `π · a` metres: the plane x of the
|
|
6
|
+
* antimeridian and the plane y of the latitude limit. `2π · a` rounds to twice
|
|
7
|
+
* it exactly, so the side is exact too.
|
|
8
|
+
*/
|
|
9
|
+
export const WEB_MERCATOR_HALF_SIDE_ = Math.PI * WEB_MERCATOR_RADIUS_;
|
|
10
|
+
/** The side of a WebMercatorQuad tile in cells. */
|
|
11
|
+
export const WEB_MERCATOR_TILE_SIZE_ = 256;
|
|
12
|
+
//# sourceMappingURL=_web-mercator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_web-mercator.js","sourceRoot":"","sources":["../../src/tile/_web-mercator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAEvD,0EAA0E;AAC1E,MAAM,CAAC,MAAM,oBAAoB,GAAG,eAAe,CAAC,cAAc,CAAC;AAEnE;;;;GAIG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,IAAI,CAAC,EAAE,GAAG,oBAAoB,CAAC;AAEtE,mDAAmD;AACnD,MAAM,CAAC,MAAM,uBAAuB,GAAG,GAAG,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tile/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC;AACtC,cAAc,mBAAmB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/tile/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC;AACtC,cAAc,mBAAmB,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { type TileMatrixSet } from "@ac-kit/math-grid";
|
|
2
|
+
/**
|
|
3
|
+
* OGC WebMercatorQuad (OGC 17-083r4 Annex D.1), the tiling of Google Maps, Bing
|
|
4
|
+
* Maps and OpenStreetMap: EPSG:3857, a sphere of WGS 84's equatorial radius
|
|
5
|
+
* (`ELLIPSOID_WGS84.semiMajorAxisM` of `@ac-kit/math-geodesy`), 256-cell tiles,
|
|
6
|
+
* levels 0 to 24 with `2^level × 2^level` tiles numbered from the top left
|
|
7
|
+
* ("XYZ"). The cell sizes are computed, not the registry's 15 rounded digits:
|
|
8
|
+
* each level halves the last exactly, and the far edges of every matrix are `±π
|
|
9
|
+
* · a` exactly. Use it with the `tile…` functions of `@ac-kit/math-grid`;
|
|
10
|
+
* points are in metres, x east, y north.
|
|
11
|
+
*/
|
|
12
|
+
export declare const WEB_MERCATOR_QUAD: TileMatrixSet;
|
|
13
|
+
/**
|
|
14
|
+
* OGC WorldCRS84Quad (OGC 17-083r4 Annex D.2): plate carrée in CRS84
|
|
15
|
+
* (longitude, then latitude, in degrees), 256-cell tiles, levels 0 to 23 with
|
|
16
|
+
* `2^(level + 1) × 2^level` tiles numbered from the top left, so level 0 is two
|
|
17
|
+
* tiles, one per half of the longitudes. Its scale denominators use WGS 84's
|
|
18
|
+
* equatorial metres per degree: those of WebMercatorQuad one level deeper. Use
|
|
19
|
+
* it with the `tile…` functions of `@ac-kit/math-grid`; points are `[longitude,
|
|
20
|
+
* latitude]` in degrees.
|
|
21
|
+
*/
|
|
22
|
+
export declare const WORLD_CRS84_QUAD: TileMatrixSet;
|
|
23
|
+
//# sourceMappingURL=tile-matrix-sets.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tile-matrix-sets.d.ts","sourceRoot":"","sources":["../../src/tile/tile-matrix-sets.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,KAAK,aAAa,EAGlB,MAAM,mBAAmB,CAAC;AAU3B;;;;;;;;;GASG;AACH,eAAO,MAAM,iBAAiB,EAAE,aAuB9B,CAAC;AAQH;;;;;;;;GAQG;AACH,eAAO,MAAM,gBAAgB,EAAE,aAqB7B,CAAC"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { tileMatrixSetCreate, } from "@ac-kit/math-grid";
|
|
2
|
+
import { WEB_MERCATOR_HALF_SIDE_, WEB_MERCATOR_TILE_SIZE_, } from "./_web-mercator.js";
|
|
3
|
+
/** The standardised rendering cell of OGC 17-083r4 §6.1.1, metres. */
|
|
4
|
+
const RENDERING_CELL_M_ = 0.00028;
|
|
5
|
+
/**
|
|
6
|
+
* OGC WebMercatorQuad (OGC 17-083r4 Annex D.1), the tiling of Google Maps, Bing
|
|
7
|
+
* Maps and OpenStreetMap: EPSG:3857, a sphere of WGS 84's equatorial radius
|
|
8
|
+
* (`ELLIPSOID_WGS84.semiMajorAxisM` of `@ac-kit/math-geodesy`), 256-cell tiles,
|
|
9
|
+
* levels 0 to 24 with `2^level × 2^level` tiles numbered from the top left
|
|
10
|
+
* ("XYZ"). The cell sizes are computed, not the registry's 15 rounded digits:
|
|
11
|
+
* each level halves the last exactly, and the far edges of every matrix are `±π
|
|
12
|
+
* · a` exactly. Use it with the `tile…` functions of `@ac-kit/math-grid`;
|
|
13
|
+
* points are in metres, x east, y north.
|
|
14
|
+
*/
|
|
15
|
+
export const WEB_MERCATOR_QUAD = tileMatrixSetCreate({
|
|
16
|
+
id: "WebMercatorQuad",
|
|
17
|
+
title: "Google Maps Compatible for the World",
|
|
18
|
+
uri: "http://www.opengis.net/def/tilematrixset/OGC/1.0/WebMercatorQuad",
|
|
19
|
+
crs: "http://www.opengis.net/def/crs/EPSG/0/3857",
|
|
20
|
+
orderedAxes: ["X", "Y"],
|
|
21
|
+
axisOrder: "xy",
|
|
22
|
+
wellKnownScaleSet: "http://www.opengis.net/def/wkss/OGC/1.0/GoogleMapsCompatible",
|
|
23
|
+
tileMatrices: Array.from({ length: 25 }, (_, level) => {
|
|
24
|
+
const cellSize = (2 * WEB_MERCATOR_HALF_SIDE_) / (WEB_MERCATOR_TILE_SIZE_ * 2 ** level);
|
|
25
|
+
return {
|
|
26
|
+
id: String(level),
|
|
27
|
+
scaleDenominator: cellSize / RENDERING_CELL_M_,
|
|
28
|
+
cellSize,
|
|
29
|
+
pointOfOrigin: [-WEB_MERCATOR_HALF_SIDE_, WEB_MERCATOR_HALF_SIDE_],
|
|
30
|
+
tileWidth: WEB_MERCATOR_TILE_SIZE_,
|
|
31
|
+
tileHeight: WEB_MERCATOR_TILE_SIZE_,
|
|
32
|
+
matrixWidth: 2 ** level,
|
|
33
|
+
matrixHeight: 2 ** level,
|
|
34
|
+
};
|
|
35
|
+
}),
|
|
36
|
+
});
|
|
37
|
+
/**
|
|
38
|
+
* The metres of a degree on WGS 84's equator, `2π · a / 360`: the
|
|
39
|
+
* `metersPerUnit` of OGC 17-083r4 Table 7 for a CRS in degrees.
|
|
40
|
+
*/
|
|
41
|
+
const METRES_PER_DEGREE_ = (2 * WEB_MERCATOR_HALF_SIDE_) / 360;
|
|
42
|
+
/**
|
|
43
|
+
* OGC WorldCRS84Quad (OGC 17-083r4 Annex D.2): plate carrée in CRS84
|
|
44
|
+
* (longitude, then latitude, in degrees), 256-cell tiles, levels 0 to 23 with
|
|
45
|
+
* `2^(level + 1) × 2^level` tiles numbered from the top left, so level 0 is two
|
|
46
|
+
* tiles, one per half of the longitudes. Its scale denominators use WGS 84's
|
|
47
|
+
* equatorial metres per degree: those of WebMercatorQuad one level deeper. Use
|
|
48
|
+
* it with the `tile…` functions of `@ac-kit/math-grid`; points are `[longitude,
|
|
49
|
+
* latitude]` in degrees.
|
|
50
|
+
*/
|
|
51
|
+
export const WORLD_CRS84_QUAD = tileMatrixSetCreate({
|
|
52
|
+
id: "WorldCRS84Quad",
|
|
53
|
+
title: "CRS84 for the World",
|
|
54
|
+
uri: "http://www.opengis.net/def/tilematrixset/OGC/1.0/WorldCRS84Quad",
|
|
55
|
+
crs: "http://www.opengis.net/def/crs/OGC/1.3/CRS84",
|
|
56
|
+
orderedAxes: ["Lon", "Lat"],
|
|
57
|
+
axisOrder: "xy",
|
|
58
|
+
wellKnownScaleSet: "http://www.opengis.net/def/wkss/OGC/1.0/GoogleCRS84Quad",
|
|
59
|
+
tileMatrices: Array.from({ length: 24 }, (_, level) => {
|
|
60
|
+
const cellSize = 180 / (WEB_MERCATOR_TILE_SIZE_ * 2 ** level);
|
|
61
|
+
return {
|
|
62
|
+
id: String(level),
|
|
63
|
+
scaleDenominator: (cellSize * METRES_PER_DEGREE_) / RENDERING_CELL_M_,
|
|
64
|
+
cellSize,
|
|
65
|
+
pointOfOrigin: [-180, 90],
|
|
66
|
+
tileWidth: WEB_MERCATOR_TILE_SIZE_,
|
|
67
|
+
tileHeight: WEB_MERCATOR_TILE_SIZE_,
|
|
68
|
+
matrixWidth: 2 ** (level + 1),
|
|
69
|
+
matrixHeight: 2 ** level,
|
|
70
|
+
};
|
|
71
|
+
}),
|
|
72
|
+
});
|
|
73
|
+
//# sourceMappingURL=tile-matrix-sets.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tile-matrix-sets.js","sourceRoot":"","sources":["../../src/tile/tile-matrix-sets.ts"],"names":[],"mappings":"AAAA,OAAO,EAEN,mBAAmB,GAEnB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EACN,uBAAuB,EACvB,uBAAuB,GACvB,MAAM,oBAAoB,CAAC;AAE5B,sEAAsE;AACtE,MAAM,iBAAiB,GAAG,OAAQ,CAAC;AAEnC;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAkB,mBAAmB,CAAC;IACnE,EAAE,EAAE,iBAAiB;IACrB,KAAK,EAAE,sCAAsC;IAC7C,GAAG,EAAE,kEAAkE;IACvE,GAAG,EAAE,4CAA4C;IACjD,WAAW,EAAE,CAAC,GAAG,EAAE,GAAG,CAAC;IACvB,SAAS,EAAE,IAAI;IACf,iBAAiB,EAChB,8DAA8D;IAC/D,YAAY,EAAE,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC,EAAE,KAAK,EAAkB,EAAE;QACrE,MAAM,QAAQ,GACb,CAAC,CAAC,GAAG,uBAAuB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,EAAE,CAAC,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC;YAC7B,YAAY,EAAE,CAAC,IAAI,KAAK;SACxB,CAAC;IACH,CAAC,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import type { Box2, LongitudeLatitude, ReadonlyLongitudeLatitude } from "@ac-kit/math-geometry";
|
|
2
|
+
import { type TileIndex } from "@ac-kit/math-grid";
|
|
3
|
+
import { type ReadonlyVec2, type Vec2 } from "@ac-kit/math-linear";
|
|
4
|
+
/**
|
|
5
|
+
* The latitude limit of the Web Mercator square, `atan(sinh π)` radians (85.051
|
|
6
|
+
* 128 779 806 59°): the latitude whose plane y is `π · a`, the edge of
|
|
7
|
+
* WebMercatorQuad.
|
|
8
|
+
*/
|
|
9
|
+
export declare const WEB_MERCATOR_MAX_LATITUDE: number;
|
|
10
|
+
/**
|
|
11
|
+
* Writes the EPSG:3857 point of `coords` (longitude, latitude in radians) into
|
|
12
|
+
* `out`, in metres: `x = a · λ`, `y = a · asinh(tan φ)`. A pole gives `y = ±∞`;
|
|
13
|
+
* a latitude outside `[−π/2, π/2]` or a `NaN` gives `NaN`, and a longitude
|
|
14
|
+
* outside `(−π, π]` is kept as it is.
|
|
15
|
+
*
|
|
16
|
+
* @returns `out`.
|
|
17
|
+
*/
|
|
18
|
+
export declare function webMercatorProject(out: Vec2, coords: ReadonlyLongitudeLatitude): Vec2;
|
|
19
|
+
/**
|
|
20
|
+
* Writes the longitude and latitude, in radians, of the EPSG:3857 point `point`
|
|
21
|
+
* (metres) into `out`: `λ = x / a`, `φ = atan(sinh(y / a))`. Any y is a
|
|
22
|
+
* latitude (a far one a pole); a point with `|x| > π · a` gives `NaN`.
|
|
23
|
+
*
|
|
24
|
+
* @returns `out`.
|
|
25
|
+
*/
|
|
26
|
+
export declare function webMercatorUnproject(out: LongitudeLatitude, point: ReadonlyVec2): LongitudeLatitude;
|
|
27
|
+
/**
|
|
28
|
+
* Writes the EPSG:3857 point of every longitude–latitude pair of `input` into
|
|
29
|
+
* `out` (as many numbers), as {@link webMercatorProject} does for one. `out` may
|
|
30
|
+
* be `input`. O(n), no allocation.
|
|
31
|
+
*
|
|
32
|
+
* @returns `out`.
|
|
33
|
+
* @throws {RangeError} Unless `out` and `input` have the same even length.
|
|
34
|
+
*/
|
|
35
|
+
export declare function webMercatorProjectArray<T extends Float64Array>(out: T, input: Float64Array): T;
|
|
36
|
+
/**
|
|
37
|
+
* Writes the longitude–latitude pair of every EPSG:3857 point of `input` into
|
|
38
|
+
* `out` (as many numbers), as {@link webMercatorUnproject} does for one. `out`
|
|
39
|
+
* may be `input`. O(n), no allocation.
|
|
40
|
+
*
|
|
41
|
+
* @returns `out`.
|
|
42
|
+
* @throws {RangeError} Unless `out` and `input` have the same even length.
|
|
43
|
+
*/
|
|
44
|
+
export declare function webMercatorUnprojectArray<T extends Float64Array>(out: T, input: Float64Array): T;
|
|
45
|
+
/**
|
|
46
|
+
* The ground size of one WebMercatorQuad cell (a 256-pixel tile's pixel) at
|
|
47
|
+
* latitude `latitude` (radians) and zoom `zoom`, in metres on the sphere: `cos
|
|
48
|
+
* φ · 2π · a / (256 · 2^zoom)`, 156 543.03 m at the equator at zoom 0. The zoom
|
|
49
|
+
* is continuous, so a map drawn between levels gets its own value. `NaN` for a
|
|
50
|
+
* latitude outside `[−π/2, π/2]` or a `NaN`.
|
|
51
|
+
*/
|
|
52
|
+
export declare function webMercatorGroundResolution(latitude: number, zoom: number): number;
|
|
53
|
+
/**
|
|
54
|
+
* The scale denominator of a WebMercatorQuad map at latitude `latitude`
|
|
55
|
+
* (radians) and zoom `zoom` shown with pixels `pixelSizeM` metres wide (the
|
|
56
|
+
* standard OGC 0.28 mm by default; `0.0254 / dpi` for a screen of known
|
|
57
|
+
* density): the ground resolution over the pixel size. At the equator it is the
|
|
58
|
+
* scale denominator of the level. `NaN` for a latitude outside `[−π/2, π/2]`, a
|
|
59
|
+
* non-positive pixel size or a `NaN`.
|
|
60
|
+
*/
|
|
61
|
+
export declare function webMercatorScaleDenominator(latitude: number, zoom: number, pixelSizeM?: number): number;
|
|
62
|
+
/**
|
|
63
|
+
* Writes the WebMercatorQuad tile of level `level` holding `coords` (longitude,
|
|
64
|
+
* latitude in radians) into `out`, as tile servers count it: a longitude
|
|
65
|
+
* outside `[−π, π]` is wrapped into it, a latitude beyond
|
|
66
|
+
* {@link WEB_MERCATOR_MAX_LATITUDE} (a pole included) goes to the first or last
|
|
67
|
+
* row, the antimeridian at `+π` to the last column; otherwise as `tileAt` of
|
|
68
|
+
* `@ac-kit/math-grid`. `col` and `row` are `NaN` for a latitude outside `[−π/2,
|
|
69
|
+
* π/2]`, an infinite longitude, a `NaN` or a `NaN` level. O(1), no allocation.
|
|
70
|
+
*
|
|
71
|
+
* @returns `out`.
|
|
72
|
+
* @throws {RangeError} When `level` is not an integer from 0 to 24.
|
|
73
|
+
*/
|
|
74
|
+
export declare function webMercatorTileAt(out: TileIndex, coords: ReadonlyLongitudeLatitude, level: number): TileIndex;
|
|
75
|
+
/**
|
|
76
|
+
* Writes the extent of the WebMercatorQuad tile `tile` as longitudes and
|
|
77
|
+
* latitudes in radians into `out`, `[west, south, east, north]`, from the
|
|
78
|
+
* indices directly (`λ = 2π · col / 2^level − π`, `φ = atan(sinh(π − 2π · row /
|
|
79
|
+
* 2^level))`), so the tiles of a level share their edges exactly and the outer
|
|
80
|
+
* ones end at `±π` and `±` {@link WEB_MERCATOR_MAX_LATITUDE}. `NaN` components
|
|
81
|
+
* for a `NaN` index. O(1), no allocation.
|
|
82
|
+
*
|
|
83
|
+
* @returns `out`.
|
|
84
|
+
* @throws {RangeError} When `tile` is not a tile of WebMercatorQuad.
|
|
85
|
+
*/
|
|
86
|
+
export declare function webMercatorTileLongitudeLatitudeBounds(out: Box2, tile: Readonly<TileIndex>): Box2;
|
|
87
|
+
//# sourceMappingURL=web-mercator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"web-mercator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AG,EAAE,IAAI,EACT,IAAI,EAAE,QAAQ,CAAC,SAAS,CAAC,GACvB,IAAI,CAaN"}
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
import { tileAt, tileBounds } from "@ac-kit/math-grid";
|
|
2
|
+
import { vec2Create } from "@ac-kit/math-linear";
|
|
3
|
+
import { elementCount_ } from "../_array-length.js";
|
|
4
|
+
import { isometricLatitude_ } from "../_isometric.js";
|
|
5
|
+
import { WEB_MERCATOR_HALF_SIDE_, WEB_MERCATOR_RADIUS_, WEB_MERCATOR_TILE_SIZE_, } from "./_web-mercator.js";
|
|
6
|
+
import { WEB_MERCATOR_QUAD } from "./tile-matrix-sets.js";
|
|
7
|
+
// Web Mercator, EPSG:3857 ("WGS 84 / Pseudo-Mercator"): the spherical Mercator
|
|
8
|
+
// of `mercatorProject` on a sphere of WGS 84's equatorial radius `a`, applied
|
|
9
|
+
// to WGS 84 longitudes and latitudes as if they were spherical (IOGP Guidance
|
|
10
|
+
// Note 7-2, method 1024). Neither conformal nor equal to the ellipsoidal
|
|
11
|
+
// Mercator (EPSG:3395) it resembles; the y of a latitude differs by up to
|
|
12
|
+
// about 43 km.
|
|
13
|
+
/**
|
|
14
|
+
* The latitude limit of the Web Mercator square, `atan(sinh π)` radians (85.051
|
|
15
|
+
* 128 779 806 59°): the latitude whose plane y is `π · a`, the edge of
|
|
16
|
+
* WebMercatorQuad.
|
|
17
|
+
*/
|
|
18
|
+
export const WEB_MERCATOR_MAX_LATITUDE = Math.atan(Math.sinh(Math.PI));
|
|
19
|
+
/**
|
|
20
|
+
* Writes the EPSG:3857 point of `coords` (longitude, latitude in radians) into
|
|
21
|
+
* `out`, in metres: `x = a · λ`, `y = a · asinh(tan φ)`. A pole gives `y = ±∞`;
|
|
22
|
+
* a latitude outside `[−π/2, π/2]` or a `NaN` gives `NaN`, and a longitude
|
|
23
|
+
* outside `(−π, π]` is kept as it is.
|
|
24
|
+
*
|
|
25
|
+
* @returns `out`.
|
|
26
|
+
*/
|
|
27
|
+
export function webMercatorProject(out, coords) {
|
|
28
|
+
out[0] = WEB_MERCATOR_RADIUS_ * coords[0];
|
|
29
|
+
out[1] = WEB_MERCATOR_RADIUS_ * isometricLatitude_(coords[1]);
|
|
30
|
+
return out;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Writes the longitude and latitude, in radians, of the EPSG:3857 point `point`
|
|
34
|
+
* (metres) into `out`: `λ = x / a`, `φ = atan(sinh(y / a))`. Any y is a
|
|
35
|
+
* latitude (a far one a pole); a point with `|x| > π · a` gives `NaN`.
|
|
36
|
+
*
|
|
37
|
+
* @returns `out`.
|
|
38
|
+
*/
|
|
39
|
+
export function webMercatorUnproject(out, point) {
|
|
40
|
+
const x = point[0];
|
|
41
|
+
const y = point[1];
|
|
42
|
+
const valid = Math.abs(x) <= WEB_MERCATOR_HALF_SIDE_ && y === y;
|
|
43
|
+
out[0] = valid ? x / WEB_MERCATOR_RADIUS_ : Number.NaN;
|
|
44
|
+
out[1] = valid ? Math.atan(Math.sinh(y / WEB_MERCATOR_RADIUS_)) : Number.NaN;
|
|
45
|
+
return out;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Writes the EPSG:3857 point of every longitude–latitude pair of `input` into
|
|
49
|
+
* `out` (as many numbers), as {@link webMercatorProject} does for one. `out` may
|
|
50
|
+
* be `input`. O(n), no allocation.
|
|
51
|
+
*
|
|
52
|
+
* @returns `out`.
|
|
53
|
+
* @throws {RangeError} Unless `out` and `input` have the same even length.
|
|
54
|
+
*/
|
|
55
|
+
export function webMercatorProjectArray(out, input) {
|
|
56
|
+
const count = elementCount_("webMercatorProjectArray", out, input, 2, 2);
|
|
57
|
+
for (let index = 0; index < count; index++) {
|
|
58
|
+
out[2 * index] = WEB_MERCATOR_RADIUS_ * input[2 * index];
|
|
59
|
+
out[2 * index + 1] =
|
|
60
|
+
WEB_MERCATOR_RADIUS_ * isometricLatitude_(input[2 * index + 1]);
|
|
61
|
+
}
|
|
62
|
+
return out;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Writes the longitude–latitude pair of every EPSG:3857 point of `input` into
|
|
66
|
+
* `out` (as many numbers), as {@link webMercatorUnproject} does for one. `out`
|
|
67
|
+
* may be `input`. O(n), no allocation.
|
|
68
|
+
*
|
|
69
|
+
* @returns `out`.
|
|
70
|
+
* @throws {RangeError} Unless `out` and `input` have the same even length.
|
|
71
|
+
*/
|
|
72
|
+
export function webMercatorUnprojectArray(out, input) {
|
|
73
|
+
const count = elementCount_("webMercatorUnprojectArray", out, input, 2, 2);
|
|
74
|
+
for (let index = 0; index < count; index++) {
|
|
75
|
+
const x = input[2 * index];
|
|
76
|
+
const y = input[2 * index + 1];
|
|
77
|
+
const valid = Math.abs(x) <= WEB_MERCATOR_HALF_SIDE_ && y === y;
|
|
78
|
+
out[2 * index] = valid ? x / WEB_MERCATOR_RADIUS_ : Number.NaN;
|
|
79
|
+
out[2 * index + 1] = valid
|
|
80
|
+
? Math.atan(Math.sinh(y / WEB_MERCATOR_RADIUS_))
|
|
81
|
+
: Number.NaN;
|
|
82
|
+
}
|
|
83
|
+
return out;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* The ground size of one WebMercatorQuad cell (a 256-pixel tile's pixel) at
|
|
87
|
+
* latitude `latitude` (radians) and zoom `zoom`, in metres on the sphere: `cos
|
|
88
|
+
* φ · 2π · a / (256 · 2^zoom)`, 156 543.03 m at the equator at zoom 0. The zoom
|
|
89
|
+
* is continuous, so a map drawn between levels gets its own value. `NaN` for a
|
|
90
|
+
* latitude outside `[−π/2, π/2]` or a `NaN`.
|
|
91
|
+
*/
|
|
92
|
+
export function webMercatorGroundResolution(latitude, zoom) {
|
|
93
|
+
if (!(Math.abs(latitude) <= Math.PI / 2)) {
|
|
94
|
+
return Number.NaN;
|
|
95
|
+
}
|
|
96
|
+
return ((Math.cos(latitude) * (2 * WEB_MERCATOR_HALF_SIDE_)) /
|
|
97
|
+
(WEB_MERCATOR_TILE_SIZE_ * 2 ** zoom));
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* The scale denominator of a WebMercatorQuad map at latitude `latitude`
|
|
101
|
+
* (radians) and zoom `zoom` shown with pixels `pixelSizeM` metres wide (the
|
|
102
|
+
* standard OGC 0.28 mm by default; `0.0254 / dpi` for a screen of known
|
|
103
|
+
* density): the ground resolution over the pixel size. At the equator it is the
|
|
104
|
+
* scale denominator of the level. `NaN` for a latitude outside `[−π/2, π/2]`, a
|
|
105
|
+
* non-positive pixel size or a `NaN`.
|
|
106
|
+
*/
|
|
107
|
+
export function webMercatorScaleDenominator(latitude, zoom, pixelSizeM = 0.00028) {
|
|
108
|
+
if (!(pixelSizeM > 0)) {
|
|
109
|
+
return Number.NaN;
|
|
110
|
+
}
|
|
111
|
+
return webMercatorGroundResolution(latitude, zoom) / pixelSizeM;
|
|
112
|
+
}
|
|
113
|
+
const POINT_ = vec2Create();
|
|
114
|
+
/**
|
|
115
|
+
* Writes the WebMercatorQuad tile of level `level` holding `coords` (longitude,
|
|
116
|
+
* latitude in radians) into `out`, as tile servers count it: a longitude
|
|
117
|
+
* outside `[−π, π]` is wrapped into it, a latitude beyond
|
|
118
|
+
* {@link WEB_MERCATOR_MAX_LATITUDE} (a pole included) goes to the first or last
|
|
119
|
+
* row, the antimeridian at `+π` to the last column; otherwise as `tileAt` of
|
|
120
|
+
* `@ac-kit/math-grid`. `col` and `row` are `NaN` for a latitude outside `[−π/2,
|
|
121
|
+
* π/2]`, an infinite longitude, a `NaN` or a `NaN` level. O(1), no allocation.
|
|
122
|
+
*
|
|
123
|
+
* @returns `out`.
|
|
124
|
+
* @throws {RangeError} When `level` is not an integer from 0 to 24.
|
|
125
|
+
*/
|
|
126
|
+
export function webMercatorTileAt(out, coords, level) {
|
|
127
|
+
let longitude = coords[0];
|
|
128
|
+
const latitude = coords[1];
|
|
129
|
+
if (!(Math.abs(latitude) <= Math.PI / 2) || longitude - longitude !== 0) {
|
|
130
|
+
POINT_[0] = Number.NaN;
|
|
131
|
+
POINT_[1] = Number.NaN;
|
|
132
|
+
return tileAt(out, WEB_MERCATOR_QUAD, level, POINT_);
|
|
133
|
+
}
|
|
134
|
+
if (longitude < -Math.PI || longitude > Math.PI) {
|
|
135
|
+
longitude -=
|
|
136
|
+
2 * Math.PI * Math.floor((longitude + Math.PI) / (2 * Math.PI));
|
|
137
|
+
}
|
|
138
|
+
const half = WEB_MERCATOR_HALF_SIDE_;
|
|
139
|
+
POINT_[0] = Math.min(Math.max(WEB_MERCATOR_RADIUS_ * longitude, -half), half);
|
|
140
|
+
POINT_[1] = Math.min(Math.max(WEB_MERCATOR_RADIUS_ * isometricLatitude_(latitude), -half), half);
|
|
141
|
+
return tileAt(out, WEB_MERCATOR_QUAD, level, POINT_);
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Writes the extent of the WebMercatorQuad tile `tile` as longitudes and
|
|
145
|
+
* latitudes in radians into `out`, `[west, south, east, north]`, from the
|
|
146
|
+
* indices directly (`λ = 2π · col / 2^level − π`, `φ = atan(sinh(π − 2π · row /
|
|
147
|
+
* 2^level))`), so the tiles of a level share their edges exactly and the outer
|
|
148
|
+
* ones end at `±π` and `±` {@link WEB_MERCATOR_MAX_LATITUDE}. `NaN` components
|
|
149
|
+
* for a `NaN` index. O(1), no allocation.
|
|
150
|
+
*
|
|
151
|
+
* @returns `out`.
|
|
152
|
+
* @throws {RangeError} When `tile` is not a tile of WebMercatorQuad.
|
|
153
|
+
*/
|
|
154
|
+
export function webMercatorTileLongitudeLatitudeBounds(out, tile) {
|
|
155
|
+
tileBounds(out, WEB_MERCATOR_QUAD, tile);
|
|
156
|
+
if (out[0] !== out[0]) {
|
|
157
|
+
return out;
|
|
158
|
+
}
|
|
159
|
+
const size = 2 ** tile.level;
|
|
160
|
+
out[0] = ((2 * Math.PI) / size) * tile.col - Math.PI;
|
|
161
|
+
out[2] = ((2 * Math.PI) / size) * (tile.col + 1) - Math.PI;
|
|
162
|
+
out[3] = Math.atan(Math.sinh(Math.PI - ((2 * Math.PI) / size) * tile.row));
|
|
163
|
+
out[1] = Math.atan(Math.sinh(Math.PI - ((2 * Math.PI) / size) * (tile.row + 1)));
|
|
164
|
+
return out;
|
|
165
|
+
}
|
|
166
|
+
//# sourceMappingURL=web-mercator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"web-mercator.js","sourceRoot":"","sources":["../../src/tile/web-mercator.ts"],"names":[],"mappings":"AAKA,OAAO,EAAkB,MAAM,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACvE,OAAO,EAAgC,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAE/E,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,EACN,uBAAuB,EACvB,oBAAoB,EACpB,uBAAuB,GACvB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAE1D,+EAA+E;AAC/E,8EAA8E;AAC9E,8EAA8E;AAC9E,yEAAyE;AACzE,0EAA0E;AAC1E,eAAe;AAEf;;;;GAIG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC;AAEvE;;;;;;;GAOG;AACH,MAAM,UAAU,kBAAkB,CACjC,GAAS,EACT,MAAiC;IAEjC,GAAG,CAAC,CAAC,CAAC,GAAG,oBAAoB,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;IAC1C,GAAG,CAAC,CAAC,CAAC,GAAG,oBAAoB,GAAG,kBAAkB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;IAC9D,OAAO,GAAG,CAAC;AACZ,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,oBAAoB,CACnC,GAAsB,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,CAAC,CAAC,CAAC;IAC3E,GAAG,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,IAAI,CACjB,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,CAC5D,CAAC;IACF,OAAO,GAAG,CAAC;AACZ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ac-kit/math-map-projection",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "Point maps between the sphere and the plane: azimuthal, cylindrical, conic and pseudo-cylindrical map and sky projections,
|
|
3
|
+
"version": "0.3.0",
|
|
4
|
+
"description": "Point maps between the sphere and the plane: azimuthal, cylindrical, conic and pseudo-cylindrical map and sky projections, the cutting, resampling and graticules a map needs, and the Web Mercator tile matrix sets.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"azimuthal",
|
|
7
7
|
"cartography",
|
|
@@ -45,17 +45,20 @@
|
|
|
45
45
|
"prepack": "yarn build"
|
|
46
46
|
},
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"@ac-kit/core": "^0.
|
|
49
|
-
"@ac-kit/math-
|
|
50
|
-
"@ac-kit/math-
|
|
51
|
-
"@ac-kit/math-
|
|
48
|
+
"@ac-kit/core": "^0.14.0",
|
|
49
|
+
"@ac-kit/math-geodesy": "^0.2.0",
|
|
50
|
+
"@ac-kit/math-geometry": "^0.5.0",
|
|
51
|
+
"@ac-kit/math-grid": "^0.5.0",
|
|
52
|
+
"@ac-kit/math-linear": "^0.5.0",
|
|
53
|
+
"@ac-kit/math-scalar": "^0.5.0",
|
|
52
54
|
"@types/web": "^0.0.367"
|
|
53
55
|
},
|
|
54
56
|
"devDependencies": {
|
|
55
|
-
"@ac-kit/math-random": "0.4.
|
|
57
|
+
"@ac-kit/math-random": "0.4.2",
|
|
58
|
+
"@ac-kit/test-util": "0.5.1",
|
|
56
59
|
"@ac-kit/tsconfig": "0.1.0",
|
|
57
60
|
"@ac-kit/typedoc-config": "0.1.0",
|
|
58
|
-
"@ac-kit/vitest-config": "0.
|
|
61
|
+
"@ac-kit/vitest-config": "0.3.0",
|
|
59
62
|
"@types/d3-geo": "3.1.1",
|
|
60
63
|
"@types/node": "26.6.11",
|
|
61
64
|
"@typescript/native": "typescript@7.0.2",
|