From 2ddf34822b39169e9af3a0a68e08a6dee4a74ca2 Mon Sep 17 00:00:00 2001 From: William Petit Date: Mon, 25 Jan 2021 16:16:29 +0100 Subject: [PATCH] Export altitude from LandXML coordinates --- lib/cg-point.js | 4 +--- lib/parcel.js | 2 +- lib/pipe-network.js | 2 +- lib/surface.js | 2 +- 4 files changed, 4 insertions(+), 6 deletions(-) diff --git a/lib/cg-point.js b/lib/cg-point.js index 8d4d405..58422d9 100644 --- a/lib/cg-point.js +++ b/lib/cg-point.js @@ -1,6 +1,4 @@ import { getProp, parseSequence, getColor } from './util' -import { polygon } from '@turf/helpers'; -import union from '@turf/union'; import proj4 from 'proj4'; export const LANDXML_POINT = 'cg_point'; @@ -52,7 +50,7 @@ function convertPoint(cgPoint, projection, featureProps) { type: "Feature", geometry: { type: "Point", - coordinates: [...pointCoords, pointCoords[2]], + coordinates: [...pointCoords], }, properties: { ...featureProps, diff --git a/lib/parcel.js b/lib/parcel.js index e5a0036..45892f1 100644 --- a/lib/parcel.js +++ b/lib/parcel.js @@ -17,7 +17,7 @@ export function convertParcels(xmlObj, projection, opts) { const opt = originalPoints[pt] const name = opt.$.name.replace(/ /g,''); let coords = parseSequence(opt._).map(coord => parseFloat(coord)) - coords = [coords[1], coords[0]] + coords = [coords[1], coords[0], coords[2]] coords = proj4(projection, 'WGS84', coords) points[name] = coords } diff --git a/lib/pipe-network.js b/lib/pipe-network.js index e19eafe..8d9d6fb 100644 --- a/lib/pipe-network.js +++ b/lib/pipe-network.js @@ -152,7 +152,7 @@ function convertStructs(pipeNetwork, projection, baseProps, opts) { // Parse and convert center coordinates const seq = parseSequence(centerNode).map(v => parseFloat(v)); - let center = [seq[1], seq[0]]; + let center = [seq[1], seq[0], seq[2]]; center = proj4(projection, 'WGS84', center); let geometry; diff --git a/lib/surface.js b/lib/surface.js index 381ec13..cac1935 100644 --- a/lib/surface.js +++ b/lib/surface.js @@ -81,7 +81,7 @@ function convertFaces(surface, projection, featureProps, opts) { pointNodes.forEach(p => { let pointCoords = parseSequence(p._).map(v => parseFloat(v)); - pointCoords = [pointCoords[1], pointCoords[0]]; + pointCoords = [pointCoords[1], pointCoords[0], pointCoords[2]]; pointCoords = proj4(projection, 'WGS84', pointCoords); const pointId = p.$.id; points[pointId] = { name: p.$.name, coords: pointCoords };