COPC Streaming¶
occulus.io.copc
¶
Cloud Optimized Point Cloud (COPC) streaming reader.
Reads COPC-formatted LAZ 1.4 files by spatial window without loading the full dataset into memory. Supports both local files and remote URLs via HTTP range requests.
COPC is a LAZ 1.4 extension that stores an octree spatial index in VLRs, enabling efficient spatial queries on arbitrarily large files.
References
- COPC specification: https://copc.io/
- laspy COPC support: https://laspy.readthedocs.io/
COPCMetadata
dataclass
¶
Metadata from a COPC file header.
Attributes:
| Name | Type | Description |
|---|---|---|
bounds |
tuple[float, float, float, float, float, float]
|
Spatial bounds (xmin, ymin, zmin, xmax, ymax, zmax). |
point_count |
int
|
Total number of points in the file. |
crs |
str
|
Coordinate reference system as WKT or empty string. |
resolution_levels |
list[float]
|
Available octree resolution levels (coarsest to finest). |
point_format_id |
int
|
LAS point format ID. |
Source code in src/occulus/io/copc.py
read_copc(path, *, bbox=None, resolution=None, max_points=None, platform='unknown')
¶
Read a COPC file, optionally filtering by spatial window.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str or Path
|
Path to a local COPC LAZ file, or an HTTP(S) URL. |
required |
bbox
|
tuple[float, float, float, float]
|
Spatial bounding box filter (xmin, ymin, xmax, ymax). Only points within this 2-D window are returned. |
None
|
resolution
|
float
|
Target resolution in point-cloud units. Selects the coarsest octree level that meets this resolution. |
None
|
max_points
|
int
|
Maximum number of points to return. If the query exceeds this, points are randomly subsampled. |
None
|
platform
|
str
|
Acquisition platform hint ('aerial', 'terrestrial', 'uav', 'unknown'). |
'unknown'
|
Returns:
| Type | Description |
|---|---|
PointCloud
|
Point cloud containing only the requested spatial window. |
Raises:
| Type | Description |
|---|---|
OcculusIOError
|
If the file cannot be read or is not COPC format. |
Source code in src/occulus/io/copc.py
108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 | |
read_copc_metadata(path)
¶
Read metadata from a COPC file without loading points.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str or Path
|
Path to a local COPC file, or an HTTP(S) URL. |
required |
Returns:
| Type | Description |
|---|---|
COPCMetadata
|
File metadata including bounds, point count, and CRS. |
Raises:
| Type | Description |
|---|---|
OcculusIOError
|
If the file is not a valid COPC file or cannot be read. |