8.3 KiB
Potree Data Format
Note: This document is written based on the Potree 1.7 data format.
Overview
The Potree Data Format is …
- … made for loading PointCloud data.
- … flexibly optimizable for different kinds of available information (see PointCloud Data files).
- … built for the web (cachable, hostable on simple file storages).
- … split into several files & folders (urls).
- … implemented using an Octree file structure.
- … implemented with very little overhead.
Folder Structure
/cloud.js- Meta Information/sources.json- Build Information/<octree-dir>/r/**/r**.hrc- Index Files/<octree-dir>/r/**/r**.bin- PointCloud Data files/<octree-dir>/r/**/r**.las- Las Data files/<octree-dir>/r/**/r**.laz- Laz Data files
Meta Information
Global structure information about how the other files should be interpreted
will be stored in the /cloud.js file which contains JSON formatted
data (name misleading).
-
version(String) Version number in which this file is written (1.7) is the current version. -
octreeDir(String) Folder that is used to load additional data. -
points(Number) Amount of points contained in the whole pointcloud data -
projection(String) This parameter is used to transform the point data to the projection system used while visualizing the points. It has to be in a format that is parsable by [proj.4][proj4]. -
boundingBox(Object) Bounding box of the world used to limit the initial POV.lx(Number) Min Xly(Number) Min Ylz(Number) Min Zux(Number) Max Xuy(Number) Max Yuz(Number) Max Z
-
tightBoundingBox(Object) Bounding box of the actual points in the datalx(Number) Min Xly(Number) Min Ylz(Number) Min Zux(Number) Max Xuy(Number) Max Yuz(Number) Max Z
-
pointAttributes(String or Array)LAZorLASor...an (Array) of attributes specifying the order and type of data stored in the Data files. Its possible to be one of the following keys:
POSITION_CARTESIAN: 3 (uint32) numbers: x, y, zRGBA_PACKED: 4 x (uint8) numbers for the color: r, g, b, a (Note: Could it be that this is unused?)COLOR_PACKED: 4 x (uint8) numbers for the color: r, g, b, aRGB_PACKED: 3 x (uint8) numbers for the color: r, g, b (Note: Could it be that this is unused?)NORMAL_FLOATS: 3 x (float) numbers: x', y', z' (Note: Could it be that this is unused?)FILLER_1B: (uint8) number (Note: Could it be that this is unused?)INTENSITY: (uint16) number specifying the point's intensityCLASSIFICATION: (uint8) id for the class used.NORMAL_SPHEREMAPPED: (Note: might need to be revisited, best don't use)NORMAL_OCT16: (Note: might need to be revisited, best don't use)NORMAL: 3 x (float) numbers: x', y', z'
Note: All types mentioned here are in little endian.
-
spacing: (Number) Space between points at the root node. This value is halved at each octree level. -
scale: (Number) Scale applied to convert POSITION_CARTESIAN components from uint32 values to floating point values. The full transformation to world coordinates isposition = (POSITION_CARTESIAN * scale) + boundingBox.min -
hierarchyStepSize: (Number) Amount of Octree levels before a new folder hierarchy is expected. -
hierarchy: (Array) (deprecated) The hierarchy of files, now loaded through index files.
Build Information
When generating Potree data, the generator can optionally create a
sources.json file to keep information about the source-data that was used to
create the Potree data.
Data & Index files
Depending on the pointAttributes meta information the
actual point data is stored in either .bin,
.las or .laz data files.
The path for each file consists of the octreeDir
meta information followed by a tree structure path.
In an octree there are 8 possible nodes in every hierarchy level.
Potree assumes 0-7 for each node in a hierarchy level. The
hierarchyStepSize information specifies the hierarchy depth after which
a new folder will be added to the hierarchy with the name of the sub-hiearchies
prefix.
Example: Given octreeDir is set to data and pointAttributes is set to
laz and hierarchyStepSize is set to 3. This example shows a very small
, fictive, tree:
r
/ \
0 3
| / \
1 0 1
|
0
The resulting data files would need to be stored like this:
|- cloud.js
\- data/
\- r/
|- r.hrc
|- r.laz
|- r0.laz
|- r01.laz
|- r3.laz
|- r30.laz
|- r31.laz
\- 310/
|- r310.hrc
\- r310.laz
data/r/r.hrcanddata/r/310/r310.hrcare the index files specifying what sub tree nodes are available.data/r/**/*.lazcontains the binary pointcloud data to be loadeddata/r/310/is the subfolder created for the 3rd hierarchy level
Index Files
As mentioned in the former section, the .hrc files contain the index structure
meaning a list of all the files stored within the directory tree.
An index file contains a list of tuple values with the first being a uint8
"mask" and the second being uint32 "number of points" of a hierarchy level
in a breadth first level order.
Per hierarchy level we have 8 possible nodes. To indicate whether a node exists a simple binary mask is used:
| Position | Mask | Binary |
|---|---|---|
| 0 | 1 | 0b00000001 |
| 1 | 2 | 0b00000010 |
| 2 | 4 | 0b00000100 |
| 3 | 8 | 0b00001000 |
| 4 | 16 | 0b00010000 |
| 5 | 32 | 0b00100000 |
| 6 | 64 | 0b01000000 |
| 7 | 128 | 0b10000000 |
So if in a hierarchy the child node 3 and node 7 exist then the hierarchies
mask has to be 0b00001000 | 0b10000000 → 0b10001000 (=136).
Example: A simple, non-realistic tree:
|- r1
| |
| \- r14 (2 Points)
|
\- r3
|
\- r36 (1 Point)
Would have an index looking like this:
| name | mask | points |
|---|---|---|
| r | 0b00001010 (=10) |
3 |
| r1 | 0b00010000 (=16) |
2 |
| r3 | 0b01000000 (=64) |
1 |
| r14 | 0b00000000 (=0) |
2 |
| r36 | 0b00000000 (=0) |
1 |
PointCloud Data files
The .bin files contains a list of points. For each point it contains a list
of binary data following the pointAttributes specified in the
meta information.
Example: With pointAttributes=['POSITION_CARTESIAN'], the .bin file is a
sequence of points with each consisting of 3 uint32 numbers.
Example2: With pointAttributes=['POSITION_CARTESIAN','INTENSITY'], the
.bin files contain a sequence of points consisting of 3 uint32 numbers
followed by one uint16 number.
Example3: With pointAttributes=['INTENSITY','POSITION_CARTESIAN'], the
.bin files contain a sequence of points consisting of one uint16 number
followed by 3 uint32 numbers.
Las Data files
.las data files have to follow the las specification. Potree
supports up to version 1.3.