Skip to content
Closed
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
2 changes: 1 addition & 1 deletion src/copc/copc.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const filename = ellipsoidFilename

test('data', async () => {
const copc = await Copc.create(filename)
const view = await Copc.loadPointData(filename, copc, '0-0-0-0')
const view = await Copc.loadPointDataView(filename, copc, '0-0-0-0')

expect(view.dimensions).toEqual<Dimension.Map>({
X: { type: 'float', size: 8 },
Expand Down
16 changes: 12 additions & 4 deletions src/copc/copc.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as Las from 'las'
import { Getter, View } from 'utils'
import { Getter, View, Binary } from 'utils'

import { Hierarchy } from './hierarchy'
import { Key } from './key'
Expand All @@ -11,7 +11,7 @@ export type Copc = {
offsets: Offsets
hierarchy: Hierarchy
}
export const Copc = { create, loadPointData, loadHierarchyPage }
export const Copc = { create, loadPointData, loadPointDataView, loadHierarchyPage }

/**
* Parse the COPC header and walk VLR and EVLR metadata.
Expand Down Expand Up @@ -57,7 +57,7 @@ async function loadPointData(
filename: string | Getter,
copc: Copc,
key: Key | string
): Promise<View> {
): Promise<Binary> {
const get = Getter.create(filename)

// Ensure that the hierarchy entry for this node is loaded.
Expand Down Expand Up @@ -87,5 +87,13 @@ async function loadPointData(
pointCount,
})

return Las.View.create(copc.header, buffer)
return buffer
}

async function loadPointDataView(
filename: string | Getter,
copc: Copc,
key: Key | string
): Promise<View> {
return Las.View.create(copc.header, (await loadPointData(filename, copc, key)));
}