tethys-feature-service/node_modules/proj4/lib/projections.js

40 lines
706 B
JavaScript
Raw Normal View History

2023-10-02 13:04:02 +00:00
import merc from "./projections/merc";
import longlat from "./projections/longlat";
var projs = [merc, longlat];
var names = {};
var projStore = [];
function add(proj, i) {
var len = projStore.length;
if (!proj.names) {
console.log(i);
return true;
}
projStore[len] = proj;
proj.names.forEach(function(n) {
names[n.toLowerCase()] = len;
});
return this;
}
export {add};
export function get(name) {
if (!name) {
return false;
}
var n = name.toLowerCase();
if (typeof names[n] !== 'undefined' && projStore[names[n]]) {
return projStore[names[n]];
}
}
export function start() {
projs.forEach(add);
}
export default {
start: start,
add: add,
get: get
};