UNPKG

613 BJavaScriptView Raw
1function isUTM(projection) {
2 const projstr = projection.toString();
3
4 const replaced = projstr.replace("EPSG:", "");
5
6 if (replaced.startsWith("326") || replaced.startsWith("327")) {
7 return true;
8 }
9
10 const sorted = projstr.split(" ").sort().join(" ");
11
12 if (sorted.match(/^\+datum=WGS84 \+ellps=WGS84 \+no_defs \+proj=utm( \+south)? \+units=m \+zone=\d{1,2}$/)) {
13 return true;
14 }
15
16 return false;
17}
18
19if (typeof define === "function" && define.amd) {
20 define(function () {
21 return isUTM;
22 });
23}
24
25if (typeof module === "object") {
26 module.exports = isUTM;
27 module.exports.default = isUTM;
28}