Skip to content
Snippets Groups Projects
Commit 6fbcc8bd authored by Hoa Ben The Nguyen's avatar Hoa Ben The Nguyen
Browse files

change: made about laz file to a function and set it to the database as accuracy for now

parent 59caf95b
No related branches found
No related tags found
No related merge requests found
...@@ -9,22 +9,24 @@ from server.data_processing.area_processing import calculate_corners, define_gri ...@@ -9,22 +9,24 @@ from server.data_processing.area_processing import calculate_corners, define_gri
lazData_path = ["server/example_lidar_data/ot_N_000005_1.laz", "server/example_lidar_data/ot_N_000033_1.laz"] lazData_path = ["server/example_lidar_data/ot_N_000005_1.laz", "server/example_lidar_data/ot_N_000033_1.laz"]
# Info about data # Info about data
with laspy.open(lazData_path[0]) as fh: def about_laz_file():
# Print metadata properties with laspy.open(lazData_path[0]) as fh:
print("File Version:", fh.header.version) # Print metadata properties
print("Point Count:", fh.header.point_count) print("File Version:", fh.header.version)
print("Scale Factors:", fh.header.scale) print("Point Count:", fh.header.point_count)
print("Offset:", fh.header.offset) print("Scale Factors:", fh.header.scale)
print("Offset:", fh.header.offset)
print('Points from Header:', fh.header.point_count)
las = fh.read() las = fh.read()
print(las) print(las)
print('Points from data:', len(las.points)) print('Points from data:', len(las.points))
ground_pts = las.classification == 2 ground_pts = las.classification == 2
bins, counts = np.unique(las.return_number[ground_pts], return_counts=True) bins, counts = np.unique(las.return_number[ground_pts], return_counts=True)
print('Ground Point Return Number distribution:') print('Ground Point Return Number distribution:')
for r, c in zip(bins, counts): for r, c in zip(bins, counts):
print(' {}:{}'.format(r, c)) print(' {}:{}'.format(r, c))
return [las.header.version, las.header.point_count, las.header.scale, las.header.offset]
# check if lidar points is within range of the area selected # check if lidar points is within range of the area selected
def inArea(position, areaRange): def inArea(position, areaRange):
......
No preview for this file type
No preview for this file type
import json import json
from datetime import datetime from datetime import datetime
from server.data_processing.process_lidar_data import calculate_area_data from server.data_processing.process_lidar_data import calculate_area_data, about_laz_file
# input_new_Lidar_data send new data gathered from the lidar and send it to the database (from the drone, most likely) # input_new_Lidar_data send new data gathered from the lidar and send it to the database (from the drone, most likely)
def input_new_Lidar_data(self, cursor, sensorId, bodyOfWater): def input_new_Lidar_data(self, cursor, sensorId, bodyOfWater):
...@@ -11,13 +11,17 @@ def input_new_Lidar_data(self, cursor, sensorId, bodyOfWater): ...@@ -11,13 +11,17 @@ def input_new_Lidar_data(self, cursor, sensorId, bodyOfWater):
total_measurement_average = 0 # the total average of a measurement total_measurement_average = 0 # the total average of a measurement
# data about the file read from
about_laz = about_laz_file()
scale_factor = max(about_laz[2])
# create a new measurement with the time the data is sent, sensor type, where # create a new measurement with the time the data is sent, sensor type, where
# and an estimate of average thickness of ice on water body # and an estimate of average thickness of ice on water body
cursor.execute(''' cursor.execute('''
INSERT INTO Measurement( SensorID, TimeMeasured, WaterBodyName, INSERT INTO Measurement( SensorID, TimeMeasured, WaterBodyName,
WholeAverageThickness, CenterLat, CenterLon) VALUES WholeAverageThickness, CenterLat, CenterLon) VALUES
(?,?,?,?,?,?); (?,?,?,?,?,?);
''', (sensorId, datetime.utcnow().replace(microsecond=0), bodyOfWater, 0, latitude, longitude)) ''', (sensorId, datetime.utcnow().replace(microsecond=0), bodyOfWater, 0, latitude, longitude, scale_factor))
# auto generate new measurement id # auto generate new measurement id
measurement_id = cursor.lastrowid measurement_id = cursor.lastrowid
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment