@math.gl/geospatial 5.0.0-rc.2 → 5.0.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.
Files changed (232) hide show
  1. package/README.md +6 -6
  2. package/dist/coordinates.cjs +2523 -0
  3. package/dist/coordinates.cjs.map +6 -0
  4. package/dist/coordinates.d.ts +4 -0
  5. package/dist/coordinates.d.ts.map +1 -1
  6. package/dist/coordinates.js +2 -0
  7. package/dist/coordinates.js.map +1 -1
  8. package/dist/entries/ellipsoid.cjs +1209 -0
  9. package/dist/entries/ellipsoid.cjs.map +6 -0
  10. package/dist/entries/ellipsoid.d.ts +3 -19
  11. package/dist/entries/ellipsoid.d.ts.map +1 -1
  12. package/dist/entries/ellipsoid.js +1 -9
  13. package/dist/entries/ellipsoid.js.map +1 -1
  14. package/dist/expressions.cjs +726 -0
  15. package/dist/expressions.cjs.map +6 -0
  16. package/dist/geodesics.cjs +3195 -0
  17. package/dist/geodesics.cjs.map +6 -0
  18. package/dist/geodesics.d.ts +18 -0
  19. package/dist/geodesics.d.ts.map +1 -0
  20. package/dist/geodesics.js +13 -0
  21. package/dist/geodesics.js.map +1 -0
  22. package/dist/geographic-atlas/sampling.d.ts +1 -1
  23. package/dist/geographic-atlas/sampling.d.ts.map +1 -1
  24. package/dist/geographic-atlas/sampling.js +1 -1
  25. package/dist/geographic-atlas/sampling.js.map +1 -1
  26. package/dist/geographic-cuts.cjs +4160 -0
  27. package/dist/geographic-cuts.cjs.map +6 -0
  28. package/dist/geographic-cuts.d.ts +2 -0
  29. package/dist/geographic-cuts.d.ts.map +1 -1
  30. package/dist/geographic-cuts.js +1 -0
  31. package/dist/geographic-cuts.js.map +1 -1
  32. package/dist/geographic-seams/subdivide-cut.d.ts +1 -1
  33. package/dist/geographic-seams/subdivide-cut.d.ts.map +1 -1
  34. package/dist/geographic-seams/subdivide-cut.js +1 -1
  35. package/dist/geographic-seams/subdivide-cut.js.map +1 -1
  36. package/dist/geographic-seams/types.shared.cjs +32 -0
  37. package/dist/geographic-seams/types.shared.cjs.map +6 -0
  38. package/dist/globe.cjs +4223 -0
  39. package/dist/globe.cjs.map +6 -0
  40. package/dist/index.d.ts +2 -0
  41. package/dist/index.d.ts.map +1 -1
  42. package/dist/index.js +2 -0
  43. package/dist/index.js.map +1 -1
  44. package/dist/maps/map-transition.shared.cjs +364 -0
  45. package/dist/maps/map-transition.shared.cjs.map +6 -0
  46. package/dist/maps/myriahedral/unfold.d.ts +1 -1
  47. package/dist/maps/myriahedral/unfold.d.ts.map +1 -1
  48. package/dist/maps/myriahedral/unfold.js +1 -1
  49. package/dist/maps/myriahedral/unfold.js.map +1 -1
  50. package/dist/maps/presets.cjs +2 -2
  51. package/dist/maps/presets.cjs.map +2 -2
  52. package/dist/maps/transitions.cjs +3 -342
  53. package/dist/maps/transitions.cjs.map +3 -3
  54. package/dist/maps.cjs +15 -319
  55. package/dist/maps.cjs.map +3 -3
  56. package/dist/projection/experimental/core.cjs +63 -1317
  57. package/dist/projection/experimental/core.cjs.map +3 -3
  58. package/dist/projection/experimental/core.d.ts +1 -1
  59. package/dist/projection/experimental/core.d.ts.map +1 -1
  60. package/dist/projection/experimental/crs/projjson.cjs +26 -45
  61. package/dist/projection/experimental/crs/projjson.cjs.map +3 -3
  62. package/dist/projection/experimental/crs/types.shared.cjs +44 -0
  63. package/dist/projection/experimental/crs/types.shared.cjs.map +6 -0
  64. package/dist/projection/experimental/crs/wkt.cjs +36 -52
  65. package/dist/projection/experimental/crs/wkt.cjs.map +3 -3
  66. package/dist/projection/experimental/entries/projections/ob_tran.cjs +9 -23
  67. package/dist/projection/experimental/entries/projections/ob_tran.cjs.map +3 -3
  68. package/dist/projection/experimental/lazy-projections/aea.cjs +1 -1
  69. package/dist/projection/experimental/lazy-projections/aea.js +1 -1
  70. package/dist/projection/experimental/lazy-projections/aeqd.cjs +1 -1
  71. package/dist/projection/experimental/lazy-projections/aeqd.js +1 -1
  72. package/dist/projection/experimental/lazy-projections/bonne.cjs +1 -1
  73. package/dist/projection/experimental/lazy-projections/bonne.js +1 -1
  74. package/dist/projection/experimental/lazy-projections/cass.cjs +1 -1
  75. package/dist/projection/experimental/lazy-projections/cass.js +1 -1
  76. package/dist/projection/experimental/lazy-projections/cea.cjs +1 -1
  77. package/dist/projection/experimental/lazy-projections/cea.js +1 -1
  78. package/dist/projection/experimental/lazy-projections/eck6.cjs +1 -1
  79. package/dist/projection/experimental/lazy-projections/eck6.js +1 -1
  80. package/dist/projection/experimental/lazy-projections/eqc.cjs +1 -1
  81. package/dist/projection/experimental/lazy-projections/eqc.js +1 -1
  82. package/dist/projection/experimental/lazy-projections/eqdc.cjs +1 -1
  83. package/dist/projection/experimental/lazy-projections/eqdc.js +1 -1
  84. package/dist/projection/experimental/lazy-projections/eqearth.cjs +1 -1
  85. package/dist/projection/experimental/lazy-projections/eqearth.js +1 -1
  86. package/dist/projection/experimental/lazy-projections/equi.cjs +1 -1
  87. package/dist/projection/experimental/lazy-projections/equi.js +1 -1
  88. package/dist/projection/experimental/lazy-projections/etmerc.cjs +1 -1
  89. package/dist/projection/experimental/lazy-projections/etmerc.js +1 -1
  90. package/dist/projection/experimental/lazy-projections/geocent.cjs +1 -1
  91. package/dist/projection/experimental/lazy-projections/geocent.js +1 -1
  92. package/dist/projection/experimental/lazy-projections/geos.cjs +1 -1
  93. package/dist/projection/experimental/lazy-projections/geos.js +1 -1
  94. package/dist/projection/experimental/lazy-projections/gnom.cjs +1 -1
  95. package/dist/projection/experimental/lazy-projections/gnom.js +1 -1
  96. package/dist/projection/experimental/lazy-projections/gstmerc.cjs +1 -1
  97. package/dist/projection/experimental/lazy-projections/gstmerc.js +1 -1
  98. package/dist/projection/experimental/lazy-projections/index.cjs +60 -903
  99. package/dist/projection/experimental/lazy-projections/index.cjs.map +3 -3
  100. package/dist/projection/experimental/lazy-projections/krovak.cjs +1 -1
  101. package/dist/projection/experimental/lazy-projections/krovak.js +1 -1
  102. package/dist/projection/experimental/lazy-projections/laea.cjs +1 -1
  103. package/dist/projection/experimental/lazy-projections/laea.js +1 -1
  104. package/dist/projection/experimental/lazy-projections/lcc.cjs +1 -1
  105. package/dist/projection/experimental/lazy-projections/lcc.js +1 -1
  106. package/dist/projection/experimental/lazy-projections/merc.cjs +1 -1
  107. package/dist/projection/experimental/lazy-projections/merc.js +1 -1
  108. package/dist/projection/experimental/lazy-projections/mill.cjs +1 -1
  109. package/dist/projection/experimental/lazy-projections/mill.js +1 -1
  110. package/dist/projection/experimental/lazy-projections/moll.cjs +1 -1
  111. package/dist/projection/experimental/lazy-projections/moll.js +1 -1
  112. package/dist/projection/experimental/lazy-projections/nzmg.cjs +1 -1
  113. package/dist/projection/experimental/lazy-projections/nzmg.js +1 -1
  114. package/dist/projection/experimental/lazy-projections/ob_tran.cjs +1 -1
  115. package/dist/projection/experimental/lazy-projections/ob_tran.js +1 -1
  116. package/dist/projection/experimental/lazy-projections/omerc.cjs +1 -1
  117. package/dist/projection/experimental/lazy-projections/omerc.js +1 -1
  118. package/dist/projection/experimental/lazy-projections/ortho.cjs +1 -1
  119. package/dist/projection/experimental/lazy-projections/ortho.js +1 -1
  120. package/dist/projection/experimental/lazy-projections/poly.cjs +1 -1
  121. package/dist/projection/experimental/lazy-projections/poly.js +1 -1
  122. package/dist/projection/experimental/lazy-projections/qsc.cjs +1 -1
  123. package/dist/projection/experimental/lazy-projections/qsc.js +1 -1
  124. package/dist/projection/experimental/lazy-projections/robin.cjs +1 -1
  125. package/dist/projection/experimental/lazy-projections/robin.js +1 -1
  126. package/dist/projection/experimental/lazy-projections/sinu.cjs +1 -1
  127. package/dist/projection/experimental/lazy-projections/sinu.js +1 -1
  128. package/dist/projection/experimental/lazy-projections/somerc.cjs +1 -1
  129. package/dist/projection/experimental/lazy-projections/somerc.js +1 -1
  130. package/dist/projection/experimental/lazy-projections/stere.cjs +1 -1
  131. package/dist/projection/experimental/lazy-projections/stere.js +1 -1
  132. package/dist/projection/experimental/lazy-projections/sterea.cjs +1 -1
  133. package/dist/projection/experimental/lazy-projections/sterea.js +1 -1
  134. package/dist/projection/experimental/lazy-projections/tmerc.cjs +1 -1
  135. package/dist/projection/experimental/lazy-projections/tmerc.js +1 -1
  136. package/dist/projection/experimental/lazy-projections/tpers.cjs +1 -1
  137. package/dist/projection/experimental/lazy-projections/tpers.js +1 -1
  138. package/dist/projection/experimental/lazy-projections/utm.cjs +1 -1
  139. package/dist/projection/experimental/lazy-projections/utm.js +1 -1
  140. package/dist/projection/experimental/lazy-projections/vandg.cjs +1 -1
  141. package/dist/projection/experimental/lazy-projections/vandg.js +1 -1
  142. package/dist/projection/experimental/projection-engine.shared.cjs +1184 -0
  143. package/dist/projection/experimental/projection-engine.shared.cjs.map +6 -0
  144. package/dist/projection/experimental/typescript-projection.shared.cjs +1703 -0
  145. package/dist/projection/experimental/typescript-projection.shared.cjs.map +6 -0
  146. package/dist/projection/index.cjs +622 -1535
  147. package/dist/projection/index.cjs.map +3 -3
  148. package/dist/projection/pipeline.cjs +44 -58
  149. package/dist/projection/pipeline.cjs.map +3 -3
  150. package/dist/projection/transform-analysis.cjs +20 -936
  151. package/dist/projection/transform-analysis.cjs.map +3 -3
  152. package/dist/subdivide-geodesic-polyline.d.ts +1 -1
  153. package/dist/subdivide-geodesic-polyline.d.ts.map +1 -1
  154. package/dist/subdivide-geodesic-polyline.js +1 -1
  155. package/dist/subdivide-geodesic-polyline.js.map +1 -1
  156. package/dist/subdivide-globe-mesh.d.ts +1 -1
  157. package/dist/subdivide-globe-mesh.d.ts.map +1 -1
  158. package/dist/subdivide-globe-mesh.js +1 -1
  159. package/dist/subdivide-globe-mesh.js.map +1 -1
  160. package/dist/subdivide-rhumb-polyline.d.ts +1 -1
  161. package/dist/subdivide-rhumb-polyline.d.ts.map +1 -1
  162. package/dist/subdivide-rhumb-polyline.js +1 -1
  163. package/dist/subdivide-rhumb-polyline.js.map +1 -1
  164. package/dist/tasks/index.cjs +808 -2993
  165. package/dist/tasks/index.cjs.map +3 -3
  166. package/dist/terrain/geometry.d.ts +1 -1
  167. package/dist/terrain/geometry.d.ts.map +1 -1
  168. package/dist/terrain/geometry.js +1 -1
  169. package/dist/terrain/geometry.js.map +1 -1
  170. package/dist/terrain/index.cjs +2 -2
  171. package/dist/terrain/index.cjs.map +1 -1
  172. package/dist/tiles.cjs +354 -0
  173. package/dist/tiles.cjs.map +6 -0
  174. package/package.json +139 -117
  175. package/src/coordinates.ts +5 -0
  176. package/src/entries/ellipsoid.ts +7 -32
  177. package/src/geodesics.ts +40 -0
  178. package/src/geographic-atlas/sampling.ts +1 -1
  179. package/src/geographic-cuts.ts +21 -0
  180. package/src/geographic-seams/subdivide-cut.ts +1 -1
  181. package/src/index.ts +2 -0
  182. package/src/maps/myriahedral/unfold.ts +1 -1
  183. package/src/projection/experimental/core.ts +1 -1
  184. package/src/projection/experimental/lazy-projections/aea.ts +1 -1
  185. package/src/projection/experimental/lazy-projections/aeqd.ts +1 -1
  186. package/src/projection/experimental/lazy-projections/bonne.ts +1 -1
  187. package/src/projection/experimental/lazy-projections/cass.ts +1 -1
  188. package/src/projection/experimental/lazy-projections/cea.ts +1 -1
  189. package/src/projection/experimental/lazy-projections/eck6.ts +1 -1
  190. package/src/projection/experimental/lazy-projections/eqc.ts +1 -1
  191. package/src/projection/experimental/lazy-projections/eqdc.ts +1 -1
  192. package/src/projection/experimental/lazy-projections/eqearth.ts +1 -1
  193. package/src/projection/experimental/lazy-projections/equi.ts +1 -1
  194. package/src/projection/experimental/lazy-projections/etmerc.ts +1 -1
  195. package/src/projection/experimental/lazy-projections/geocent.ts +1 -1
  196. package/src/projection/experimental/lazy-projections/geos.ts +1 -1
  197. package/src/projection/experimental/lazy-projections/gnom.ts +1 -1
  198. package/src/projection/experimental/lazy-projections/gstmerc.ts +1 -1
  199. package/src/projection/experimental/lazy-projections/krovak.ts +1 -1
  200. package/src/projection/experimental/lazy-projections/laea.ts +1 -1
  201. package/src/projection/experimental/lazy-projections/lcc.ts +1 -1
  202. package/src/projection/experimental/lazy-projections/merc.ts +1 -1
  203. package/src/projection/experimental/lazy-projections/mill.ts +1 -1
  204. package/src/projection/experimental/lazy-projections/moll.ts +1 -1
  205. package/src/projection/experimental/lazy-projections/nzmg.ts +1 -1
  206. package/src/projection/experimental/lazy-projections/ob_tran.ts +1 -1
  207. package/src/projection/experimental/lazy-projections/omerc.ts +1 -1
  208. package/src/projection/experimental/lazy-projections/ortho.ts +1 -1
  209. package/src/projection/experimental/lazy-projections/poly.ts +1 -1
  210. package/src/projection/experimental/lazy-projections/qsc.ts +1 -1
  211. package/src/projection/experimental/lazy-projections/robin.ts +1 -1
  212. package/src/projection/experimental/lazy-projections/sinu.ts +1 -1
  213. package/src/projection/experimental/lazy-projections/somerc.ts +1 -1
  214. package/src/projection/experimental/lazy-projections/stere.ts +1 -1
  215. package/src/projection/experimental/lazy-projections/sterea.ts +1 -1
  216. package/src/projection/experimental/lazy-projections/tmerc.ts +1 -1
  217. package/src/projection/experimental/lazy-projections/tpers.ts +1 -1
  218. package/src/projection/experimental/lazy-projections/utm.ts +1 -1
  219. package/src/projection/experimental/lazy-projections/vandg.ts +1 -1
  220. package/src/subdivide-geodesic-polyline.ts +2 -2
  221. package/src/subdivide-globe-mesh.ts +2 -2
  222. package/src/subdivide-rhumb-polyline.ts +2 -2
  223. package/src/terrain/geometry.ts +1 -1
  224. package/dist/index.cjs +0 -18674
  225. package/dist/index.cjs.map +0 -6
  226. package/dist/turf-expressions.cjs +0 -1997
  227. package/dist/turf-expressions.cjs.map +0 -6
  228. package/dist/turf-expressions.d.ts +0 -3
  229. package/dist/turf-expressions.d.ts.map +0 -1
  230. package/dist/turf-expressions.js +0 -7
  231. package/dist/turf-expressions.js.map +0 -1
  232. package/src/turf-expressions.ts +0 -7
