25 rdb-example-02-insert-points.py 27 This example shows how to open an existing database and add some points. 28 This example is based on the database of rdb-example-1-create-database. 38 Basic example to add some points. 41 with riegl.rdb.rdb_open(
"pointcloud.rdbx")
as rdb:
44 details_coordinates = rdb.point_attributes[
"riegl.xyz"]
45 details_reflectance = rdb.point_attributes[
"riegl.reflectance"]
48 with riegl.rdb.Transaction(
57 buffer_coordinates = riegl.rdb.AttributeBuffer(
58 details_coordinates, buffer_size
60 buffer_reflectance = riegl.rdb.AttributeBuffer(
61 details_reflectance, buffer_size
65 with rdb.insert()
as query:
66 query.bind(buffer_coordinates)
67 query.bind(buffer_reflectance)
71 while total < point_count:
73 for i
in range(buffer_size):
74 buffer_coordinates[i] = [random.uniform(
75 details_coordinates.minimum_value,
76 details_coordinates.maximum_value
78 buffer_reflectance[i] = random.uniform(
79 details_reflectance.minimum_value,
80 details_reflectance.maximum_value
84 total += query.next(buffer_size)
92 Similar to example_plain() but we use NumPy arrays here. 97 c = np.array([[1, 2, 3], [4, 5, 6]])
101 with riegl.rdb.rdb_open(
"pointcloud.rdbx")
as rdb:
104 with riegl.rdb.Transaction(
107 "Point Importer v1.0" 111 with rdb.insert()
as insert:
113 buffers = riegl.rdb.PointBuffer(rdb, count=len(c), attributes=[
119 np.copyto(buffers[
"riegl.xyz"] .data, c)
120 np.copyto(buffers[
"riegl.reflectance"].data, r)
130 if __name__ ==
"__main__":