proj4 2.20.3 → 2.20.5

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/bower.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "proj4",
3
- "version": "2.20.3",
3
+ "version": "2.20.5",
4
4
  "description": "Proj4js is a JavaScript library to transform point coordinates from one coordinate system to another, including datum transformations.",
5
5
  "homepage": "https://github.com/proj4js/proj4js",
6
6
  "main": "dist/proj4.js",
package/component.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "proj4",
3
- "version": "2.20.3",
3
+ "version": "2.20.5",
4
4
  "description": "Proj4js is a JavaScript library to transform point coordinates from one coordinate system to another, including datum transformations.",
5
5
  "repo": "proj4js/proj4js",
6
6
  "keywords": [
@@ -1712,4 +1712,112 @@ declare namespace datums {
1712
1712
  let towgs84_409: string;
1713
1713
  export { towgs84_409 as towgs84 };
1714
1714
  }
1715
+ namespace EPSG_10328 {
1716
+ let towgs84_410: string;
1717
+ export { towgs84_410 as towgs84 };
1718
+ }
1719
+ namespace EPSG_9782 {
1720
+ let towgs84_411: string;
1721
+ export { towgs84_411 as towgs84 };
1722
+ }
1723
+ namespace EPSG_9777 {
1724
+ let towgs84_412: string;
1725
+ export { towgs84_412 as towgs84 };
1726
+ }
1727
+ namespace EPSG_10690 {
1728
+ let towgs84_413: string;
1729
+ export { towgs84_413 as towgs84 };
1730
+ }
1731
+ namespace EPSG_10639 {
1732
+ let towgs84_414: string;
1733
+ export { towgs84_414 as towgs84 };
1734
+ }
1735
+ namespace EPSG_10739 {
1736
+ let towgs84_415: string;
1737
+ export { towgs84_415 as towgs84 };
1738
+ }
1739
+ namespace EPSG_7686 {
1740
+ let towgs84_416: string;
1741
+ export { towgs84_416 as towgs84 };
1742
+ }
1743
+ namespace EPSG_8900 {
1744
+ let towgs84_417: string;
1745
+ export { towgs84_417 as towgs84 };
1746
+ }
1747
+ namespace EPSG_5886 {
1748
+ let towgs84_418: string;
1749
+ export { towgs84_418 as towgs84 };
1750
+ }
1751
+ namespace EPSG_7683 {
1752
+ let towgs84_419: string;
1753
+ export { towgs84_419 as towgs84 };
1754
+ }
1755
+ namespace EPSG_6668 {
1756
+ let towgs84_420: string;
1757
+ export { towgs84_420 as towgs84 };
1758
+ }
1759
+ namespace EPSG_20046 {
1760
+ let towgs84_421: string;
1761
+ export { towgs84_421 as towgs84 };
1762
+ }
1763
+ namespace EPSG_10299 {
1764
+ let towgs84_422: string;
1765
+ export { towgs84_422 as towgs84 };
1766
+ }
1767
+ namespace EPSG_10310 {
1768
+ let towgs84_423: string;
1769
+ export { towgs84_423 as towgs84 };
1770
+ }
1771
+ namespace EPSG_10475 {
1772
+ let towgs84_424: string;
1773
+ export { towgs84_424 as towgs84 };
1774
+ }
1775
+ namespace EPSG_4742 {
1776
+ let towgs84_425: string;
1777
+ export { towgs84_425 as towgs84 };
1778
+ }
1779
+ namespace EPSG_10671 {
1780
+ let towgs84_426: string;
1781
+ export { towgs84_426 as towgs84 };
1782
+ }
1783
+ namespace EPSG_10762 {
1784
+ let towgs84_427: string;
1785
+ export { towgs84_427 as towgs84 };
1786
+ }
1787
+ namespace EPSG_10725 {
1788
+ let towgs84_428: string;
1789
+ export { towgs84_428 as towgs84 };
1790
+ }
1791
+ namespace EPSG_10791 {
1792
+ let towgs84_429: string;
1793
+ export { towgs84_429 as towgs84 };
1794
+ }
1795
+ namespace EPSG_10800 {
1796
+ let towgs84_430: string;
1797
+ export { towgs84_430 as towgs84 };
1798
+ }
1799
+ namespace EPSG_10305 {
1800
+ let towgs84_431: string;
1801
+ export { towgs84_431 as towgs84 };
1802
+ }
1803
+ namespace EPSG_10941 {
1804
+ let towgs84_432: string;
1805
+ export { towgs84_432 as towgs84 };
1806
+ }
1807
+ namespace EPSG_10968 {
1808
+ let towgs84_433: string;
1809
+ export { towgs84_433 as towgs84 };
1810
+ }
1811
+ namespace EPSG_10875 {
1812
+ let towgs84_434: string;
1813
+ export { towgs84_434 as towgs84 };
1814
+ }
1815
+ namespace EPSG_6318 {
1816
+ let towgs84_435: string;
1817
+ export { towgs84_435 as towgs84 };
1818
+ }
1819
+ namespace EPSG_10910 {
1820
+ let towgs84_436: string;
1821
+ export { towgs84_436 as towgs84 };
1822
+ }
1715
1823
  }
