Skip to content

Commit 30b603f

Browse files
committed
Update README
1 parent 162fc84 commit 30b603f

File tree

1 file changed

+24
-8
lines changed

1 file changed

+24
-8
lines changed

README.rst

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,25 @@ PDAL and Python:
187187
).pipeline(clamped)
188188
print(pipeline.execute()) # 387 points
189189
190+
Iterating Streamable Pipelines
191+
................................................................................
192+
Streamable pipelines (pipelines that consist exclusively of streamable PDAL
193+
stages) can be executed in streaming mode via ``Pipeline.iterator()``. This
194+
returns an iterator object that yields Numpy arrays of up to ``chunk_size`` size
195+
(default=10000) at a time.
196+
197+
.. code-block:: python
198+
199+
import pdal
200+
pipeline = pdal.Reader("test/data/autzen-utm.las") | pdal.Filter.range(limits="Intensity[80:120)")
201+
for array in pipeline.iterator(chunk_size=500):
202+
print(len(array))
203+
# or to concatenate all arrays into one
204+
# full_array = np.concatenate(list(pipeline))
205+
206+
``Pipeline.iterator()`` also takes an optional ``prefetch`` parameter (default=0)
207+
to allow prefetching up to to this number of arrays in parallel and buffering
208+
them until they are yielded to the caller.
190209

191210
Accessing Mesh Data
192211
................................................................................
@@ -236,17 +255,14 @@ USE-CASE : Take a LiDAR map, create a mesh from the ground points, split into ti
236255
.. code-block:: python
237256
238257
import pdal
239-
import json
240258
import psycopg2
241259
import io
242260
243-
pipe = [
244-
'.../python/test/data/1.2-with-color.las',
245-
{"type": "filters.splitter", "length": 1000},
246-
{"type": "filters.delaunay"}
247-
]
248-
249-
pl = pdal.Pipeline(json.dumps(pipe))
261+
pl = (
262+
pdal.Reader(".../python/test/data/1.2-with-color.las")
263+
| pdal.Filter.splitter(length=1000)
264+
| pdal.Filter.delaunay()
265+
)
250266
pl.execute()
251267
252268
conn = psycopg(%CONNNECTION_STRING%)

0 commit comments

Comments
 (0)