diff --git a/.gitignore b/.gitignore index a16e420..f2db7e4 100644 --- a/.gitignore +++ b/.gitignore @@ -105,3 +105,5 @@ dist # Backup Files *bak* + +pnpm-lock.yaml diff --git a/package.json b/package.json index bcb845d..f82e27e 100644 --- a/package.json +++ b/package.json @@ -54,6 +54,6 @@ }, "dependencies": { "get-epsg-code": "^0.0.7", - "reproject-bbox": "^0.1.0" + "reproject-bbox": "^0.2.0" } } diff --git a/test/test.reproj.js b/test/test.reproj.js index 13bed09..6337471 100644 --- a/test/test.reproj.js +++ b/test/test.reproj.js @@ -45,3 +45,17 @@ test("reproject extent that crosses 180th meridian and stops at prime meridian", eq(result.xmin, XMIN_WEBMERC); eq(result.xmax, XMAX_WEBMERC); }); + +test("reproject extent that crosses 180th meridian and stops at prime meridian", ({ eq }) => { + const wkt = `PROJCS["WGS_1984_Web_Mercator_Auxiliary_Sphere",GEOGCS["GCS_WGS_1984",DATUM["WGS_1984",SPHEROID["WGS_1984",6378137.0,298.257223563]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Mercator_Auxiliary_Sphere"],PARAMETER["False_Easting",0.0],PARAMETER["False_Northing",0.0],PARAMETER["Central_Meridian",0.0],PARAMETER["Standard_Parallel_1",0.0],PARAMETER["Auxiliary_Sphere_Type",0.0],UNIT["Meter",1.0]]`; + const [XMIN_WEBMERC, YMIN_WEBMERC, XMAX_WEBMERC, YMAX_WEBMERC] = new GeoExtent([-180, -80, 180, 80], { + srs: 4326 + }).reproj(wkt).bbox; + const lyr = new GeoExtent([-180.00092731781535, 15.563268747733936, 0, 74.71076874773686], { + srs: 4326 + }); + const result = lyr.reproj(wkt); + eq(result.bbox, [-20037508.342789244, 1754201.542789432, 20037508.342789244, 12808999.953599941]); + eq(result.xmin, XMIN_WEBMERC); + eq(result.xmax, XMAX_WEBMERC); +});