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
lazData_path = ["server/example_lidar_data/ot_N_000005_1.laz", "server/example_lidar_data/ot_N_000033_1.laz"]
# Info about data
with laspy.open(lazData_path[0]) as fh:
# Print metadata properties
print("File Version:", fh.header.version)
print("Point Count:", fh.header.point_count)
print("Scale Factors:", fh.header.scale)
print("Offset:", fh.header.offset)
print('Points from Header:', fh.header.point_count)
las = fh.read()
print(las)
print('Points from data:', len(las.points))
ground_pts = las.classification == 2
bins, counts = np.unique(las.return_number[ground_pts], return_counts=True)
print('Ground Point Return Number distribution:')
for r, c in zip(bins, counts):
print(' {}:{}'.format(r, c))
def about_laz_file():
with laspy.open(lazData_path[0]) as fh:
# Print metadata properties
print("File Version:", fh.header.version)
print("Point Count:", fh.header.point_count)
print("Scale Factors:", fh.header.scale)
print("Offset:", fh.header.offset)
las = fh.read()
print(las)
print('Points from data:', len(las.points))
ground_pts = las.classification == 2
bins, counts = np.unique(las.return_number[ground_pts], return_counts=True)
print('Ground Point Return Number distribution:')
for r, c in zip(bins, counts):
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
def inArea(position, areaRange):
......
No preview for this file type
No preview for this file type
import json
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)
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
# 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
# and an estimate of average thickness of ice on water body
cursor.execute('''
INSERT INTO Measurement( SensorID, TimeMeasured, WaterBodyName,
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
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