@@ -10,6 +10,7 @@
10
10
  /** @this {import('../defs.js').ProjectionDefinition & LocalThis} */
11
11
  export function init(this: import("../defs.js").ProjectionDefinition & LocalThis): void;
12
12
  export class init {
13
+ long0: number;
13
14
  en: number[];
14
15
  n: number;
15
16
  m: number;
package/dist/proj4-src.js CHANGED
@@ -305,10 +305,11 @@
305
305
  if (abbreviation === 'E') direction = 'east';
306
306
  else if (abbreviation === 'N') direction = 'north';
307
307
  else if (abbreviation === 'U') direction = 'up';
308
+ else if (node[2]) direction = node[2];
308
309
  else throw new Error(`Unknown axis abbreviation: ${abbreviation}`);
309
310
  } else {
310
311
  // Use the explicit direction provided in the AXIS node
311
- direction = node[2] ? node[2].toLowerCase() : 'unknown';
312
+ direction = node[2] || 'unknown';
312
313
  }
313
314
 
314
315
  const orderNode = node.find((child) => Array.isArray(child) && child[0] === 'ORDER');
@@ -368,7 +369,8 @@
368
369
 
369
370
  case 'BASEGEOGCRS':
370
371
  case 'GEOGCRS':
371
- result.type = 'GeographicCRS';
372
+ case 'GEODCRS':
373
+ result.type = node[0] === 'GEODCRS' ? 'GeodeticCRS' : 'GeographicCRS';
372
374
  result.name = node[1];
373
375
 
374
376
  // Handle DATUM or ENSEMBLE
@@ -992,8 +994,8 @@
992
994
  // Normalize projName for WKT2 compatibility
993
995
  const normalizedProjName = (wkt.projName || '').toLowerCase().replace(/_/g, ' ');
994
996
 
