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
0094ed8f
Commit
0094ed8f
authored
Dec 05, 2020
by
Corey Koval
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
CZML Data is no longer saved to disk.
parent
2d41f602
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
37 additions
and
26 deletions
+37
-26
df-aggregator.py
df-aggregator.py
+29
-18
requirements.txt
requirements.txt
+6
-6
cesium.tpl
views/cesium.tpl
+2
-2
No files found.
df-aggregator.py
View file @
0094ed8f
...
...
@@ -7,6 +7,7 @@ import time
import
sqlite3
import
threading
import
signal
import
json
# import hashlib
from
colorsys
import
hsv_to_rgb
from
optparse
import
OptionParser
...
...
@@ -17,8 +18,6 @@ from sklearn.preprocessing import StandardScaler, minmax_scale
from
geojson
import
Point
,
MultiPoint
,
Feature
,
FeatureCollection
from
czml3
import
Packet
,
Document
,
Preamble
from
czml3.properties
import
Position
,
Polyline
,
PolylineOutlineMaterial
,
Color
,
Material
import
json
from
bottle
import
route
,
run
,
request
,
get
,
post
,
put
,
response
,
redirect
,
template
,
static_file
d
=
40000
#meters
...
...
@@ -139,7 +138,7 @@ def plot_polar(lat_a, lon_a, lat_a2, lon_a2):
#####################################################
# Find line of intersection between two great circles
#####################################################
def
plot_intersects
(
lat_a
,
lon_a
,
doa_a
,
lat_b
,
lon_b
,
doa_b
,
max_distance
=
5
0000
):
def
plot_intersects
(
lat_a
,
lon_a
,
doa_a
,
lat_b
,
lon_b
,
doa_b
,
max_distance
=
10
0000
):
# plot another point on the lob
# v.direct(lat_a, lon_a, doa_a, d)
# returns (lat_a2, lon_a2)
...
...
@@ -271,7 +270,7 @@ def process_data(database_name, outfile):
# Writes a geojson file upon request.
###############################################
def
write_geojson
(
best_point
,
all_the_points
):
all_pt_style
=
{
"name"
:
"Various
Point
s"
,
"marker-color"
:
"#FF0000"
}
all_pt_style
=
{
"name"
:
"Various
Intersection
s"
,
"marker-color"
:
"#FF0000"
}
best_pt_style
=
{
"name"
:
"Most Likely TX Location"
,
"marker-color"
:
"#00FF00"
}
if
all_the_points
!=
None
:
all_the_points
=
Feature
(
properties
=
all_pt_style
,
geometry
=
MultiPoint
(
tuple
(
all_the_points
)))
...
...
@@ -292,14 +291,16 @@ def write_geojson(best_point, all_the_points):
def
write_czml
(
best_point
,
all_the_points
,
ellipsedata
):
point_properties
=
{
"pixelSize"
:
5.0
,
"heightReference"
:
"RELATIVE_TO_GROUND"
,
"heightReference"
:
"CLAMP_TO_GROUND"
,
# "heightReference":"RELATIVE_TO_GROUND",
# "color": {
# "rgba": [255, 0, 0, 255],
# }
}
best_point_properties
=
{
"pixelSize"
:
12.0
,
"heightReference"
:
"RELATIVE_TO_GROUND"
,
# "heightReference":"RELATIVE_TO_GROUND",
"heightReference"
:
"CLAMP_TO_GROUND"
,
"color"
:
{
"rgba"
:
[
0
,
255
,
0
,
255
],
}
...
...
@@ -359,9 +360,13 @@ def write_czml(best_point, all_the_points, ellipsedata):
ellipse
=
{
**
ellipse_properties
,
**
ellipse_info
},
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
)))
output
=
Document
([
top
]
+
best_point_packets
+
all_point_packets
+
ellipse_packets
)
return
output
###############################################
# Writes receivers.czml used by the WebUI
###############################################
def
write_rx_czml
():
height
=
50
receiver_point_packets
=
[]
...
...
@@ -371,9 +376,9 @@ def write_rx_czml():
rx_properties
=
{
"verticalOrigin"
:
"BOTTOM"
,
"scale"
:
0.75
,
"heightReference"
:
"
RELATIVE
_TO_GROUND"
,
"heightReference"
:
"
CLAMP
_TO_GROUND"
,
"height"
:
48
,
"width"
:
48
"width"
:
48
,
}
for
index
,
x
in
enumerate
(
receivers
):
...
...
@@ -408,8 +413,9 @@ def write_rx_czml():
billboard
=
{
**
rx_properties
,
**
rx_icon
},
position
=
{
"cartographicDegrees"
:
[
x
.
longitude
,
x
.
latitude
,
15
]}))
with
open
(
"static/receivers.czml"
,
"w"
)
as
file1
:
file1
.
write
(
str
(
Document
([
top
]
+
receiver_point_packets
+
lob_packets
)))
output
=
Document
([
top
]
+
receiver_point_packets
+
lob_packets
)
return
output
###############################################
...
...
@@ -475,8 +481,6 @@ def cesium():
response
.
set_header
(
'Cache-Control'
,
'no-cache, no-store, must-revalidate'
)
with
open
(
'accesstoken.txt'
,
"r"
)
as
tokenfile
:
access_token
=
tokenfile
.
read
()
.
replace
(
'
\n
'
,
''
)
write_czml
(
*
process_data
(
database_name
,
geofile
))
write_rx_czml
()
return
template
(
'cesium.tpl'
,
{
'access_token'
:
access_token
,
'epsilon'
:
ms
.
eps
,
...
...
@@ -508,8 +512,6 @@ def update_cesium():
elif
request
.
query
.
plotpts
==
"false"
:
ms
.
plotintersects
=
False
write_czml
(
*
process_data
(
database_name
,
geofile
))
write_rx_czml
()
return
"OK"
###############################################
...
...
@@ -518,8 +520,7 @@ def update_cesium():
###############################################
@get
(
'/rx_params'
)
def
rx_params
():
write_czml
(
*
process_data
(
database_name
,
geofile
))
write_rx_czml
()
all_rx
=
{
'receivers'
:{}}
rx_properties
=
[]
for
index
,
x
in
enumerate
(
receivers
):
...
...
@@ -531,6 +532,16 @@ def rx_params():
response
.
headers
[
'Content-Type'
]
=
'application/json'
return
json
.
dumps
(
all_rx
)
@get
(
'/output.czml'
)
def
tx_czml_out
():
output
=
write_czml
(
*
process_data
(
database_name
,
geofile
))
return
str
(
output
)
@get
(
'/receivers.czml'
)
def
rx_czml_out
():
output
=
write_rx_czml
()
return
str
(
output
)
###############################################
# PUT request to update receiver variables
# from the WebUI
...
...
requirements.txt
View file @
0094ed8f
bottle
=
=0.12.17
geojson
=
=2.5.0
numpy
=
=1.13.3
lxml
=
=4.2.1
czml3
=
=0.5.3
scikit_learn
=
=0.23.2
bottle
>
=0.12.17
geojson
>
=2.5.0
numpy
>
=1.13.3
lxml
>
=4.2.1
czml3
>
=0.5.3
scikit_learn
>
=0.23.2
views/cesium.tpl
View file @
0094ed8f
...
...
@@ -47,14 +47,14 @@
}
function
loadTxCzml
()
{
var
transmittersDataSource
=
Cesium
.
CzmlDataSource
.
load
(
'/
static/
output.czml'
);
var
transmittersDataSource
=
Cesium
.
CzmlDataSource
.
load
(
'/output.czml'
);
viewer
.
dataSources
.
add
(
transmittersDataSource
);
// console.log("Loaded CZML");
return
transmittersDataSource
;
}
function
loadRxCzml
()
{
var
receiversDataSource
=
Cesium
.
CzmlDataSource
.
load
(
'/
static/
receivers.czml'
);
var
receiversDataSource
=
Cesium
.
CzmlDataSource
.
load
(
'/receivers.czml'
);
viewer
.
dataSources
.
add
(
receiversDataSource
);
// console.log("Loaded CZML");
return
receiversDataSource
;
...
...
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