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

small server update

parent c0c10536
......@@ -152,24 +152,39 @@ app.get('/TrafficFlow', async (req, res) => {
var JsonFeature = [];
console.log(json_tflow.RWS[0].RW.length + "---- in flow func")
var length = json_tflow.RWS[0].RW.length;
var fik
// console.log(length);
for (var i = 0; i<= length -1; i++){
var shplength = json_tflow.RWS[0].RW[i].FIS[0].FI[0].SHP.length;
// var type = accident.body.TRAFFIC_ITEMS.TRAFFIC_ITEM[i].TRAFFIC_ITEM_TYPE_DESC;
var mid = json_tflow.RWS[0].RW[i].mid;
var LI = json_tflow.RWS[0].RW[i].LI;
var DE = json_tflow.RWS[0].RW[i].DE;
var PBT = json_tflow.RWS[0].RW[i].PBT;
var TMC = json_tflow.RWS[0].RW[i].FIS[0].FI[0].TMC;
var CF = json_tflow.RWS[0].RW[i].FIS[0].FI[0].CF[0];
var locationshp = [];
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(value[0])
var FIlength = json_tflow.RWS[0].RW[i].FIS[0].FI.length
console.log("i - " + i)
var mid = json_tflow.RWS[0].RW[i].mid;
var LI = json_tflow.RWS[0].RW[i].LI;
var DE = json_tflow.RWS[0].RW[i].DE;
var PBT = json_tflow.RWS[0].RW[i].PBT;
for (var m = 0; m <= FIlength -1; m++){
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 = [];
for (var j = 0; j <= shplength - 1; j++ ){
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])
var splitvalue = [];
......@@ -294,7 +309,7 @@ app.get('/TrafficFlow', async (req, res) => {
}
})
}
};
};};
resolve(JsonFeature)
}catch(error){ reject(error)}
......@@ -795,7 +810,7 @@ app.get('/TrafficFlow', async (req, res) => {
app.get('/NoiseRealTime', async (req, res) => {
console.log('command angekommen!')
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);
......@@ -835,7 +850,7 @@ app.get('/TrafficFlow', async (req, res) => {
const data = req.body;
// = "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;";
console.log(query_string)
......@@ -853,4 +868,6 @@ app.get('/TrafficFlow', async (req, res) => {
catch (err) {
console.log('.../getNoiseHist failed!\n' + err);
}
});
\ No newline at end of file
});
\ 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