Skip to content

Commit

Permalink
can reproj to wkt
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielJDufour committed Dec 10, 2021
1 parent b6be866 commit 3cee961
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -105,3 +105,5 @@ dist

# Backup Files
*bak*

pnpm-lock.yaml
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,6 @@
},
"dependencies": {
"get-epsg-code": "^0.0.7",
"reproject-bbox": "^0.1.0"
"reproject-bbox": "^0.2.0"
}
}
14 changes: 14 additions & 0 deletions test/test.reproj.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});

0 comments on commit 3cee961

Please sign in to comment.