package/dist/maps.cjs CHANGED
@@ -33,8 +33,8 @@ __export(maps_exports, {
33
33
  MAP_PROJECTIONS: () => MAP_PROJECTIONS,
34
34
  MYRIAHEDRAL_PRESETS: () => MYRIAHEDRAL_PRESETS,
35
35
  MapEngine: () => MapEngine,
36
- MapTransition: () => MapTransition,
37
- MapTransitionGeometry: () => MapTransitionGeometry,
36
+ MapTransition: () => import_map_transition2.MapTransition,
37
+ MapTransitionGeometry: () => import_map_transition2.MapTransitionGeometry,
38
38
  MyriahedralMap: () => MyriahedralMap,
39
39
  REGIONAL_PROJECTIONS: () => REGIONAL_PROJECTIONS,
40
40
  WORLD_PROJECTIONS: () => WORLD_PROJECTIONS,
@@ -1894,7 +1894,7 @@ function createGraticule(columns) {
1894
1894
 
1895
1895
  // dist/maps/myriahedral/unfold.js
1896
1896
  var import_matrix2 = require("@math.gl/core/matrix");
1897
- var import_geometry = require("@math.gl/geometry");
1897
+ var import_primitives = require("@math.gl/geometry/primitives");
1898
1898
 
1899
1899
  // dist/maps/myriahedral/mesh.js
1900
1900
  var subtract3 = (a, b) => [a[0] - b[0], a[1] - b[1], a[2] - b[2]];
@@ -2137,7 +2137,7 @@ function restoreLayout(data) {
2137
2137
  const { mesh, panels, targetAngles } = data;
2138
2138
  if (panels.length !== mesh.faces.length || targetAngles.length !== panels.length || !targetAngles.every(Number.isFinite) || data.rootTransform.length !== 16 || !data.rootTransform.every(Number.isFinite))
2139
2139
  throw new Error("Invalid prepared hinge layout");
2140
- const tree = new import_geometry.HingeTree(panels);
2140
+ const tree = new import_primitives.HingeTree(panels);
2141
2141
  const rootTransform = new import_matrix2.Matrix4(data.rootTransform);
2142
2142
  const poses = new Float64Array(panels.length * 16), angles = new Float64Array(panels.length);
2143
2143
  const evaluate = (amount) => {
@@ -7266,316 +7266,11 @@ function parseElasticMap(text, options = {}) {
7266
7266
  return { version: 1, name: first[1], radius: options.radius ?? 6371, sections };
7267
7267
  }
7268
7268
 
7269
- // dist/maps/map-transition.js
7270
- var import_polygon_clipping2 = __toESM(require("polygon-clipping"), 1);
7271
- var directWorldProjections = /* @__PURE__ */ new Set([
7272
- "gilbert",
7273
- "aitoff",
7274
- "august",
7275
- "baker",
7276
- "boggs",
7277
- "bromley",
7278
- "collignon",
7279
- "craster",
7280
- "eckert1",
7281
- "eckert2",
7282
- "eckert3",
7283
- "eckert4",
7284
- "eckert5",
7285
- "eckert6",
7286
- "fahey",
7287
- "foucaut",
7288
- "ginzburg4",
7289
- "ginzburg5",
7290
- "ginzburg6",
7291
- "ginzburg8",
7292
- "ginzburg9",
7293
- "homolosine",
7294
- "kavrayskiy7",
7295
- "larrivee",
7296
- "laskowski",
7297
- "miller",
7298
- "mollweide",
7299
- "mt-flat-polar-parabolic",
7300
- "mt-flat-polar-quartic",
7301
- "mt-flat-polar-sinusoidal",
7302
- "natural-earth2",
7303
- "nell-hammer",
7304
- "patterson",
7305
- "robinson",
7306
- "sinusoidal",
7307
- "times",
7308
- "van-der-grinten",
7309
- "van-der-grinten2",
7310
- "van-der-grinten3",
7311
- "van-der-grinten4",
7312
- "wagner4",
7313
- "wagner6",
7314
- "winkel3",
7315
- "bonne",
7316
- "bottomley",
7317
- "cylindrical-equal-area",
7318
- "cylindrical-stereographic",
7319
- "foucaut-sinusoidal",
7320
- "hammer",
7321
- "hill",
7322
- "hufnagel",
7323
- "hyperelliptical",
7324
- "lagrange",
7325
- "loximuthal",
7326
- "wagner7",
7327
- "quartic-authalic",
7328
- "wagner"
7329
- ]);
7330
- var MapTransitionGeometry = class {
7331
- constructor(parts, strategy, radius) {
7332
- this.strategy = strategy;
7333
- this.radius = radius;
7334
- this.parts = Object.freeze(parts.map((p) => Object.freeze({
7335
- ...p,
7336
- sourceCoordinates: freezeRings(p.sourceCoordinates),
7337
- from: freezeRings(p.from),
7338
- to: freezeRings(p.to)
7339
- })));
7340
- }
7341
- evaluate(amount) {
7342
- validateAmount(amount);
7343
- return this.parts.flatMap((part) => {
7344
- const sourcePhase = part.sourceRegionId !== void 0;
7345
- const blend = Math.max(0, Math.min(1, (amount - 0.4) / 0.2));
7346
- const opacity = this.strategy === "direct" ? 1 : sourcePhase ? 1 - blend : blend;
7347
- if (!opacity)
7348
- return [];
7349
- const t = this.strategy === "direct" ? amount : sourcePhase ? Math.min(1, amount / 0.4) : Math.max(0, (amount - 0.6) / 0.4);
7350
- return [
7351
- {
7352
- kind: part.kind,
7353
- sourceRegionId: part.sourceRegionId,
7354
- targetRegionId: part.targetRegionId,
7355
- opacity,
7356
- coordinates: part.sourceCoordinates.map((ring, j) => ring.map((p, i) => {
7357
- const a = part.from[j][i], b = part.to[j][i];
7358
- if (this.strategy === "direct")
7359
- return [a[0] * (1 - t) + b[0] * t, a[1] * (1 - t) + b[1] * t, 0];
7360
- const globe = geographic(p).map((v) => v * this.radius);
7361
- const flat = sourcePhase ? a : b, weight = sourcePhase ? 1 - t : t;
7362
- return [
7363
- flat[0] * weight + globe[0] * (1 - weight),
7364
- flat[1] * weight + globe[1] * (1 - weight),
7365
- globe[2] * (1 - weight)
7366
- ];
7367
- }))
7368
- }
7369
- ];
7370
- });
7371
- }
7372
- };
7373
- var MapTransition = class {
7374
- constructor(source, target, options = {}) {
7375
- this.source = source;
7376
- this.target = target;
7377
- const requested = options.strategy ?? "auto";
7378
- if (!["auto", "direct", "via-globe"].includes(requested))
7379
- throw new Error("Unknown transition strategy");
7380
- const compatible = source === target || fullCoverage(source) && fullCoverage(target);
7381
- if (requested === "direct" && !compatible)
7382
- throw new Error("Direct morph requires complete supported geographic coverage; use auto or via-globe");
7383
- this.strategy = requested === "via-globe" ? "via-globe" : compatible ? "direct" : "via-globe";
7384
- this.reason = this.strategy === "direct" ? "Geometry is refined against both maps before interpolating corresponding geographic positions." : "Coverage or surface topology requires separate source and destination geometry through the globe.";
7385
- }
7386
- projectPoint(position2, amount) {
7387
- validateAmount(amount);
7388
- const a = this.source.projectPoint(position2), b = this.target.projectPoint(position2);
7389
- if (this.strategy === "direct")
7390
- return a && b ? [
7391
- a.position[0] * (1 - amount) + b.position[0] * amount,
7392
- a.position[1] * (1 - amount) + b.position[1] * amount,
7393
- 0
7394
- ] : null;
7395
- const hit = amount < 0.5 ? a : b;
7396
- if (!hit)
7397
- return null;
7398
- const t = amount < 0.5 ? Math.max(0, 1 - amount / 0.4) : Math.max(0, (amount - 0.6) / 0.4);
7399
- const globe = geographic(position2).map((v) => v * this.globeRadius);
7400
- return [
7401
- hit.position[0] * t + globe[0] * (1 - t),
7402
- hit.position[1] * t + globe[1] * (1 - t),
7403
- globe[2] * (1 - t)
7404
- ];
7405
- }
7406
- get globeRadius() {
7407
- return Math.max(this.source.description.radius ?? 1, this.target.description.radius ?? 1);
7408
- }
7409
- prepareLine(line, options) {
7410
- const first = this.source.projectLine(line, options), last = this.target.projectLine(line, options);
7411
- const parts = [];
7412
- if (this.strategy === "direct" && this.source === this.target) {
7413
- for (const p of first)
7414
- parts.push({
7415
- kind: "line",
7416
- sourceRegionId: p.regionId,
7417
- targetRegionId: p.regionId,
7418
- sourceCoordinates: [p.sourceCoordinates],
7419
- from: [p.coordinates],
7420
- to: [p.coordinates]
7421
- });
7422
- } else if (this.strategy === "direct") {
7423
- for (const a of first)
7424
- for (const b of this.target.projectLine(a.sourceCoordinates, options)) {
7425
- const source = this.source.regions.find((r) => r.id === a.regionId);
7426
- parts.push({
7427
- kind: "line",
7428
- sourceRegionId: a.regionId,
7429
- targetRegionId: b.regionId,
7430
- sourceCoordinates: [b.sourceCoordinates],
7431
- from: [b.sourceCoordinates.map((p) => placed(source, p))],
7432
- to: [b.coordinates]
7433
- });
7434
- }
7435
- } else {
7436
- for (const p of first)
7437
- parts.push({
7438
- kind: "line",
7439
- sourceRegionId: p.regionId,
7440
- sourceCoordinates: [p.sourceCoordinates],
7441
- from: [p.coordinates],
7442
- to: [p.coordinates]
7443
- });
7444
- for (const p of last)
7445
- parts.push({
7446
- kind: "line",
7447
- targetRegionId: p.regionId,
7448
- sourceCoordinates: [p.sourceCoordinates],
7449
- from: [p.coordinates],
7450
- to: [p.coordinates]
7451
- });
7452
- }
7453
- return new MapTransitionGeometry(parts, this.strategy, this.globeRadius);
7454
- }
7455
- preparePolygon(rings, options) {
7456
- const first = this.source.projectPolygon(rings, options), last = this.target.projectPolygon(rings, options), parts = [];
7457
- if (this.strategy === "direct" && this.source === this.target) {
7458
- for (const p of first)
7459
- parts.push({
7460
- kind: "polygon",
7461
- sourceRegionId: p.regionId,
7462
- targetRegionId: p.regionId,
7463
- sourceCoordinates: p.sourceCoordinates,
7464
- from: p.coordinates,
7465
- to: p.coordinates
7466
- });
7467
- } else if (this.strategy === "direct") {
7468
- for (const a of first) {
7469
- const source = this.source.regions.find((r) => r.id === a.regionId);
7470
- const left = geographicRings(a.sourceCoordinates);
7471
- const center3 = left[0][0][0];
7472
- for (const b of last) {
7473
- const target = this.target.regions.find((r) => r.id === b.regionId);
7474
- const right = geographicRings(b.sourceCoordinates, center3);
7475
- for (const rings2 of import_polygon_clipping2.default.intersection(left, right)) {
7476
- const coordinates2 = rings2;
7477
- parts.push({
7478
- kind: "polygon",
7479
- sourceRegionId: a.regionId,
7480
- targetRegionId: b.regionId,
7481
- sourceCoordinates: coordinates2,
7482
- from: coordinates2.map((r) => r.map((p) => placed(source, p))),
7483
- to: coordinates2.map((r) => r.map((p) => placed(target, p)))
7484
- });
7485
- }
7486
- }
7487
- }
7488
- } else {
7489
- for (const p of first)
7490
- parts.push({
7491
- kind: "polygon",
7492
- sourceRegionId: p.regionId,
7493
- sourceCoordinates: p.sourceCoordinates,
7494
- from: p.coordinates,
7495
- to: p.coordinates
7496
- });
7497
- for (const p of last)
7498
- parts.push({
7499
- kind: "polygon",
7500
- targetRegionId: p.regionId,
7501
- sourceCoordinates: p.sourceCoordinates,
7502
- from: p.coordinates,
7503
- to: p.coordinates
7504
- });
7505
- }
7506
- return new MapTransitionGeometry(parts, this.strategy, this.globeRadius);
7507
- }
7508
- };
7509
- function placed(region, p) {
7510
- const q = region.project(p), [a, b, c, d, x, y] = region.placement ?? [1, 0, 0, 1, 0, 0];
7511
- const result = [a * q[0] + c * q[1] + x, b * q[0] + d * q[1] + y];
7512
- if (!result.every(Number.isFinite))
7513
- throw new Error("Undefined projection in common transition coverage");
7514
- return result;
7515
- }
7516
- function freezeRings(rings) {
7517
- return Object.freeze(rings.map((r) => Object.freeze(r.map((p) => Object.freeze([...p])))));
7518
- }
7519
- function validateAmount(t) {
7520
- if (!Number.isFinite(t) || t < 0 || t > 1)
7521
- throw new Error("Transition amount must be within [0,1]");
7522
- }
7523
- var coverageCache = /* @__PURE__ */ new WeakMap();
7524
- function fullCoverage(map) {
7525
- const cached = coverageCache.get(map);
7526
- if (cached !== void 0)
7527
- return cached;
7528
- const d = map.description.definition;
7529
- let covered = false;
7530
- if (d.type === "elastic") {
7531
- const world = rectangle(-180, -90, 180, 90);
7532
- let completeSections = true;
7533
- const domains = d.data.sections.map((s) => {
7534
- const domain = s.complement ? import_polygon_clipping2.default.difference(world, [s.boundary]) : import_polygon_clipping2.default.intersection(world, [s.boundary]);
7535
- const runs = [];
7536
- for (let y = 0; y < s.rows - 1; y++) {
7537
- let start = -1;
7538
- for (let x = 0; x < s.columns; x++) {
7539
- const valid2 = x < s.columns - 1 && [
7540
- y * s.columns + x,
7541
- y * s.columns + x + 1,
7542
- (y + 1) * s.columns + x,
7543
- (y + 1) * s.columns + x + 1
7544
- ].every((i) => s.values[2 * i] !== null);
7545
- if (valid2 && start < 0)
7546
- start = x;
7547
- if (!valid2 && start >= 0) {
7548
- runs.push(rectangle(-180 + 360 * start / (s.columns - 1), -90 + 180 * y / (s.rows - 1), -180 + 360 * x / (s.columns - 1), -90 + 180 * (y + 1) / (s.rows - 1)));
7549
- start = -1;
7550
- }
7551
- }
7552
- }
7553
- const valid = runs.length ? import_polygon_clipping2.default.union(runs[0], ...runs.slice(1)) : [];
7554
- if (!valid.length || import_polygon_clipping2.default.difference(domain, valid).length)
7555
- completeSections = false;
7556
- return valid.length ? import_polygon_clipping2.default.intersection(domain, valid) : [];
7557
- });
7558
- const overlaps = domains.some((domain, i) => domains.slice(i + 1).some((other) => import_polygon_clipping2.default.intersection(domain, other).length > 0));
7559
- covered = completeSections && !overlaps && import_polygon_clipping2.default.difference(world, ...domains).length === 0;
7560
- } else if (d.type === "world") {
7561
- covered = directWorldProjections.has(d.projection) && Object.keys(d.parameters ?? {}).length === 0;
7562
- }
7563
- coverageCache.set(map, covered);
7564
- return covered;
7565
- }
7566
- function geographicRings(rings, center3) {
7567
- return rings.map((ring) => {
7568
- let previous = center3 ?? ring[0][0];
7569
- return ring.map(([lon, lat]) => {
7570
- const x = lon + 360 * Math.round((previous - lon) / 360);
7571
- previous = x;
7572
- return [Math.round(x * 1e9) / 1e9, Math.round(lat * 1e9) / 1e9];
7573
- });
7574
- });
7575
- }
7269
+ // dist/maps.js
7270
+ var import_map_transition2 = require("./maps/map-transition.shared.cjs");
7576
7271
 
7577
7272
  // dist/maps/global-polygons.js
7578
- var import_polygon_clipping3 = __toESM(require("polygon-clipping"), 1);
7273
+ var import_polygon_clipping2 = __toESM(require("polygon-clipping"), 1);
7579
7274
  var TOL = 2e-12;
7580
7275
  var arcCross = (a, b) => cross(a, [b[0] - a[0], b[1] - a[1], b[2] - a[2]]);
7581
7276
  var angle3 = (a, b) => Math.atan2(Math.hypot(...arcCross(a, b)), dot(a, b));
@@ -7710,14 +7405,14 @@ function cutSphericalPolygon(rings, options) {
7710
7405
  }
7711
7406
  if (!outer.length)
7712
7407
  continue;
7713
- const merged = outer.length === 1 ? [outer] : import_polygon_clipping3.default.union([outer[0]], ...outer.slice(1).map((r) => [r]));
7714
- const filled = holes.length ? import_polygon_clipping3.default.difference(merged, ...holes.map((r) => [r])) : merged;
7408
+ const merged = outer.length === 1 ? [outer] : import_polygon_clipping2.default.union([outer[0]], ...outer.slice(1).map((r) => [r]));
7409
+ const filled = holes.length ? import_polygon_clipping2.default.difference(merged, ...holes.map((r) => [r])) : merged;
7715
7410
  const mask = [
7716
7411
  [sx, 0, 0],
7717
7412
  [0, sy, 0],
7718
7413
  [0, 0, sz]
7719
7414
  ].map((p) => [dot(x, p) / dot(center3, p), dot(y, p) / dot(center3, p)]);
7720
- const polygons = import_polygon_clipping3.default.intersection(filled, [mask]);
7415
+ const polygons = import_polygon_clipping2.default.intersection(filled, [mask]);
7721
7416
  for (const polygon of polygons) {
7722
7417
  let vectors = polygon.map((r) => r.map(([a, b]) => unit([0, 1, 2].map((i) => center3[i] + a * x[i] + b * y[i]))));
7723
7418
  vectors = vectors.map((r) => {
@@ -8910,7 +8605,7 @@ var mapPresets = [
8910
8605
  ];
8911
8606
 
8912
8607
  // dist/maps/geometry.js
8913
- var import_polygon_clipping4 = __toESM(require("polygon-clipping"), 1);
8608
+ var import_polygon_clipping3 = __toESM(require("polygon-clipping"), 1);
8914
8609
 
8915
8610
  // dist/maps/prepare-features.js
8916
8611
  var vertices = () => ({ positions: [], sourcePositions: [] });
@@ -9143,11 +8838,12 @@ function prepareMapFeatures(map, features, options = {}) {
9143
8838
  }
9144
8839
 
9145
8840
  // dist/maps/geometry.js
9146
- var mapGeometry = { polygonClipping: import_polygon_clipping4.default, projectSphericalPolygon, prepareMapFeatures };
8841
+ var mapGeometry = { polygonClipping: import_polygon_clipping3.default, projectSphericalPolygon, prepareMapFeatures };
9147
8842
  function withMapGeometry(map) {
9148
- return Object.assign(map, { polygonClipping: import_polygon_clipping4.default });
8843
+ return Object.assign(map, { polygonClipping: import_polygon_clipping3.default });
9149
8844
  }
9150
8845
 
9151
8846
  // dist/maps/transitions.js
9152
- var mapTransitions = { MapTransition };
8847
+ var import_map_transition = require("./maps/map-transition.shared.cjs");
8848
+ var mapTransitions = { MapTransition: import_map_transition.MapTransition };
9153
8849
  //# sourceMappingURL=maps.cjs.map