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

change: adapt to changes

parent 34b11515
No related branches found
No related tags found
No related merge requests found
......@@ -57,21 +57,19 @@ def find_height(points):
height_differences.append(difference)
groupss.append(groups)
return min(height_differences)
return height_differences
print(lazData_path[0])
# Refactor data format
iceOver = laspy.read(lazData_path[0])
iceUnder = laspy.read(lazData_path[1])
# areas
def height_in_area(area):
# Refactor data format
iceOver = laspy.read(lazData_path[0])
iceUnder = laspy.read(lazData_path[1])
ice_points = list(zip(iceOver.X,iceOver.Y,iceOver.Z)) + list(zip(iceUnder.X,iceUnder.Y,iceUnder.Z))
ice_points = list(zip(iceOver.X,iceOver.Y,iceOver.Z)) + list(zip(iceUnder.X,iceUnder.Y,iceUnder.Z))
area_heights = []
area_heights = []
# areas
for area in areas:
ice_points = list(filter(lambda position: inArea(position, area), ice_points))
area_heights.append(find_height(ice_points))
print(area_heights)
\ No newline at end of file
return area_heights
import json
from datetime import datetime
from server.data_processing.process_lidar_data import height_in_area
# get_markers requests all marker data or valid markers, converts the data to json, and writes
# the data to the response object
......@@ -105,7 +106,6 @@ def get_all_markers(self, cursor, valid: bool):
def input_new_Lidar_data(self, cursor, sensorId, bodyOfWater):
try:
cursor.execute('''
INSERT INTO Measurement( SensorID, TimeMeasured, WaterBodyName) VALUES
(?,?,?);
......@@ -115,19 +115,21 @@ def input_new_Lidar_data(self, cursor, sensorId, bodyOfWater):
measurement_id = cursor.lastrowid
cursor.execute('''
SELECT CornerLatitude, CornerLongitude
FROM Cursor
SELECT DISTINCT CenterLatitude, CenterLongitude
FROM SubDivision
where MeasurementID = ?;
''')
cursor_data = cursor.fetchall()
position_data = cursor.fetchall()
if(cursor_data):
for row in cursor_data:
longitude, latitude = row
if(position_data):
for row in position_data:
latitude, longitude = row
heights = height_in_area((latitude,longitude))
average = sum(heights)/len(heights)
cursor.execute('''
INSERT INTO Data(MeasurementID, Latitude, Longitude, IceTop, IceBottom, CalculatedThickness) VALUES
(?,?,?,?);
''',(measurementId, ))
INSERT INTO SubDivision(MeasurementID, SubDivisionID, GroupID, MinimumThickness, AverageThickness, CenterLatitude, CenterLongitude, Accuracy) VALUES
(?,?,?,?,?,?,?,?);
''',(measurement_id, 1, 1, min(heights), average, latitude, longitude, 1))
cursor.connection.commit()
......
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