995
- if (!wkt.long0 && wkt.longc && (normalizedProjName === 'albers conic equal area' || normalizedProjName === 'lambert azimuthal equal area')) {
996
- wkt.long0 = wkt.longc;
997
+ if (wkt.long0 === undefined && wkt.longc !== undefined) {
998
+ wkt.long0 = wkt.longc; // keep in the projection's native prime meridian frame
997
999
  }
998
1000
  if (!wkt.lat_ts && wkt.lat1 && (normalizedProjName === 'stereographic south pole' || normalizedProjName === 'polar stereographic (variant b)')) {
999
1001
  wkt.lat0 = d2r(wkt.lat1 > 0 ? 90 : -90);
@@ -1089,6 +1091,12 @@
1089
1091
  case 'type':
1090
1092
  if (value === 'GeographicCRS') {
1091
1093
  result.projName = 'longlat';
1094
+ } else if (value === 'GeodeticCRS') {
1095
+ if (projjson.coordinate_system && projjson.coordinate_system.subtype === 'Cartesian') {
1096
+ result.projName = 'geocent';
1097
+ } else {
1098
+ result.projName = 'longlat';
1099
+ }
1092
1100
  } else if (value === 'ProjectedCRS' && projjson.conversion && projjson.conversion.method) {
1093
1101
  result.projName = projjson.conversion.method.name; // Retain original capitalization
1094
1102
  }
@@ -1117,16 +1125,24 @@
1117
1125
 
1118
1126
  case 'coordinate_system':
1119
1127
  if (value.axis) {
1120
- result.axis = value.axis
1121
- .map((axis) => {
1122
- const direction = axis.direction;
1123
- if (direction === 'east') return 'e';
1124
- if (direction === 'north') return 'n';
1125
- if (direction === 'west') return 'w';
1126
- if (direction === 'south') return 's';
1127
- throw new Error(`Unknown axis direction: ${direction}`);
1128
- })
1129
- .join('') + 'u'; // Combine into a single string (e.g., "enu")
1128
+ const directionMap = {
1129
+ 'east': 'e',
1130
+ 'north': 'n',
1131
+ 'west': 'w',
1132
+ 'south': 's',
1133
+ 'up': 'u',
1134
+ 'down': 'd',
1135
+ 'geocentricx': 'e',
1136
+ 'geocentricy': 'n',
1137
+ 'geocentricz': 'u',
1138
+ };
1139
+ const mapped = value.axis.map((axis) => directionMap[axis.direction.toLowerCase()]);
1140
+ if (mapped.every(Boolean)) {
1141
+ result.axis = mapped.join('');
1142
+ if (result.axis.length === 2) {
1143
+ result.axis += 'u';
1144
+ }
1145
+ }
1130
1146
 
1131
1147
  if (value.unit) {
1132
1148
  const { units, to_meter } = processUnit(value.unit);
@@ -1354,9 +1370,9 @@
1354
1370
  geogcs = wkt;
1355
1371
  }
1356
1372
  if (geogcs) {
1357
- //if(wkt.GEOGCS.PRIMEM&&wkt.GEOGCS.PRIMEM.convert){
1358
- // wkt.from_greenwich=wkt.GEOGCS.PRIMEM.convert*D2R;
1359
- //}
1373
+ if (geogcs.PRIMEM && geogcs.PRIMEM.convert) {
1374
+ wkt.from_greenwich = d2r(geogcs.PRIMEM.convert);
1375
+ }
1360
1376
  if (geogcs.DATUM) {
1361
1377
  wkt.datumCode = geogcs.DATUM.name.toLowerCase();
1362
1378
  } else {
@@ -1384,7 +1400,7 @@
1384
1400
  }
1385
1401
 
1386
1402
  wkt.a = geogcs.DATUM.SPHEROID.a;
1387
- wkt.rf = parseFloat(geogcs.DATUM.SPHEROID.rf, 10);
1403
+ wkt.rf = parseFloat(geogcs.DATUM.SPHEROID.rf);
1388
1404
  }
1389
1405
 
1390
1406
  if (geogcs.DATUM && geogcs.DATUM.TOWGS84) {
@@ -1623,31 +1639,27 @@
1623
1639
  * @returns {import('./defs').ProjectionDefinition}
1624
1640
  */
1625
1641
  function parse(code) {
1642
+ let out;
1626
1643
  if (testObj(code)) {
1627
1644
  // check to see if this is a WKT string
1628
1645
  if (testDef(code)) {
1629
- return defs[code];
1630
- }
1631
- if (testWKT(code)) {
1632
- var out = wkt(code);
1633
- // test of spetial case, due to this being a very common and often malformed
1634
- if (checkMercator(out)) {
1635
- return defs['EPSG:3857'];
1636
- }
1646
+ out = defs[code];
1647
+ } else if (testWKT(code)) {
1648
+ out = wkt(code);
1637
1649
  var maybeProjStr = checkProjStr(out);
1638
1650
  if (maybeProjStr) {
1639
- return projStr(maybeProjStr);
1651
+ out = projStr(maybeProjStr);
1640
1652
  }
1641
- return out;
1642
- }
1643
- if (testProj(code)) {
1644
- return projStr(code);
1653
+ } else if (testProj(code)) {
1654
+ out = projStr(code);
1645
1655
  }
1646
1656
  } else if (!('projName' in code)) {
1647
- return wkt(code);
1657
+ out = wkt(code);
1648
1658
  } else {
1649
- return code;
1659
+ out = code;
1650
1660
  }
1661
+ // test for special Web Mercator case, due to this being a very common and often malformed
1662
+ return out && checkMercator(out) ? defs['EPSG:3857'] : out;
1651
1663
  }
1652
1664
 
1653
1665
  function extend (destination, source) {
@@ -2271,7 +2283,7 @@
2271
2283
  towgs84: '-178.3,-316.7,-131.5,5.278,6.077,10.979,19.166'
2272
2284
  },
2273
2285
  EPSG_4231: {
2274
- towgs84: '-83.11,-97.38,-117.22,0.0276,-0.2167,0.2147,0.1218'
2286
+ towgs84: '-83.11,-97.38,-117.22,0.005693,-0.044698,0.044285,0.1218'
2275
2287
  },
2276
2288
  EPSG_4274: {
2277
2289
  towgs84: '-230.994,102.591,25.199,0.633,-0.239,0.9,1.95'
@@ -2301,7 +2313,7 @@
2301
2313
  towgs84: '8.846,-4.394,-1.122,-0.00237,-0.146528,0.130428,0.783926'
2302
2314
  },
2303
2315
  EPSG_4289: {
2304
- towgs84: '565.7381,50.4018,465.2904,-1.91514,1.60363,-9.09546,4.07244'
2316
+ towgs84: '565.7381,50.4018,465.2904,-0.395026,0.330772,-1.876073,4.07244'
2305
2317
  },
2306
2318
  EPSG_4230: {
2307
2319
  towgs84: '-68.863,-134.888,-111.49,-0.53,-0.14,0.57,-3.4'
@@ -2331,7 +2343,7 @@
2331
2343
  towgs84: '-45,417,-3.5'
2332
2344
  },
2333
2345
  EPSG_4611: {
2334
- towgs84: '-162.619,-276.959,-161.764,0.067753,-2.243649,-1.158827,-1.094246'
2346
+ towgs84: '-162.619,-276.959,-161.764,0.067753,-2.243648,-1.158828,-1.094246'
2335
2347
  },
2336
2348
  EPSG_4633: {
2337
2349
  towgs84: '137.092,131.66,91.475,-1.9436,-11.5993,-4.3321,-7.4824'
@@ -2349,7 +2361,7 @@
2349
2361
  towgs84: '482.5,-130.6,564.6,-1.042,-0.214,-0.631,8.15'
2350
2362
  },
2351
2363
  EPSG_4660: {
2352
- towgs84: '982.6087,552.753,-540.873,32.39344,-153.25684,-96.2266,16.805'
2364
+ towgs84: '982.6087,552.753,-540.873,6.681627,-31.611492,-19.848161,16.805'
2353
2365
  },
2354
2366
  EPSG_4662: {
2355
2367
  towgs84: '97.295,-263.247,310.882,-1.5999,0.8386,3.1409,13.3259'
@@ -2379,7 +2391,7 @@
2379
2391
  towgs84: '217.109,86.452,23.711,0.0183,-0.0003,0.007,-0.0093'
2380
2392
  },
2381
2393
  EPSG_9333: {
2382
- towgs84: '0,0,0,-8.393,0.749,-10.276,0'
2394
+ towgs84: '0,0,0,-0.008393,0.000749,-0.010276,0'
2383
2395
  },
2384
2396
  EPSG_9059: {
2385
2397
  towgs84: '0,0,0'
@@ -2535,7 +2547,7 @@
2535
2547
  towgs84: '674.374,15.056,405.346'
2536
2548
  },
2537
2549
  EPSG_4617: {
2538
- towgs84: '-0.991,1.9072,0.5129,1.25033e-7,4.6785e-8,5.6529e-8,0'
2550
+ towgs84: '-0.991,1.9072,0.5129,0.02579,0.00965,0.01166,0'
2539
2551
  },
2540
2552
  EPSG_4663: {
2541
2553
  towgs84: '-210.502,-66.902,-48.476,2.094,-15.067,-5.817,0.485'
@@ -2598,10 +2610,10 @@
2598
2610
  towgs84: '275.57,676.78,229.6'
2599
2611
  },
2600
2612
  EPSG_4283: {
2601
- towgs84: '61.55,-10.87,-40.19,39.4924,32.7221,32.8979,-9.994'
2613
+ towgs84: '0.06155,-0.01087,-0.04019,0.039492,0.032722,0.032898,-0.009994'
2602
2614
  },
2603
2615
  EPSG_4317: {
2604
- towgs84: '2.3287,-147.0425,-92.0802,-0.3092483,0.32482185,0.49729934,5.68906266'
2616
+ towgs84: '2.3287,-147.0425,-92.0802,-0.309248,0.324822,0.497299,5.689063'
2605
2617
  },
2606
2618
  EPSG_4272: {
2607
2619
  towgs84: '59.47,-5.04,187.44,0.47,-0.1,1.024,-4.5993'
@@ -2724,7 +2736,7 @@
2724
2736
  towgs84: '-208.4058,-109.8777,-2.5764'
2725
2737
  },
2726
2738
  ESRI_104101: {
2727
- towgs84: '374,150,588'
2739
+ towgs84: '372.87,149.23,585.29'
2728
2740
  },
2729
2741
  EPSG_4693: {
2730
2742
  towgs84: '0,-0.15,0.68'
@@ -3409,6 +3421,87 @@
3409
3421
  },
3410
3422
  EPSG_4818: {
3411
3423
  towgs84: '589,76,480'
3424
+ },
3425
+ EPSG_10328: {
3426
+ towgs84: '0,0,0'
3427
+ },
3428
+ EPSG_9782: {
3429
+ towgs84: '0,0,0'
3430
+ },
3431
+ EPSG_9777: {
3432
+ towgs84: '0,0,0'
3433
+ },
3434
+ EPSG_10690: {
3435
+ towgs84: '0,0,0'
3436
+ },
3437
+ EPSG_10639: {
3438
+ towgs84: '0,0,0'
3439
+ },
3440
+ EPSG_10739: {
3441
+ towgs84: '0,0,0'
3442
+ },
3443
+ EPSG_7686: {
3444
+ towgs84: '0,0,0'
3445
+ },
3446
+ EPSG_8900: {
3447
+ towgs84: '0,0,0'
3448
+ },
3449
+ EPSG_5886: {
3450
+ towgs84: '0,0,0'
3451
+ },
3452
+ EPSG_7683: {
3453
+ towgs84: '0,0,0'
3454
+ },
3455
+ EPSG_6668: {
3456
+ towgs84: '0,0,0'
3457
+ },
3458
+ EPSG_20046: {
3459
+ towgs84: '0,0,0'
3460
+ },
3461
+ EPSG_10299: {
3462
+ towgs84: '0,0,0'
3463
+ },
3464
+ EPSG_10310: {
3465
+ towgs84: '0,0,0'
3466
+ },
3467
+ EPSG_10475: {
3468
+ towgs84: '0,0,0'
3469
+ },
3470
+ EPSG_4742: {
3471
+ towgs84: '0,0,0'
3472
+ },
3473
+ EPSG_10671: {
3474
+ towgs84: '0,0,0'
3475
+ },
3476
+ EPSG_10762: {
3477
+ towgs84: '0,0,0'
3478
+ },
3479
+ EPSG_10725: {
3480
+ towgs84: '0,0,0'
3481
+ },
3482
+ EPSG_10791: {
3483
+ towgs84: '0,0,0'
3484
+ },
3485
+ EPSG_10800: {
3486
+ towgs84: '0,0,0'
3487
+ },
3488
+ EPSG_10305: {
3489
+ towgs84: '0,0,0'
3490
+ },
3491
+ EPSG_10941: {
3492
+ towgs84: '0,0,0'
3493
+ },
3494
+ EPSG_10968: {
3495
+ towgs84: '0,0,0'
3496
+ },
3497
+ EPSG_10875: {
3498
+ towgs84: '0,0,0'
3499
+ },
3500
+ EPSG_6318: {
3501
+ towgs84: '0,0,0'
3502
+ },
3503
+ EPSG_10910: {
3504
+ towgs84: '0,0,0'
3412
3505
  }
3413
3506
  };
3414
3507
 
@@ -4477,7 +4570,7 @@
4477
4570
  return adjust_axis(dest, true, point);
4478
4571
  }
4479
4572
 
4480
- if (point && !hasZ) {
4573
+ if (point && !hasZ && dest.projName !== 'geocent') {
4481
4574
  delete point.z;
4482
4575
  }
4483
4576
  return point;
@@ -6838,7 +6931,7 @@
6838
6931
  this.lat0 = 0.863937979737193;
6839
6932
  }
6840
6933
  if (!this.long0) {
6841
- this.long0 = 0.7417649320975901 - 0.308341501185665;
6934
+ this.long0 = 0.7417649320975901 - 0.308341501185665; // 42.5° from Ferro = 24.833° from Greenwich
6842
6935
  }
6843
6936
  /* if scale not set default to 0.9999 */
6844
6937
  if (!this.k0) {
@@ -6927,7 +7020,7 @@
6927
7020
  return (p);
6928
7021
  }
6929
7022
 
6930
- var names$n = ['Krovak', 'krovak'];
7023
+ var names$n = ['Krovak', 'Krovak Modified', 'Krovak (North Orientated)', 'Krovak Modified (North Orientated)', 'krovak'];
6931
7024
  var krovak = {
6932
7025
  init: init$n,
6933
7026
  forward: forward$m,
@@ -8199,6 +8292,7 @@
8199
8292
  function init$d() {
8200
8293
  /* Place parameters in static storage for common use
8201
8294
  ------------------------------------------------- */
8295
+ this.long0 = this.long0 || 0;
8202
8296
 
8203
8297
  if (!this.sphere) {
8204
8298
  this.en = pj_enfn(this.es);
@@ -9133,7 +9227,7 @@
9133
9227
  if (this.face === FACE_ENUM.RIGHT) {
9134
9228
  lon = qsc_shift_lon_origin(lon, +HALF_PI);
9135
9229
  } else if (this.face === FACE_ENUM.BACK) {
9136
- lon = qsc_shift_lon_origin(lon, 3.14159265359);
9230
+ lon = qsc_shift_lon_origin(lon, +SPI);
9137
9231
  } else if (this.face === FACE_ENUM.LEFT) {
9138
9232
  lon = qsc_shift_lon_origin(lon, -HALF_PI);
9139
9233
  }
@@ -9313,7 +9407,7 @@
9313
9407
  if (this.face === FACE_ENUM.RIGHT) {
9314
9408
  lp.lam = qsc_shift_lon_origin(lp.lam, -HALF_PI);
9315
9409
  } else if (this.face === FACE_ENUM.BACK) {
9316
- lp.lam = qsc_shift_lon_origin(lp.lam, -3.14159265359);
9410
+ lp.lam = qsc_shift_lon_origin(lp.lam, -SPI);
9317
9411
  } else if (this.face === FACE_ENUM.LEFT) {
9318
9412
  lp.lam = qsc_shift_lon_origin(lp.lam, +HALF_PI);
9319
9413
  }
@@ -9367,9 +9461,9 @@
9367
9461
  /* Helper function: shift the longitude. */
9368
9462
  function qsc_shift_lon_origin(lon, offset) {
9369
9463
  var slon = lon + offset;
9370
- if (slon < -3.14159265359) {
9464
+ if (slon < -SPI) {
9371
9465
  slon += TWO_PI;
9372
- } else if (slon > 3.14159265359) {
9466
+ } else if (slon > +SPI) {
9373
9467
  slon -= TWO_PI;
9374
9468
  }
9375
9469
  return slon;
@@ -10566,7 +10660,7 @@
10566
10660
  nadgrid,
10567
10661
  transform,
10568
10662
  mgrs,
10569
- version: '2.20.3'
10663
+ version: '2.20.5'
10570
10664
  });
10571
10665
  includedProjections(proj4);
10572
10666