Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
PROG2900
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Sara Savanovic Djordjevic
PROG2900
Commits
7649cb49
Commit
7649cb49
authored
11 months ago
by
Sara Savanovic Djordjevic
Browse files
Options
Downloads
Patches
Plain Diff
update: NVE path
parent
050dd360
No related branches found
Branches containing commit
No related tags found
1 merge request
!12
Clhp map
Changes
21
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
server/map_handler/input_new_data.py
+7
-6
7 additions, 6 deletions
server/map_handler/input_new_data.py
with
7 additions
and
6 deletions
server/map_handler/input_new_data.py
+
7
−
6
View file @
7649cb49
...
...
@@ -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
()
This diff is collapsed.
Click to expand it.
Prev
1
2
Next
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment