0

I have a point cloud (LAZ format). I want to create a python action that allows me to query a gpstime variable to know the shooting date.

I started writing a script but I don't know how to access the "Gpstime" variable. do you have an idea?

in my example Gpstime = n

import datetime
curr_date = "14-09-2011 00:00:00"
n = 341415420.0000000000
'n = (((n//60)//60)//24)'
curr_date_temp = datetime.datetime.strptime(curr_date,"%d-%m-%Y %H:%M:%S")
new_date = curr_date_temp + datetime.timedelta(seconds=n)
print("la date de prise de vue est le : ", new_date)

enter image description here

0

2 Answers 2

1

here is a code snippet how to access statistics from a point cloud layer:

layer = iface.activeLayer() #the PointCloud layer is the active Layer
print(layer.statistics().minimum('GpsTime')) #min Value of GPS Time
5
  • this works, but it seems that we cannot create python actions with point layers. I need to find a solution..
    – fcka
    Feb 29 at 20:33
  • 1
    that is right, Actions for point cloud layers are not available until now, but you can make a feature request for that: github.com/qgis/QGIS/issues
    – eurojam
    Mar 1 at 7:00
  • OK thanks, I will do it. On the other hand, I wonder if while waiting, it is not possible to create a button in Qgis to launch my script?
    – fcka
    Mar 1 at 9:57
  • 1
    you have 2 possibilities: make a Plugin, which adds a button with your functionallity oder make a processing script, where you can control in- and output.
    – eurojam
    Mar 1 at 11:01
  • 1
    it 's done : github.com/qgis/QGIS/issues/56656
    – fcka
    Mar 3 at 10:10
0
layer = iface.activeLayer() #selection du nuage de point
print(layer.statistics().minimum('GpsTime')) #statistique de la couche point
n= (layer.statistics().minimum('GpsTime'))
import datetime
curr_date = "14-09-2011 00:00:00"
curr_date_temp = datetime.datetime.strptime(curr_date,"%d-%m-%Y %H:%M:%S")
new_date = curr_date_temp + datetime.timedelta(seconds=n)
print("la date de prise de vue est le : ", new_date)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.