-
Notifications
You must be signed in to change notification settings - Fork 0
/
defs.js
67 lines (64 loc) · 1.42 KB
/
defs.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
// import globals from './global';
// import parseProj from './projString';
// import wkt from 'wkt-parser';
function defs(name) {
/*global console*/
var that = this;
if (arguments.length === 2) {
var def = arguments[1];
// if (typeof def === 'string') {
// if (def.charAt(0) === '+') {
// defs[name] = parseProj(arguments[1]);
// }
// else {
// defs[name] = wkt(arguments[1]);
// }
// } else {
defs[name] = def;
// }
}
else if (arguments.length === 1) {
if (Array.isArray(name)) {
return name.map(function(v) {
if (Array.isArray(v)) {
defs.apply(that, v);
}
else {
defs(v);
}
});
}
else if (typeof name === 'string') {
if (name in defs) {
return defs[name];
}
}
else if ('EPSG' in name) {
defs['EPSG:' + name.EPSG] = name;
}
else if ('ESRI' in name) {
defs['ESRI:' + name.ESRI] = name;
}
else if ('IAU2000' in name) {
defs['IAU2000:' + name.IAU2000] = name;
}
else {
console.log(name);
}
return;
}
}
// add default CRS WGS84/EPSG:4326
defs('EPSG:4326', {
"title": "WGS 84 (long/lat)",
"projName": "longlat",
"ellps": "WGS84",
"units": "degrees",
"axis": "enu",
"datumCode": "WGS84",
"datumName": "WGS84",
"datum_params": ["0", "0", "0"],
"k0": 1
});
defs.WGS84 = defs['EPSG:4326'];
export default defs;