Vourlabs | And YOU can Help Fight Fires!

Istanbul

Team Updates

publicclassInformation {
publicString title;
publicString description;
publicString imageUrl;
publicString label;
publicstaticArrayList<Information>getRecipesFromFile(Stringfilename, Contextcontext){
finalArrayList<Information> informationList =newArrayList<>();
try {
// Load data
String jsonString = loadJsonFromAsset("ali.json", context);
JSONObject json =newJSONObject(jsonString);
JSONArray recipes = json.getJSONArray("ali");
// Get Information objects from data
for(int i =0; i < recipes.length(); i++){
Information information =newInformation();
information.title = recipes.getJSONObject(i).getString("title");
information.description = recipes.getJSONObject(i).getString("description");
information.imageUrl = recipes.getJSONObject(i).getString("image");
information.label = recipes.getJSONObject(i).getString("dietLabel");
informationList.add(information);
}
} catch (JSONException e) {
e.printStackTrace();
}
return informationList;
}
privatestaticStringloadJsonFromAsset(Stringfilename, Contextcontext) {
String json =null;
try {
InputStream is = context.getAssets().open(filename);
int size = is.available();
byte[] buffer =newbyte[size];
is.read(buffer);
is.close();
json =newString(buffer, "UTF-8");
}
catch (java.io.IOException ex) {
ex.printStackTrace();
returnnull;
}
return json;
}
}
view rawInformation.java hosted with ❤ by GitHub
muharremkantarMuharrem
publicclassLocationDataProvider {
privateContext context;
privateLocationManager locationManager;
privateboolean isGPSProviderEnabled;
privateboolean isNetworkProviderEnabled;
publicstaticclassHighAccuracyGPSNeededextendsException{
publicHighAccuracyGPSNeeded() {
super("High Accuracy Mode is not opened!");
}
}
publicLocationDataProvider(Contextcontext){
this.context = context;
locationManager = (LocationManager) context.getSystemService(Context.LOCATION_SERVICE);
}
publicLocationgetLocation() throwsHighAccuracyGPSNeeded,SecurityException{
isGPSProviderEnabled = locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER);
isNetworkProviderEnabled = locationManager.isProviderEnabled(LocationManager.NETWORK_PROVIDER);
if(isGPSProviderEnabled !=true|| isNetworkProviderEnabled!=true)
thrownewHighAccuracyGPSNeeded();
LocationListener locationListener =newLocationListener() {
@Override
publicvoidonLocationChanged(Locationlocation) {
}
@Override
publicvoidonStatusChanged(Stringprovider, intstatus, Bundleextras) {
}
@Override
publicvoidonProviderEnabled(Stringprovider) {
}
@Override
publicvoidonProviderDisabled(Stringprovider) {
}
};
locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 1, 1, locationListener);
locationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 1, 1, locationListener);
return locationManager.getLastKnownLocation(LocationManager.NETWORK_PROVIDER);
}
}
muharremkantarMuharrem

In our project, we have created a user-authorized staff relationship which is managed over a mobil app and a web app. By user's firecalls, data which are taken from user is being calculated to find accurate place of fire. Then, using a dataset, we calculate which way is fire going to spread. We have created a mathematical formula to calculate it. This will help firefighters effectively arrive to right place (the way it spreads) and controll wildfire. Our formula is also giving a constant which ables us to measure risk of the wildfire. According to the risk, we will handle evacuation of people under risk. The last but not least, over time, by collecting data from wildfires we will have a big data which has huge potential to make estimations in future about similar wildfire emergencies.

Y
Yağız Ö. Evren
constexpress=require('express');
constpath=require('path');
constfavicon=require('serve-favicon');
constlogger=require('morgan');
constcookieParser=require('cookie-parser');
constbodyParser=require('body-parser');
var index =require('./routes/index');
var users =require('./routes/users');
var app =express();
// view engine setup
app.set('views', path.join(__dirname, 'views'));
app.set('view engine', 'jade');
// uncomment after placing your favicon in /public
//app.use(favicon(path.join(__dirname, 'public', 'favicon.ico')));
app.use(logger('dev'));
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended:false}));
app.use(cookieParser());
app.use(express.static(path.join(__dirname, 'public')));
app.use('/', index);
app.use('/users', users);
// catch 404 and forward to error handler
app.use(function(req, res, next) {
var err =newError('Not Found');
err.status=404;
next(err);
});
// error handler
app.use(function(err, req, res, next) {
// set locals, only providing error in development
res.locals.message=err.message;
res.locals.error=req.app.get('env') ==='development'? err : {};
// render the error page
res.status(err.status||500);
res.render('error');
});
module.exports= app;
view rawapp.js hosted with ❤ by GitHub
muharremkantarMuharrem
var express =require('express');
var router =express.Router();
var db =require('../db/db');
var DBConnect =newdb();
var eventOccured =undefined;
DBConnect.init();
router.post('/emergency', function(req, res, next) {
console.log(req.body);
var query =JSON.parse(Object.keys(req.body)[0]);
query = {latitude:query.latitude, longitude:query.longitude};
console.log(query);
DBConnect.addFireEvent(query, function(err, results) {
if(!err)
res.end('Succesfully recieved!');
});
});
router.get('/', function(req, res, next) {
res.render('index');
});
router.get('/map', function(req, res, next) {
var coordinate = {latitude:undefined, longitude:undefined};
DBConnect.getFireEvent(null, function(err, results) {
console.log(results);
coordinate.latitude= results[0].latitude;
coordinate.longitude= results[0].longitude;
console.log(coordinate);
var self = coordinate;
var data = {};
DBConnect.getLocationData(null, function(err, datas) {
data.temp= datas[0].temp;
data.humidity= datas[0].humidity;
data.wind= datas[0].wind;
data.fuel= datas[0].fuel;
data.drought= datas[0].drought;
data.slope= datas[0].slope;
var mk5 =2* (Math.exp((.987*Math.log(data.drought+0.001))-.45-(.0345*data.humidity)+(.0338*data.humidity)+(.0234*data.wind)));
var forward = (0.0012* mk5 *data.fuel) * (Math.exp(0.069*data.slope));
var rateForward =Math.round(forward *100) /100;
rateForward = rateForward /2;
var forest =Math.round(mk5);
console.log(data);
res.render('map', {latitude:self.latitude, longitude:self.longitude, mk5: forest, rate: rateForward});
});
});
});
router.get('/checkout', function(req, res, next) {
var respond = {isEventOccured:false};
DBConnect.getFireEvent(null, function(err, results) {
for(let i =0; i <results.length; i++) {
if(results[i].isHandled===0) {
respond.isEventOccured=true;
}
}
res.send(JSON.stringify(respond));
});
});
module.exports= router;
view rawindex.js hosted with ❤ by GitHub
muharremkantarMuharrem
NASA Logo

SpaceApps is a NASA incubator innovation program.