25 rdb-example-01-create-database.py
27 This example shows how to create a new RDB point cloud database and define
28 some point attributes.
34 def example_define_point_attributes(pointcloud):
36 This function shows how to define and add new point attributes
37 and is used by the example functions below. Please note that there
38 is also a shortcut for built-in RIEGL default point attributes
39 which we use to define the "riegl.class" attribute at the end of
44 reflectance = riegl.rdb.PointAttribute(pointcloud)
45 reflectance.name =
"riegl.reflectance"
46 reflectance.title =
"Reflectance"
47 reflectance.description =
"Target surface reflectance"
48 reflectance.unit_symbol =
"dB"
49 reflectance.length = 1
50 reflectance.resolution = 0.010
51 reflectance.minimum_value = -100.000
52 reflectance.maximum_value = +100.000
53 reflectance.default_value = 0.000
54 reflectance.storage_class = riegl.rdb.PointAttribute.StorageClass.CONSTANT
55 pointcloud.point_attributes.add(reflectance)
58 point_color = riegl.rdb.PointAttribute(pointcloud)
59 point_color.name =
"riegl.rgba"
60 point_color.title =
"True Color"
61 point_color.description =
"Point color acquired by camera"
62 point_color.unit_symbol =
""
63 point_color.length = 4
64 point_color.resolution = 1.000
65 point_color.minimum_value = 0.000
66 point_color.maximum_value = 255.000
67 point_color.default_value = 255.000
68 point_color.storage_class = riegl.rdb.PointAttribute.StorageClass.VARIABLE
69 pointcloud.point_attributes.add(point_color)
72 pointcloud.point_attributes.add(
"riegl.class")
77 This is a very simple example using default values for most options.
80 with riegl.rdb.rdb_create(
"pointcloud.rdbx")
as rdb:
82 with riegl.rdb.Transaction(
85 "Example program v1.0"
88 example_define_point_attributes(rdb)
96 This is a more advanced example, very similar to the C++ API example 1.
107 settings = riegl.rdb.CreateSettings(context)
111 settings.primary_attribute.name =
"riegl.xyz"
112 settings.primary_attribute.title =
"XYZ"
113 settings.primary_attribute.description =
"Cartesian point coordinates"
114 settings.primary_attribute.unit_symbol =
"m"
115 settings.primary_attribute.length = 3
116 settings.primary_attribute.resolution = 0.00025
117 settings.primary_attribute.minimum_value = -535000.0
118 settings.primary_attribute.maximum_value = +535000.0
119 settings.primary_attribute.default_value = 0.0
120 settings.primary_attribute.storage_class = \
121 riegl.rdb.PointAttribute.StorageClass.VARIABLE
124 settings.chunk_size = 50000
125 settings.compression_level = 50
128 rdb.create(
"pointcloud.rdbx", settings)
131 with riegl.rdb.Transaction(
134 "Example program v1.0"
137 example_define_point_attributes(rdb)
143 if __name__ ==
"__main__":