Commit 9787e0bc by Corey Koval

Started working on WebGUI

parent cca17660
...@@ -5,6 +5,8 @@ import numpy as np ...@@ -5,6 +5,8 @@ import numpy as np
import math import math
import time import time
import sqlite3 import sqlite3
import threading
import webgui
from optparse import OptionParser from optparse import OptionParser
from os import system, name from os import system, name
from lxml import etree from lxml import etree
...@@ -54,7 +56,6 @@ class receiver: ...@@ -54,7 +56,6 @@ class receiver:
self.confidence = int(xml_conf.text) self.confidence = int(xml_conf.text)
except: except:
print("Problem connecting to receiver.") print("Problem connecting to receiver.")
pass
latitude = 0.0 latitude = 0.0
longitude = 0.0 longitude = 0.0
...@@ -203,6 +204,10 @@ def clear(): ...@@ -203,6 +204,10 @@ def clear():
_ = system('clear') _ = system('clear')
if __name__ == '__main__': if __name__ == '__main__':
ipaddr = "127.0.0.1"
# web = threading.Thread(target=webgui.start_server,)
# web.daemon = True
# web.start()
usage = "usage: %prog [options]" usage = "usage: %prog [options]"
parser = OptionParser(usage=usage) parser = OptionParser(usage=usage)
parser.add_option("-g", "--geofile", dest="geofile", help="GeoJSON Output File", metavar="FILE") parser.add_option("-g", "--geofile", dest="geofile", help="GeoJSON Output File", metavar="FILE")
...@@ -252,7 +257,9 @@ if __name__ == '__main__': ...@@ -252,7 +257,9 @@ if __name__ == '__main__':
avg_list = [] avg_list = []
average_intersects = np.array([]).reshape(0,2) average_intersects = np.array([]).reshape(0,2)
while True: receiving = True
while receiving:
print("Receiving" + dots*'.') print("Receiving" + dots*'.')
print("Press Control+C to process data and exit.") print("Press Control+C to process data and exit.")
intersect_list = np.array([]).reshape(0,3) intersect_list = np.array([]).reshape(0,3)
...@@ -314,5 +321,5 @@ if __name__ == '__main__': ...@@ -314,5 +321,5 @@ if __name__ == '__main__':
conn.commit() conn.commit()
conn.close() conn.close()
process_data(database_name, geofile, eps, min_samp) process_data(database_name, geofile, eps, min_samp)
# web.join()
quit() quit()
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<!-- Include the CesiumJS JavaScript and CSS files -->
<script src="https://cesium.com/downloads/cesiumjs/releases/1.75/Build/Cesium/Cesium.js"></script>
<link href="https://cesium.com/downloads/cesiumjs/releases/1.75/Build/Cesium/Widgets/widgets.css" rel="stylesheet">
</head>
<body>
<div id="cesiumContainer"></div>
<script>
// Your access token can be found at: https://cesium.com/ion/tokens.
Cesium.Ion.defaultAccessToken = '{{access_token}}';
// Initialize the Cesium Viewer in the HTML element with the `cesiumContainer` ID.
// const viewer = new Cesium.Viewer('cesiumContainer', {
// terrainProvider: Cesium.createWorldTerrain()
// });
var viewer = new Cesium.Viewer('cesiumContainer', {
terrainProvider: Cesium.createWorldTerrain()
});
viewer.dataSources.add(Cesium.GeoJsonDataSource.load('/static/dc_med.geojson', {
clampToGround: true,
markerColor: Cesium.Color.GREEN,
markerSymbol: ''
}));
// Add Cesium OSM Buildings, a global 3D buildings layer.
const buildingTileset = viewer.scene.primitives.add(Cesium.createOsmBuildings());
// Fly the camera to San Francisco at the given longitude, latitude, and height.
// viewer.camera.flyTo({
// destination : Cesium.Cartesian3.fromDegrees(-122.4175, 37.655, 400),
// orientation : {
// heading : Cesium.Math.toRadians(0.0),
// pitch : Cesium.Math.toRadians(-15.0),
// }
// });
</script>
</div>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.7.1/dist/leaflet.css"
integrity="sha512-xodZBNTC5n17Xt2atTPuE1HxjVMSvLVW9ocqUKLsCC5CXdbqCmblAshOMAS6/keqq/sMZMZ19scR4PsZChSR7A=="
crossorigin=""/>
<script src="https://unpkg.com/leaflet@1.7.1/dist/leaflet.js"
integrity="sha512-XQoYMqMTK8LvdxXYG3nZ448hOEQiglfqkJs1NOQV44cWnUrBc8PkAOcXy20w0vlaXaVUearIOBhiXZ5V3ynxwA=="
crossorigin=""></script>
</head>
<body>
<p>Test</p>
<div style="height: 700px" id="map"></div>
<script>
// initialize Leaflet
var map = L.map('map').setView({lon: -76.3, lat: 39.1}, 8);
// add the OpenStreetMap tiles
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
maxZoom: 19,
attribution: '&copy; <a href="https://openstreetmap.org/copyright">OpenStreetMap contributors</a>'
}).addTo(map);
// show the scale bar on the lower left corner
L.control.scale().addTo(map);
</script>
</body>
</html>
from bottle import route, run, request, get, post, redirect, template, static_file
ipaddr = "127.0.0.1"
with open('accesstoken.txt', "r") as tokenfile:
access_token = tokenfile.read().replace('\n', '')
@route('/static/<filepath:path>', name='static')
def server_static(filepath):
return static_file(filepath, root='./static')
@get('/')
@get('/index')
def hello():
return template('index.tpl')
@get('/cesium')
def cesium():
return template('cesium.tpl',
{'access_token':access_token})
def start_server():
run(host=ipaddr, port=8080, quiet=True, debug=False, server='paste')
if __name__ == '__main__':
start_server()
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment