I am creating a Qgis plugin that processes point clouds. When creating a QgsPointCloudLayer object in Qgis, indexing of this layer begins. But this indexing reaches 100% and is not completed.
def processAlgorithm(self, parameters, context, feedback):
input = self.parameterAsPointCloudLayer(parameters, self.INPUT, context).source()
output = self.parameterAsFileOutput(parameters, self.OUTPUT, context)
#processing point cloud
#...
# adding layer
layer = QgsPointCloudLayer(output, "New layer", 'pdal')
if not layer.isValid():
feedback.pushInfo("invalid layer!")
else:
feedback.pushInfo("layer loaded!")
QgsProject.instance().addMapLayer(layer)
return {self.name(): 0}
Endless indexing in Qgis
I was trying to specify the path to the files .las, .laz, .copc.laz, but the result was always the same – endless indexing. If you add this cloud point to Qgis manually (by dragging or layer – > add layer), then everything will work fine.
I tried to create a QgsPointCloudLayer in the Python console (which is inside Qgis) and it worked. But it doesn’t work inside the plugin.
HEOPS is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.