UNPKG

764 BJavaScriptView Raw
1const getZone = require("./getZone");
2const getHemisphere = require("./getHemisphere");
3
4function getProjString(projection) {
5 const zone = getZone(projection);
6 const hemisphere = getHemisphere(projection);
7 if (projection.toString().startsWith("269")) {
8 // North American Datum of 1983 (NAD83)
9 return `+proj=utm +zone=${zone} +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs +type=crs`;
10 } else {
11 return `+proj=utm +zone=${zone}${hemisphere === "S" ? " +south " : " "}+ellps=WGS84 +datum=WGS84 +units=m +no_defs`;
12 }
13}
14
15if (typeof define === "function" && define.amd) {
16 define(function () {
17 return getProjString;
18 });
19}
20
21if (typeof module === "object") {
22 module.exports = getProjString;
23 module.exports.default = getProjString;
24}