Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
df-aggregator
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Oleksandr Barabash
df-aggregator
Commits
24ded407
Commit
24ded407
authored
Dec 04, 2020
by
Corey Koval
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Draws LOBs, receivers in own CZML file, increased refresh to 10 seconds
parent
0791b0c7
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
73 additions
and
21 deletions
+73
-21
df-aggregator.py
df-aggregator.py
+45
-10
Screenshot from 2020-12-04 23-00-08.png
screenshots/Screenshot from 2020-12-04 23-00-08.png
+0
-0
receiver_configurator.js
static/receiver_configurator.js
+5
-5
cesium.tpl
views/cesium.tpl
+23
-6
No files found.
df-aggregator.py
View file @
24ded407
...
@@ -16,6 +16,7 @@ from sklearn.cluster import DBSCAN
...
@@ -16,6 +16,7 @@ from sklearn.cluster import DBSCAN
from
sklearn.preprocessing
import
StandardScaler
,
minmax_scale
from
sklearn.preprocessing
import
StandardScaler
,
minmax_scale
from
geojson
import
Point
,
MultiPoint
,
Feature
,
FeatureCollection
from
geojson
import
Point
,
MultiPoint
,
Feature
,
FeatureCollection
from
czml3
import
Packet
,
Document
,
Preamble
from
czml3
import
Packet
,
Document
,
Preamble
from
czml3.properties
import
Position
,
Polyline
,
PolylineOutlineMaterial
,
Color
,
Material
import
json
import
json
from
bottle
import
route
,
run
,
request
,
get
,
post
,
put
,
response
,
redirect
,
template
,
static_file
from
bottle
import
route
,
run
,
request
,
get
,
post
,
put
,
response
,
redirect
,
template
,
static_file
...
@@ -303,13 +304,6 @@ def write_czml(best_point, all_the_points, ellipsedata):
...
@@ -303,13 +304,6 @@ def write_czml(best_point, all_the_points, ellipsedata):
"rgba"
:
[
0
,
255
,
0
,
255
],
"rgba"
:
[
0
,
255
,
0
,
255
],
}
}
}
}
rx_properties
=
{
"verticalOrigin"
:
"BOTTOM"
,
"scale"
:
0.75
,
"heightReference"
:
"RELATIVE_TO_GROUND"
,
"height"
:
48
,
"width"
:
48
}
ellipse_properties
=
{
ellipse_properties
=
{
"granularity"
:
0.008722222
,
"granularity"
:
0.008722222
,
...
@@ -325,7 +319,6 @@ def write_czml(best_point, all_the_points, ellipsedata):
...
@@ -325,7 +319,6 @@ def write_czml(best_point, all_the_points, ellipsedata):
top
=
Preamble
(
name
=
"Geolocation Data"
)
top
=
Preamble
(
name
=
"Geolocation Data"
)
all_point_packets
=
[]
all_point_packets
=
[]
best_point_packets
=
[]
best_point_packets
=
[]
receiver_point_packets
=
[]
ellipse_packets
=
[]
ellipse_packets
=
[]
if
len
(
all_the_points
)
>
0
and
(
ms
.
plotintersects
or
ms
.
eps
==
0
):
if
len
(
all_the_points
)
>
0
and
(
ms
.
plotintersects
or
ms
.
eps
==
0
):
...
@@ -366,7 +359,43 @@ def write_czml(best_point, all_the_points, ellipsedata):
...
@@ -366,7 +359,43 @@ def write_czml(best_point, all_the_points, ellipsedata):
ellipse
=
{
**
ellipse_properties
,
**
ellipse_info
},
ellipse
=
{
**
ellipse_properties
,
**
ellipse_info
},
position
=
{
"cartographicDegrees"
:
[
x
[
3
],
x
[
4
],
15
]}))
position
=
{
"cartographicDegrees"
:
[
x
[
3
],
x
[
4
],
15
]}))
with
open
(
"static/output.czml"
,
"w"
)
as
file1
:
file1
.
write
(
str
(
Document
([
top
]
+
best_point_packets
+
all_point_packets
+
ellipse_packets
)))
def
write_rx_czml
():
height
=
50
receiver_point_packets
=
[]
lob_packets
=
[]
top
=
Preamble
(
name
=
"Receivers"
)
rx_properties
=
{
"verticalOrigin"
:
"BOTTOM"
,
"scale"
:
0.75
,
"heightReference"
:
"RELATIVE_TO_GROUND"
,
"height"
:
48
,
"width"
:
48
}
for
index
,
x
in
enumerate
(
receivers
):
for
index
,
x
in
enumerate
(
receivers
):
if
x
.
isActive
and
ms
.
receiving
:
lob_start_lat
=
x
.
latitude
lob_start_lon
=
x
.
longitude
lob_stop_lat
,
lob_stop_lon
=
v
.
direct
(
lob_start_lat
,
lob_start_lon
,
x
.
doa
,
d
)
lob_packets
.
append
(
Packet
(
id
=
f
"LOB-{x.station_id}-{index}"
,
polyline
=
Polyline
(
material
=
Material
(
polylineOutline
=
PolylineOutlineMaterial
(
color
=
Color
(
rgba
=
[
255
,
140
,
0
,
255
]),
outlineColor
=
Color
(
rgba
=
[
0
,
0
,
0
,
255
]),
outlineWidth
=
2
)),
clampToGround
=
True
,
width
=
5
,
positions
=
Position
(
cartographicDegrees
=
[
lob_start_lon
,
lob_start_lat
,
height
,
lob_stop_lon
,
lob_stop_lat
,
height
])
)))
else
:
lob_packets
=
[]
if
x
.
isMobile
==
True
:
if
x
.
isMobile
==
True
:
rx_icon
=
{
"image"
:{
"uri"
:
"/static/flipped_car.svg"
}}
rx_icon
=
{
"image"
:{
"uri"
:
"/static/flipped_car.svg"
}}
# if x.heading > 0 or x.heading < 180:
# if x.heading > 0 or x.heading < 180:
...
@@ -379,8 +408,9 @@ def write_czml(best_point, all_the_points, ellipsedata):
...
@@ -379,8 +408,9 @@ def write_czml(best_point, all_the_points, ellipsedata):
billboard
=
{
**
rx_properties
,
**
rx_icon
},
billboard
=
{
**
rx_properties
,
**
rx_icon
},
position
=
{
"cartographicDegrees"
:
[
x
.
longitude
,
x
.
latitude
,
15
]}))
position
=
{
"cartographicDegrees"
:
[
x
.
longitude
,
x
.
latitude
,
15
]}))
with
open
(
"static/output.czml"
,
"w"
)
as
file1
:
with
open
(
"static/receivers.czml"
,
"w"
)
as
file1
:
file1
.
write
(
str
(
Document
([
top
]
+
best_point_packets
+
all_point_packets
+
receiver_point_packets
+
ellipse_packets
)))
file1
.
write
(
str
(
Document
([
top
]
+
receiver_point_packets
+
lob_packets
)))
###############################################
###############################################
# Converts HSV color values to RGB.
# Converts HSV color values to RGB.
...
@@ -431,6 +461,7 @@ def clear(debugging):
...
@@ -431,6 +461,7 @@ def clear(debugging):
###############################################
###############################################
@route
(
'/static/<filepath:path>'
,
name
=
'static'
)
@route
(
'/static/<filepath:path>'
,
name
=
'static'
)
def
server_static
(
filepath
):
def
server_static
(
filepath
):
response
.
set_header
(
'Cache-Control'
,
'no-cache, no-store, must-revalidate'
)
return
static_file
(
filepath
,
root
=
'./static'
)
return
static_file
(
filepath
,
root
=
'./static'
)
###############################################
###############################################
...
@@ -441,9 +472,11 @@ def server_static(filepath):
...
@@ -441,9 +472,11 @@ def server_static(filepath):
@get
(
'/index'
)
@get
(
'/index'
)
@get
(
'/cesium'
)
@get
(
'/cesium'
)
def
cesium
():
def
cesium
():
response
.
set_header
(
'Cache-Control'
,
'no-cache, no-store, must-revalidate'
)
with
open
(
'accesstoken.txt'
,
"r"
)
as
tokenfile
:
with
open
(
'accesstoken.txt'
,
"r"
)
as
tokenfile
:
access_token
=
tokenfile
.
read
()
.
replace
(
'
\n
'
,
''
)
access_token
=
tokenfile
.
read
()
.
replace
(
'
\n
'
,
''
)
write_czml
(
*
process_data
(
database_name
,
geofile
))
write_czml
(
*
process_data
(
database_name
,
geofile
))
write_rx_czml
()
return
template
(
'cesium.tpl'
,
return
template
(
'cesium.tpl'
,
{
'access_token'
:
access_token
,
{
'access_token'
:
access_token
,
'epsilon'
:
ms
.
eps
,
'epsilon'
:
ms
.
eps
,
...
@@ -476,6 +509,7 @@ def update_cesium():
...
@@ -476,6 +509,7 @@ def update_cesium():
ms
.
plotintersects
=
False
ms
.
plotintersects
=
False
write_czml
(
*
process_data
(
database_name
,
geofile
))
write_czml
(
*
process_data
(
database_name
,
geofile
))
write_rx_czml
()
return
"OK"
return
"OK"
###############################################
###############################################
...
@@ -485,6 +519,7 @@ def update_cesium():
...
@@ -485,6 +519,7 @@ def update_cesium():
@get
(
'/rx_params'
)
@get
(
'/rx_params'
)
def
rx_params
():
def
rx_params
():
write_czml
(
*
process_data
(
database_name
,
geofile
))
write_czml
(
*
process_data
(
database_name
,
geofile
))
write_rx_czml
()
all_rx
=
{
'receivers'
:{}}
all_rx
=
{
'receivers'
:{}}
rx_properties
=
[]
rx_properties
=
[]
for
index
,
x
in
enumerate
(
receivers
):
for
index
,
x
in
enumerate
(
receivers
):
...
...
screenshots/Screenshot from 2020-12-04 23-00-08.png
0 → 100644
View file @
24ded407
This diff is collapsed.
Click to expand it.
static/receiver_configurator.js
View file @
24ded407
// Update Map ever 5 seconds
// Update Map ever 5 seconds
var
refreshrate
=
5
000
;
var
refreshrate
=
10
000
;
var
autoRefresh
=
setInterval
(
function
()
{
updateParams
();
},
refreshrate
);
var
autoRefresh
=
setInterval
(
function
()
{
updateParams
();
},
refreshrate
);
// *************************************************
// *************************************************
...
@@ -100,7 +100,7 @@ function editReceivers(rx_json, id) {
...
@@ -100,7 +100,7 @@ function editReceivers(rx_json, id) {
fetch
(
"/rx_params/"
+
id
,
otherParams
)
fetch
(
"/rx_params/"
+
id
,
otherParams
)
.
then
(
res
=>
{
.
then
(
res
=>
{
updateRx
(
showReceivers
,
id
);
updateRx
(
showReceivers
,
id
);
loadCzml
();
load
All
Czml
();
})
})
}
}
}
}
...
@@ -122,7 +122,7 @@ function makeNewRx(url) {
...
@@ -122,7 +122,7 @@ function makeNewRx(url) {
fetch
(
"/rx_params/new"
,
otherParams
)
fetch
(
"/rx_params/new"
,
otherParams
)
.
then
(
res
=>
{
.
then
(
res
=>
{
updateRx
(
createReceivers
,
true
);
updateRx
(
createReceivers
,
true
);
loadCzml
();
load
All
Czml
();
})
})
}
}
...
@@ -159,7 +159,7 @@ function deleteReceiver(uid) {
...
@@ -159,7 +159,7 @@ function deleteReceiver(uid) {
.
then
(
res
=>
{
.
then
(
res
=>
{
// removerx(uid);
// removerx(uid);
loadRx
(
createReceivers
);
loadRx
(
createReceivers
);
loadCzml
();
load
All
Czml
();
})
})
}
}
...
@@ -180,7 +180,7 @@ function activateReceiver(uid, state) {
...
@@ -180,7 +180,7 @@ function activateReceiver(uid, state) {
fetch
(
"/rx_params/activate"
,
otherParams
)
fetch
(
"/rx_params/activate"
,
otherParams
)
.
then
(
res
=>
{
.
then
(
res
=>
{
loadRx
(
refreshRx
);
loadRx
(
refreshRx
);
loadCzml
();
load
All
Czml
();
})
})
}
}
...
...
views/cesium.tpl
View file @
24ded407
<!DOCTYPE html>
<!DOCTYPE html>
<html
lang=
"en"
>
<html
lang=
"en"
>
<head>
<head>
<meta
http-equiv=
"Cache-Control"
content=
"no-cache, no-store, must-revalidate"
>
<meta
http-equiv=
"Pragma"
content=
"no-cache"
>
<meta
http-equiv=
"Expires"
content=
"0"
>
<meta
name=
"viewport"
content=
"width=device-width, height=device-height"
>
<meta
name=
"viewport"
content=
"width=device-width, height=device-height"
>
<meta
charset=
"utf-8"
>
<meta
charset=
"utf-8"
>
<!-- Include the CesiumJS JavaScript and CSS files -->
<!-- Include the CesiumJS JavaScript and CSS files -->
...
@@ -18,6 +21,7 @@
...
@@ -18,6 +21,7 @@
<script>
<script>
// Your access token can be found at: https://cesium.com/ion/tokens.
// Your access token can be found at: https://cesium.com/ion/tokens.
Cesium
.
Ion
.
defaultAccessToken
=
'{
{
access_token
}
}'
;
Cesium
.
Ion
.
defaultAccessToken
=
'{
{
access_token
}
}'
;
// var hpr = new Cesium.HeadingPitchRange(0, 40, 0)
var
viewer
=
new
Cesium
.
Viewer
(
'cesiumContainer'
,
{
var
viewer
=
new
Cesium
.
Viewer
(
'cesiumContainer'
,
{
terrainProvider
:
Cesium
.
createWorldTerrain
(),
terrainProvider
:
Cesium
.
createWorldTerrain
(),
homeButton
:
false
,
homeButton
:
false
,
...
@@ -28,7 +32,7 @@
...
@@ -28,7 +32,7 @@
});
});
viewer
.
clock
.
shouldAnimate
=
true
;
viewer
.
clock
.
shouldAnimate
=
true
;
viewer
.
zoomTo
(
loadCzml
());
viewer
.
zoomTo
(
load
All
Czml
());
function
updateParams
(
parameter
)
{
function
updateParams
(
parameter
)
{
fetch
(
"/update?"
+
parameter
)
fetch
(
"/update?"
+
parameter
)
...
@@ -36,17 +40,30 @@
...
@@ -36,17 +40,30 @@
if
(
response
.
status
==
200
)
{
if
(
response
.
status
==
200
)
{
loadRx
(
refreshRx
);
loadRx
(
refreshRx
);
clearOld
();
clearOld
();
loadCzml
();
load
All
Czml
();
// console.log(response);
// console.log(response);
}
}
})
})
}
}
function
loadCzml
()
{
function
load
Tx
Czml
()
{
var
dataSourcePromis
e
=
Cesium
.
CzmlDataSource
.
load
(
'/static/output.czml'
);
var
transmittersDataSourc
e
=
Cesium
.
CzmlDataSource
.
load
(
'/static/output.czml'
);
viewer
.
dataSources
.
add
(
dataSourcePromis
e
);
viewer
.
dataSources
.
add
(
transmittersDataSourc
e
);
// console.log("Loaded CZML");
// console.log("Loaded CZML");
return
dataSourcePromise
;
return
transmittersDataSource
;
}
function
loadRxCzml
()
{
var
receiversDataSource
=
Cesium
.
CzmlDataSource
.
load
(
'/static/receivers.czml'
);
viewer
.
dataSources
.
add
(
receiversDataSource
);
// console.log("Loaded CZML");
return
receiversDataSource
;
}
function
loadAllCzml
()
{
loadTxCzml
();
let
zoom
=
loadRxCzml
();
return
zoom
;
}
}
function
clearOld
()
{
function
clearOld
()
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment