Skip to content
Snippets Groups Projects
Commit 7649cb49 authored by Sara Savanovic Djordjevic's avatar Sara Savanovic Djordjevic
Browse files

update: NVE path

parent 050dd360
No related branches found
No related tags found
1 merge request!12Clhp map
......@@ -2,6 +2,7 @@ import json
from datetime import datetime
from server.data_processing.process_lidar_data import calculate_area_data
# 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):
try:
......@@ -25,12 +26,11 @@ def input_new_Lidar_data(self, cursor, sensorId, bodyOfWater):
# calculate the area of to be calculated based on the coordinates given to the calculation model
areas_data = calculate_area_data((latitude, longitude))
if(areas_data):
if (areas_data):
# calculate data for each zone within the area
for area in areas_data:
if(len(area[2]) != 0):
average = sum(area[2])/len(area[2])
if (len(area[2]) != 0):
average = sum(area[2]) / len(area[2])
minimum_thickness = min(area[2])
else:
average = 0
......@@ -42,7 +42,8 @@ def input_new_Lidar_data(self, cursor, sensorId, bodyOfWater):
cursor.execute('''
INSERT INTO SubDivision(MeasurementID, SubDivisionID, GroupID, MinimumThickness, AverageThickness, CenterLatitude, CenterLongitude, Accuracy) VALUES
(?,?,?,?,?,?,?,?);
''',(measurement_id, area[0], area[1], float(minimum_thickness), float(average), float(latitude), float(longitude), float(1)))
''', (measurement_id, area[0], area[1], float(minimum_thickness), float(average), float(latitude),
float(longitude), float(1)))
total_measurement_average = total_measurement_average / len(areas_data)
......@@ -65,4 +66,4 @@ def input_new_Lidar_data(self, cursor, sensorId, bodyOfWater):
except Exception as e:
print("An error occurred", e)
# rollback in case of error
cursor.connection.rollback()
\ No newline at end of file
cursor.connection.rollback()
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