From ef0b0fe4d0ee708c490cf99bfcbd86e8cc009d2d Mon Sep 17 00:00:00 2001 From: Andreas Hocevar Date: Thu, 2 Apr 2026 20:12:01 +0200 Subject: [PATCH] Broaden longc -> long0 assignment --- index.js | 6 +++--- test-fixtures.json | 6 ++++++ util.js | 4 ++-- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/index.js b/index.js index 54b1ed7..29c5039 100644 --- a/index.js +++ b/index.js @@ -94,9 +94,9 @@ function setPropertiesFromWkt(wkt) { geogcs = wkt; } if (geogcs) { - //if(wkt.GEOGCS.PRIMEM&&wkt.GEOGCS.PRIMEM.convert){ - // wkt.from_greenwich=wkt.GEOGCS.PRIMEM.convert*D2R; - //} + if (geogcs.PRIMEM && geogcs.PRIMEM.convert) { + wkt.from_greenwich = d2r(geogcs.PRIMEM.convert); + } if (geogcs.DATUM) { wkt.datumCode = geogcs.DATUM.name.toLowerCase(); } else { diff --git a/test-fixtures.json b/test-fixtures.json index dcf703b..68041d0 100644 --- a/test-fixtures.json +++ b/test-fixtures.json @@ -723,6 +723,7 @@ "x0": 600000, "y0": 200000, "longc": 0.12984522414316144, + "long0": 0.12984522414316144, "lat0": 0.8194740686761227, "alpha": 1.570796326794897, "rectified_grid_angle": 1.570796326794897, @@ -745,6 +746,7 @@ "x0": 600000, "y0": 200000, "longc": 0.12984522414316635, + "long0": 0.12984522414316635, "lat0": 0.8194740686761263, "alpha": 1.570796326794897, "rectified_grid_angle": 1.570796326794897, @@ -767,6 +769,7 @@ "x0": 600000, "y0": 200000, "longc": 0.1298452241431614, + "long0": 0.1298452241431614, "lat0": 0.8194740686761226, "alpha": 1.5707963267948966, "rectified_grid_angle": 1.5707963267948966, @@ -793,6 +796,7 @@ "x0": 600000, "y0": 200000, "longc": 0.12984522414316146, + "long0": 0.12984522414316146, "lat0": 0.8194740686761218, "alpha": 1.5707963267948966, "rectified_grid_angle": 1.5707963267948966, @@ -929,6 +933,7 @@ "x0": 804671, "y0": 0, "longc": 1.784599160164202, + "long0": 1.784599160164202, "lat0": 0.06981317007977318, "alpha": 5.637863717220397, "rectified_grid_angle": 5.639684198507691, @@ -1093,6 +1098,7 @@ "x0": 804671, "y0": 0, "longc": 1.784599160164202, + "long0": 1.784599160164202, "lat0": 0.06981317007977318, "alpha": 5.637863717220403, "rectified_grid_angle": 5.63968419850769, diff --git a/util.js b/util.js index e6f2d1d..b5220c7 100644 --- a/util.js +++ b/util.js @@ -8,8 +8,8 @@ export function applyProjectionDefaults(wkt) { // Normalize projName for WKT2 compatibility const normalizedProjName = (wkt.projName || '').toLowerCase().replace(/_/g, ' '); - if (!wkt.long0 && wkt.longc && (normalizedProjName === 'albers conic equal area' || normalizedProjName === 'lambert azimuthal equal area')) { - wkt.long0 = wkt.longc; + if (wkt.long0 === undefined && wkt.longc !== undefined) { + wkt.long0 = wkt.longc; // keep in the projection's native prime meridian frame } if (!wkt.lat_ts && wkt.lat1 && (normalizedProjName === 'stereographic south pole' || normalizedProjName === 'polar stereographic (variant b)')) { wkt.lat0 = d2r(wkt.lat1 > 0 ? 90 : -90);