25 rdb-example-03-select-points.py 27 This example shows different ways to open an existing database and query 36 Load points that meet filter criteria and print them point-wise. 37 To load all points instead, simply remove the filter string or 38 specify 'None' (the constant, not the string "None"). 41 with riegl.rdb.rdb_open(
"pointcloud.rdbx")
as rdb:
42 for point
in rdb.points(
43 "(riegl.xyz[2] > 5) && (riegl.reflectance > 35)" 45 print(
"{0}, {1}, {2}".format(
48 point.riegl_reflectance
54 Similar to example A, but instead of loading all point attributes 55 we specify the names of the point attributes to load and print. 58 with riegl.rdb.rdb_open(
"pointcloud.rdbx")
as rdb:
59 for point
in rdb.points(
60 "(riegl.xyz[2] > 5) && (riegl.reflectance > 35)",
61 [
"riegl.id",
"riegl.xyz",
"riegl.reflectance"]
68 Similar to example A, but instead of loading point-by-point, we 69 load points chunk-wise and access the attributes via arrays. 70 Please note that we use select() instead of points() this time. 73 with riegl.rdb.rdb_open(
"pointcloud.rdbx")
as rdb:
74 for points
in rdb.select(
75 "(riegl.xyz[2] > 5) && (riegl.reflectance > 35)",
78 print(points.riegl_id)
79 print(points[
"riegl.xyz"])
80 print(points.riegl_reflectance)
85 This example shows the most flexible way as known from the RDB C++ API. 86 This time we manually create buffers for the point attributes read from 87 the point cloud and iterate the point cloud chunk-wise. 90 with riegl.rdb.rdb_open(
"pointcloud.rdbx")
as rdb:
92 chunk_size = 100 * 1000
95 buffer_xyz = riegl.rdb.AttributeBuffer(
96 rdb.point_attributes.riegl_xyz, chunk_size
98 buffer_reflectance = riegl.rdb.AttributeBuffer(
99 rdb.point_attributes.riegl_reflectance, chunk_size
103 with rdb.select()
as query:
105 query.bind(buffer_xyz)
106 query.bind(buffer_reflectance)
109 while point_count > 0:
110 point_count = query.next(chunk_size)
115 for i
in range(point_count):
116 print(
"{0}, {1}".format(
118 buffer_reflectance[i]
122 if __name__ ==
"__main__":