-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathPROJJSONBuilder2019.js
More file actions
38 lines (33 loc) · 1.14 KB
/
PROJJSONBuilder2019.js
File metadata and controls
38 lines (33 loc) · 1.14 KB
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
import PROJJSONBuilderBase from './PROJJSONBuilderBase.js';
class PROJJSONBuilder2019 extends PROJJSONBuilderBase {
static convert(node, result = {}) {
super.convert(node, result);
// Handle `CS` node for WKT2-2019
const csNode = node.find((child) => Array.isArray(child) && child[0] === 'CS');
if (csNode) {
result.coordinate_system = {
subtype: csNode[1],
axis: this.extractAxes(node),
};
}
// Handle `USAGE` node for WKT2-2019
const usageNode = node.find((child) => Array.isArray(child) && child[0] === 'USAGE');
if (usageNode) {
const scope = usageNode.find((child) => Array.isArray(child) && child[0] === 'SCOPE');
const area = usageNode.find((child) => Array.isArray(child) && child[0] === 'AREA');
const bbox = usageNode.find((child) => Array.isArray(child) && child[0] === 'BBOX');
result.usage = {};
if (scope) {
result.usage.scope = scope[1];
}
if (area) {
result.usage.area = area[1];
}
if (bbox) {
result.usage.bbox = bbox.slice(1);
}
}
return result;
}
}
export default PROJJSONBuilder2019;