Commit 5b9dd168 authored by Patrick's avatar Patrick
Browse files

small server update

parent c0c10536
...@@ -152,23 +152,38 @@ app.get('/TrafficFlow', async (req, res) => { ...@@ -152,23 +152,38 @@ app.get('/TrafficFlow', async (req, res) => {
var JsonFeature = []; var JsonFeature = [];
console.log(json_tflow.RWS[0].RW.length + "---- in flow func") console.log(json_tflow.RWS[0].RW.length + "---- in flow func")
var length = json_tflow.RWS[0].RW.length; var length = json_tflow.RWS[0].RW.length;
var fik
// console.log(length); // console.log(length);
for (var i = 0; i<= length -1; i++){ for (var i = 0; i<= length -1; i++){
var shplength = json_tflow.RWS[0].RW[i].FIS[0].FI[0].SHP.length; var FIlength = json_tflow.RWS[0].RW[i].FIS[0].FI.length
console.log("i - " + i)
// var type = accident.body.TRAFFIC_ITEMS.TRAFFIC_ITEM[i].TRAFFIC_ITEM_TYPE_DESC;
var mid = json_tflow.RWS[0].RW[i].mid; var mid = json_tflow.RWS[0].RW[i].mid;
var LI = json_tflow.RWS[0].RW[i].LI; var LI = json_tflow.RWS[0].RW[i].LI;
var DE = json_tflow.RWS[0].RW[i].DE; var DE = json_tflow.RWS[0].RW[i].DE;
var PBT = json_tflow.RWS[0].RW[i].PBT; var PBT = json_tflow.RWS[0].RW[i].PBT;
var TMC = json_tflow.RWS[0].RW[i].FIS[0].FI[0].TMC; for (var m = 0; m <= FIlength -1; m++){
var CF = json_tflow.RWS[0].RW[i].FIS[0].FI[0].CF[0]; console.log("k - " + m)
var shplength = json_tflow.RWS[0].RW[i].FIS[0].FI[m].SHP.length;
console.log("FI - " + json_tflow.RWS[0].RW[i].FIS[0].FI[m])
fik = json_tflow.RWS[0].RW[i].FIS[0].FI[m]
// var type = accident.body.TRAFFIC_ITEMS.TRAFFIC_ITEM[i].TRAFFIC_ITEM_TYPE_DESC;
var TMC = json_tflow.RWS[0].RW[i].FIS[0].FI[m].TMC;
var CF = json_tflow.RWS[0].RW[i].FIS[0].FI[m].CF[0];
console.log("Shp length - " + json_tflow.RWS[0].RW[i].FIS[0].FI[m].SHP.length)
console.log("Shp length - " + shplength)
var locationshp = []; var locationshp = [];
for (var j = 0; j <= shplength - 1; j++ ){ for (var j = 0; j <= shplength - 1; j++ ){
var value = json_tflow.RWS[0].RW[i].FIS[0].FI[0].SHP[j].value[0]; console.log("j - " +j)
console.log("RWS - " + json_tflow.RWS[0])
console.log("RW - " + json_tflow.RWS[0].RW[i])
console.log("FIS - " + json_tflow.RWS[0].RW[i].FIS[0])
console.log("FIk - " + fik)
console.log("FI - " + json_tflow.RWS[0].RW[i].FIS[0].FI[m])
console.log("shape j - " + fik.SHP[j])
var value = fik.SHP[j].value[0];
// console.log(value[0]) // console.log(value[0])
...@@ -294,7 +309,7 @@ app.get('/TrafficFlow', async (req, res) => { ...@@ -294,7 +309,7 @@ app.get('/TrafficFlow', async (req, res) => {
} }
}) })
} }
}; };};
resolve(JsonFeature) resolve(JsonFeature)
}catch(error){ reject(error)} }catch(error){ reject(error)}
...@@ -795,7 +810,7 @@ app.get('/TrafficFlow', async (req, res) => { ...@@ -795,7 +810,7 @@ app.get('/TrafficFlow', async (req, res) => {
app.get('/NoiseRealTime', async (req, res) => { app.get('/NoiseRealTime', async (req, res) => {
console.log('command angekommen!') console.log('command angekommen!')
try{ try{
let APIout = await flow_getApiResponse('https://data.sensor.community/airrohr/v1/sensor/49368/'); let APIout = await flow_getApiResponse('https://data.sensor.community/airrohr/v1/sensor/' + req.query.id + '/');
console.log(APIout); console.log(APIout);
...@@ -835,7 +850,7 @@ app.get('/TrafficFlow', async (req, res) => { ...@@ -835,7 +850,7 @@ app.get('/TrafficFlow', async (req, res) => {
const data = req.body; const data = req.body;
// = "select sensor_id from public.noisesensor;" // = "select sensor_id from public.noisesensor;"
let query_string = " SELECT * FROM noisesensors ORDER BY timestamp ASC;" let query_string = " SELECT * FROM noisesensorstest ORDER BY timestamp ASC;"
// query_string += "from noisesensor;"; // query_string += "from noisesensor;";
console.log(query_string) console.log(query_string)
...@@ -854,3 +869,5 @@ app.get('/TrafficFlow', async (req, res) => { ...@@ -854,3 +869,5 @@ app.get('/TrafficFlow', async (req, res) => {
console.log('.../getNoiseHist failed!\n' + err); console.log('.../getNoiseHist failed!\n' + err);
} }
}); });
\ No newline at end of file
This diff is collapsed.
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