Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 0 additions & 21 deletions .eslintrc

This file was deleted.

2 changes: 1 addition & 1 deletion PROJJSONBuilder2015.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ class PROJJSONBuilder2015 extends PROJJSONBuilderBase {
super.convert(node, result);

// Skip `CS` and `USAGE` nodes for WKT2-2015
if (result.coordinate_system?.subtype === "Cartesian") {
if (result.coordinate_system && result.coordinate_system.subtype === 'Cartesian') {
delete result.coordinate_system;
}
if (result.usage) {
Expand Down
22 changes: 15 additions & 7 deletions PROJJSONBuilder2019.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ class PROJJSONBuilder2019 extends PROJJSONBuilderBase {
super.convert(node, result);

// Handle `CS` node for WKT2-2019
const csNode = node.find((child) => Array.isArray(child) && child[0] === "CS");
const csNode = node.find((child) => Array.isArray(child) && child[0] === 'CS');
if (csNode) {
result.coordinate_system = {
subtype: csNode[1],
Expand All @@ -14,13 +14,21 @@ class PROJJSONBuilder2019 extends PROJJSONBuilderBase {
}

// Handle `USAGE` node for WKT2-2019
const usageNode = node.find((child) => Array.isArray(child) && child[0] === "USAGE");
const usageNode = node.find((child) => Array.isArray(child) && child[0] === 'USAGE');
if (usageNode) {
result.usage = {
scope: usageNode.find((child) => Array.isArray(child) && child[0] === "SCOPE")?.[1],
area: usageNode.find((child) => Array.isArray(child) && child[0] === "AREA")?.[1],
bbox: usageNode.find((child) => Array.isArray(child) && child[0] === "BBOX")?.slice(1),
};
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;
Expand Down
Loading