Commit 39b61e30 authored by Izairi's avatar Izairi
Browse files

add fetch function and print output console

parent f971529d
var coordinatesBB = []
//var url = "https://simstadt-api.iaf-ex.hft-stuttgart.de:8080/workflow/execute" //old link
var url = "http://vm24.fkc.hft-stuttgart.de:8080/workflow/execute" // URL to API
var url = "http://vm24.fkc.hft-stuttgart.de:8082/workflow/execute" // URL to API
var url2 = "http://vm24.fkc.hft-stuttgart.de:8082/workflow/timedShadowValueByDay/"
/*TODO#1: -get current data from the api and create local test data (apiData foler)
-add connection handeling (error messages when there isnt a connection and then using the local test data)
*/
......@@ -15,13 +15,41 @@ var totalSurfaceAreaSortPick
var roofTypeSortPick
var uValueSortPick
async function fetchshadowDataJSON() {
var bottomLat = coordinatesBB[1]
var leftLng = coordinatesBB[0]
var rightLng = coordinatesBB[2]
var topLat = coordinatesBB[3]//
var day = 5;
const response = await fetch(url2 + day, {
method: "POST",
body: JSON.stringify({
"boundingBox": {
"bottomLat": bottomLat, //48.779004965,
"leftLng": leftLng, //9.1686843081,
"lodType": "LOD2",
"rightLng": rightLng, //9.175336684,
"topLat": topLat //48.7822869656
},
"cityGMLRef": "campusLOD2"
}),
headers: {
"Content-Type": "application/json",
"Authorization": "Basic YWRtaW46YWRtaW4xMjM="
}
})
const data = await response.json()
return data
}
async function fetchDataJSON() {
var bottomLat = coordinatesBB[1]
var leftLng = coordinatesBB[0]
var rightLng = coordinatesBB[2]
var topLat = coordinatesBB[3]//
const response = await fetch(url, {
const response = await fetch(url, {
method: "POST",
body: JSON.stringify({
"boundingBox": {
......@@ -39,8 +67,8 @@ async function fetchDataJSON() {
"heatedVolume",
"yearOfConstruction",
"buildingFunction",
"monthlyHeating",
"monthlyCooling",
// "monthlyHeating",
//"monthlyCooling",
"pvPotential",
"roofType",
"totalSurfaceArea"
......@@ -57,6 +85,7 @@ async function fetchDataJSON() {
const data = await response.json()
return data
}
document.getElementById("loader").style.visibility = "hidden"
......@@ -64,7 +93,9 @@ function processData() {
console.log(coordinatesBB)
console.log("Waiting for data....")
fetchshadowDataJSON().then(data=> {
console.log(data)
})
fetchDataJSON().then(data => {
console.log(data);
document.getElementById("cesiumContainer").style.opacity = "1";
......@@ -293,7 +324,7 @@ window.onclick = function (event) {
//-------------------------------------------------------------------------------
var tileData = null;
var tileset = null;
var tilesetURL = 'http://vm24.fkc.hft-stuttgart.de:8081/CampusLOD2/CityModel/tileset.json';
var tilesetURL = 'http://vm24.fkc.hft-stuttgart.de:8081/CampusLOD2Old/tileset.json';
var localTestTileset = '/3dclient4simstadtapi/public/test/gmlTileset_v1.json';
......
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