Vourlabs | And YOU can Help Fight Fires!

Istanbul

Team Updates

public class Information {
public String title;
public String description;
public String imageUrl;
public String label;
public static ArrayList<Information> getRecipesFromFile(String filename, Context context){
final ArrayList<Information> informationList = new ArrayList<>();
try {
// Load data
String jsonString = loadJsonFromAsset("ali.json", context);
JSONObject json = new JSONObject(jsonString);
JSONArray recipes = json.getJSONArray("ali");
// Get Information objects from data
for(int i = 0; i < recipes.length(); i++){
Information information = new Information();
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;
}
private static String loadJsonFromAsset(String filename, Context context) {
String json = null;
try {
InputStream is = context.getAssets().open(filename);
int size = is.available();
byte[] buffer = new byte[size];
is.read(buffer);
is.close();
json = new String(buffer, "UTF-8");
}
catch (java.io.IOException ex) {
ex.printStackTrace();
return null;
}
return json;
}
}
view raw Information.java hosted with ❤ by GitHub
muharremkantarMuharrem
public class LocationDataProvider {
private Context context;
private LocationManager locationManager;
private boolean isGPSProviderEnabled;
private boolean isNetworkProviderEnabled;
public static class HighAccuracyGPSNeeded extends Exception{
public HighAccuracyGPSNeeded() {
super("High Accuracy Mode is not opened!");
}
}
public LocationDataProvider(Context context){
this.context = context;
locationManager = (LocationManager) context.getSystemService(Context.LOCATION_SERVICE);
}
public Location getLocation() throws HighAccuracyGPSNeeded,SecurityException{
isGPSProviderEnabled = locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER);
isNetworkProviderEnabled = locationManager.isProviderEnabled(LocationManager.NETWORK_PROVIDER);
if(isGPSProviderEnabled != true || isNetworkProviderEnabled!=true)
throw new HighAccuracyGPSNeeded();
LocationListener locationListener = new LocationListener() {
@Override
public void onLocationChanged(Location location) {
}
@Override
public void onStatusChanged(String provider, int status, Bundle extras) {
}
@Override
public void onProviderEnabled(String provider) {
}
@Override
public void onProviderDisabled(String provider) {
}
};
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
const express = require('express');
const path = require('path');
const favicon = require('serve-favicon');
const logger = require('morgan');
const cookieParser = require('cookie-parser');
const bodyParser = 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 = new Error('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 raw app.js hosted with ❤ by GitHub
muharremkantarMuharrem
var express = require('express');
var router = express.Router();
var db = require('../db/db');
var DBConnect = new db();
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 raw index.js hosted with ❤ by GitHub
muharremkantarMuharrem
NASA Logo

SpaceApps is a NASA incubator innovation program.