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 with riegl.rdb.rdb_open(
"pointcloud.rdbx")
as rdb:
41 details_coordinates = rdb.point_attributes.riegl_xyz
42 details_reflectance = rdb.point_attributes.riegl_reflectance
45 with riegl.rdb.Transaction(
54 buffer_coordinates = riegl.rdb.AttributeBuffer(
55 details_coordinates, buffer_size
57 buffer_reflectance = riegl.rdb.AttributeBuffer(
58 details_reflectance, buffer_size
62 with rdb.insert()
as query:
63 query.bind(buffer_coordinates)
64 query.bind(buffer_reflectance)
68 while total < point_count:
70 for i
in range(buffer_size):
71 buffer_coordinates[i] = [random.uniform(
72 details_coordinates.minimum_value,
73 details_coordinates.maximum_value
75 buffer_reflectance[i] = random.uniform(
76 details_reflectance.minimum_value,
77 details_reflectance.maximum_value
81 total += query.next(buffer_size)
89 Similar to example_plain() but we use NumPy arrays here. 94 c = np.array([[1, 2, 3], [4, 5, 6]])
98 with riegl.rdb.rdb_open(
"pointcloud.rdbx")
as rdb:
101 with riegl.rdb.Transaction(
104 "Point Importer v1.0" 108 with rdb.insert()
as insert:
110 buffers = riegl.rdb.PointBuffer(rdb, count=len(c), attributes=[
116 np.copyto(buffers[
"riegl.xyz"] .data, c)
117 np.copyto(buffers[
"riegl.reflectance"].data, r)
127 if __name__ ==
"__main__":