Predict fire | And YOU can Help Fight Fires!

Quito

Team Updates

<?php
$satelite_ = $_REQUEST['response_satellite'];
$region_ = $_REQUEST['response_region'];
$time_ = $_REQUEST['response_time'];
include 'Controler.php';
require_once __DIR__ . '/machine_learning/lib/accessory/matrix.php';
require_once __DIR__ . '/machine_learning/lib/parametric/regression.php';
function Regression($xs,$ys)
{
$predict = array();
$ner = new LL_NormalEquations_Regression($xs, $ys);
$ner->train();
foreach ($xs as $value) {
array_push($predict, $ner->predict(array($value[0],$value[1])));
}
echo 'estos datos son las prediccion aun tienen cierta porcentaje de error';
print_r($predict);
}
function Main($region){
Retrieval($region, Connect());
}
function Connect()
{
$connect = mysqli_connect("localhost", "root","","SPACE_APP_CHALLENGER");
if (!$connect) {
die("Connection failed: " . $connect->connect_error);
}
return $connect;
}
function Retrieval($region, $string){
$Measurements = array();
$target = array();
$sql = "SELECT R.ID,
R.LATITUDE,
R.LONGITUDE,
R.BRIGHTNESS
FROM RECORD R
JOIN REGION RE ON RE.ID = R.REGION
WHERE RE.ID = $region AND R.ID < 50 ORDER BY LATITUDE ASC ";
$result = mysqli_query($string, $sql) or die(mysqli_error($string));
while($row = mysqli_fetch_assoc($result))
{
array_push($Measurements,array($row['LATITUDE'] ,$row['LONGITUDE']));
//$Measurements = array(
// array($row['LATITUDE'] ,$row['LONGITUDE']));
array_push($target, $row['BRIGHTNESS']);
}
echo 'estos datos representan el brighnes son los datos a emular';
print_r($target);
Regression($Measurements, $target);
}
Main(getRegion($satelite_,$region_,$time_));
view raw PredictionFire.php hosted with ❤ by GitHub
<?php
include 'Manager.php';
$satelite_ = $_REQUEST['response_satellite'];
$region_ = $_REQUEST['response_region'];
$time_ = $_REQUEST['response_time'];
$dummy = null;
if ($satelite_=='MODIS_C6' & $region_ == 'Global' & $time_ == '24h')
{
$dummy= 1;
}
elseif ($satelite_=='MODIS_C6' & $region_ == 'Global' & $time_ == '48h')
{
$dummy= 2;
}
elseif ($satelite_=='MODIS_C6' & $region_ == 'Global' & $time_ == '7d')
{
$dummy= 3;
}
elseif ($satelite_=='MODIS_C6' & $region_ == 'Alaska' & $time_ == '24h')
{
$dummy= 4;
}
elseif ($satelite_=='MODIS_C6' & $region_ == 'Alaska' & $time_ == '48h')
{
$dummy= 5;
}
elseif ($satelite_=='MODIS_C6' & $region_ == 'Alaska' & $time_ == '7d')
{
$dummy= 6;
}
elseif ($satelite_=='MODIS_C6' & $region_ == 'Australia_and_New_Zealand' & $time_ == '24h')
{
$dummy= 7;
}
elseif ($satelite_=='MODIS_C6' & $region_ == 'Australia_and_New_Zealand' & $time_ == '48h')
{
$dummy= 8;
}
elseif ($satelite_=='MODIS_C6' & $region_ == 'Australia_and_New_Zealand' & $time_ == '7d')
{
$dummy= 9;
}
elseif ($satelite_=='MODIS_C6' & $region_ == 'Canada' & $time_ == '24h')
{
$dummy= 10;
}
elseif ($satelite_=='MODIS_C6' & $region_ == 'Canada' & $time_ == '48h')
{
$dummy= 11;
}
elseif ($satelite_=='MODIS_C6' & $region_ == 'Canada' & $time_ == '7d')
{
$dummy= 12;
}
elseif ($satelite_=='MODIS_C6' & $region_ == 'Central_America' & $time_ == '24h')
{
$dummy= 13;
}
elseif ($satelite_=='MODIS_C6' & $region_ == 'Central_America' & $time_ == '48h')
{
$dummy= 14;
}
elseif ($satelite_=='MODIS_C6' & $region_ == 'Central_America' & $time_ == '7d')
{
$dummy= 15;
}
elseif ($satelite_=='MODIS_C6' & $region_ == 'Europe' & $time_ == '24h')
{
$dummy= 16;
}
elseif ($satelite_=='MODIS_C6' & $region_ == 'Europe' & $time_ == '48h')
{
$dummy= 17;
}
elseif ($satelite_=='MODIS_C6' & $region_ == 'Europe' & $time_ == '7d')
{
$dummy= 18;
}
elseif ($satelite_=='MODIS_C6' & $region_ == 'Northern_and_Central_Africa' & $time_ == '24h')
{
$dummy= 19;
}
elseif ($satelite_=='MODIS_C6' & $region_ == 'Northern_and_Central_Africa' & $time_ == '48h')
{
$dummy= 20;
}
elseif ($satelite_=='MODIS_C6' & $region_ == 'Northern_and_Central_Africa' & $time_ == '7d')
{
$dummy= 21;
}
elseif ($satelite_=='MODIS_C6' & $region_ == 'Russia_and_Asia' & $time_ == '24h')
{
$dummy= 22;
}
elseif ($satelite_=='MODIS_C6' & $region_ == 'Russia_and_Asia' & $time_ == '48h')
{
$dummy= 23;
}
elseif ($satelite_=='MODIS_C6' & $region_ == 'Russia_and_Asia' & $time_ == '7d')
{
$dummy= 24;
}
elseif ($satelite_=='MODIS_C6' & $region_ == 'South_America' & $time_ == '24h')
{
$dummy= 25;
}
elseif ($satelite_=='MODIS_C6' & $region_ == 'South_America' & $time_ == '48h')
{
$dummy= 26;
}
elseif ($satelite_=='MODIS_C6' & $region_ == 'South_America' & $time_ == '7d')
{
$dummy= 27;
}
elseif ($satelite_=='MODIS_C6' & $region_ == 'South_Asia' & $time_ == '24h')
{
$dummy= 28;
}
elseif ($satelite_=='MODIS_C6' & $region_ == 'South_Asia' & $time_ == '48h')
{
$dummy= 29;
}
elseif ($satelite_=='MODIS_C6' & $region_ == 'South_Asia' & $time_ == '7d')
{
$dummy= 30;
}
elseif ($satelite_=='MODIS_C6' & $region_ == 'SouthEast_Asia' & $time_ == '24h')
{
$dummy= 31;
}
elseif ($satelite_=='MODIS_C6' & $region_ == 'SouthEast_Asia' & $time_ == '48h')
{
$dummy= 32;
}
elseif ($satelite_=='MODIS_C6' & $region_ == 'SouthEast_Asia' & $time_ == '7d')
{
$dummy= 33;
}
elseif ($satelite_=='MODIS_C6' & $region_ == 'Southern_Africa' & $time_ == '24h')
{
$dummy= 34;
}
elseif ($satelite_=='MODIS_C6' & $region_ == 'Southern_Africa' & $time_ == '48h')
{
$dummy= 35;
}
elseif ($satelite_=='MODIS_C6' & $region_ == 'Southern_Africa' & $time_ == '7d')
{
$dummy= 36;
}
elseif ($satelite_=='MODIS_C6' & $region_ == 'Southern_Africa' & $time_ == '24h')
{
$dummy= 34;
}
elseif ($satelite_=='MODIS_C6' & $region_ == 'Southern_Africa' & $time_ == '48h')
{
$dummy= 35;
}
elseif ($satelite_=='MODIS_C6' & $region_ == 'Southern_Africa' & $time_ == '7d')
{
$dummy= 36;
}
elseif ($satelite_=='MODIS_C6' & $region_ == 'USA_contiguous_and_Hawaii' & $time_ == '24h')
{
$dummy= 37;
}
elseif ($satelite_=='MODIS_C6' & $region_ == 'USA_contiguous_and_Hawaii' & $time_ == '48h')
{
$dummy= 38;
}
elseif ($satelite_=='MODIS_C6' & $region_ == 'USA_contiguous_and_Hawaii' & $time_ == '7d')
{
$dummy= 39;
}
//------------------MODIS_C6------------
elseif ($satelite_=='VNP14IMGTDL_NRT' & $region_ == 'Global' & $time_ == '24h')
{
$dummy= 40;
}
elseif ($satelite_=='VNP14IMGTDL_NRT' & $region_ == 'Global' & $time_ == '48h')
{
$dummy= 41;
}
elseif ($satelite_=='VNP14IMGTDL_NRT' & $region_ == 'Global' & $time_ == '7d')
{
$dummy= 42;
}
elseif ($satelite_=='VNP14IMGTDL_NRT' & $region_ == 'Alaska' & $time_ == '24h')
{
$dummy= 43;
}
elseif ($satelite_=='VNP14IMGTDL_NRT' & $region_ == 'Alaska' & $time_ == '48h')
{
$dummy= 44;
}
elseif ($satelite_=='VNP14IMGTDL_NRT' & $region_ == 'Alaska' & $time_ == '7d')
{
$dummy= 45;
}
elseif ($satelite_=='VNP14IMGTDL_NRT' & $region_ == 'Australia_and_New_Zealand' & $time_ == '24h')
{
$dummy= 46;
}
elseif ($satelite_=='VNP14IMGTDL_NRT' & $region_ == 'Australia_and_New_Zealand' & $time_ == '48h')
{
$dummy= 47;
}
elseif ($satelite_=='VNP14IMGTDL_NRT' & $region_ == 'Australia_and_New_Zealand' & $time_ == '7d')
{
$dummy= 48;
}
elseif ($satelite_=='VNP14IMGTDL_NRT' & $region_ == 'Canada' & $time_ == '24h')
{
$dummy= 49;
}
elseif ($satelite_=='VNP14IMGTDL_NRT' & $region_ == 'Canada' & $time_ == '48h')
{
$dummy= 50;
}
elseif ($satelite_=='VNP14IMGTDL_NRT' & $region_ == 'Canada' & $time_ == '7d')
{
$dummy= 51;
}
elseif ($satelite_=='VNP14IMGTDL_NRT' & $region_ == 'Central_America' & $time_ == '24h')
{
$dummy= 52;
}
elseif ($satelite_=='VNP14IMGTDL_NRT' & $region_ == 'Central_America' & $time_ == '48h')
{
$dummy= 53;
}
elseif ($satelite_=='VNP14IMGTDL_NRT' & $region_ == 'Central_America' & $time_ == '7d')
{
$dummy= 54;
}
elseif ($satelite_=='VNP14IMGTDL_NRT' & $region_ == 'Europe' & $time_ == '24h')
{
$dummy= 55;
}
elseif ($satelite_=='VNP14IMGTDL_NRT' & $region_ == 'Europe' & $time_ == '48h')
{
$dummy= 56;
}
elseif ($satelite_=='VNP14IMGTDL_NRT' & $region_ == 'Europe' & $time_ == '7d')
{
$dummy= 57;
}
elseif ($satelite_=='VNP14IMGTDL_NRT' & $region_ == 'Northern_and_Central_Africa' & $time_ == '24h')
{
$dummy= 58;
}
elseif ($satelite_=='VNP14IMGTDL_NRT' & $region_ == 'Northern_and_Central_Africa' & $time_ == '48h')
{
$dummy= 59;
}
elseif ($satelite_=='VNP14IMGTDL_NRT' & $region_ == 'Northern_and_Central_Africa' & $time_ == '7d')
{
$dummy= 60;
}
elseif ($satelite_=='VNP14IMGTDL_NRT' & $region_ == 'Russia_and_Asia' & $time_ == '24h')
{
$dummy= 61;
}
elseif ($satelite_=='VNP14IMGTDL_NRT' & $region_ == 'Russia_and_Asia' & $time_ == '48h')
{
$dummy= 62;
}
elseif ($satelite_=='VNP14IMGTDL_NRT' & $region_ == 'Russia_and_Asia' & $time_ == '7d')
{
$dummy= 63;
}
elseif ($satelite_=='VNP14IMGTDL_NRT' & $region_ == 'South_America' & $time_ == '24h')
{
$dummy= 64;
}
elseif ($satelite_=='VNP14IMGTDL_NRT' & $region_ == 'South_America' & $time_ == '48h')
{
$dummy= 65;
}
elseif ($satelite_=='VNP14IMGTDL_NRT' & $region_ == 'South_America' & $time_ == '7d')
{
$dummy= 66;
}
elseif ($satelite_=='VNP14IMGTDL_NRT' & $region_ == 'South_Asia' & $time_ == '24h')
{
$dummy= 67;
}
elseif ($satelite_=='VNP14IMGTDL_NRT' & $region_ == 'South_Asia' & $time_ == '48h')
{
$dummy= 68;
}
elseif ($satelite_=='VNP14IMGTDL_NRT' & $region_ == 'South_Asia' & $time_ == '7d')
{
$dummy= 69;
}
elseif ($satelite_=='VNP14IMGTDL_NRT' & $region_ == 'SouthEast_Asia' & $time_ == '24h')
{
$dummy= 70;
}
elseif ($satelite_=='VNP14IMGTDL_NRT' & $region_ == 'SouthEast_Asia' & $time_ == '48h')
{
$dummy= 71;
}
elseif ($satelite_=='VNP14IMGTDL_NRT' & $region_ == 'SouthEast_Asia' & $time_ == '7d')
{
$dummy= 72;
}
elseif ($satelite_=='VNP14IMGTDL_NRT' & $region_ == 'Southern_Africa' & $time_ == '24h')
{
$dummy= 73;
}
elseif ($satelite_=='VNP14IMGTDL_NRT' & $region_ == 'Southern_Africa' & $time_ == '48h')
{
$dummy= 74;
}
elseif ($satelite_=='VNP14IMGTDL_NRT' & $region_ == 'Southern_Africa' & $time_ == '7d')
{
$dummy= 75;
}
elseif ($satelite_=='VNP14IMGTDL_NRT' & $region_ == 'USA_contiguous_and_Hawaii' & $time_ == '24h')
{
$dummy= 76;
}
elseif ($satelite_=='VNP14IMGTDL_NRT' & $region_ == 'USA_contiguous_and_Hawaii' & $time_ == '48h')
{
$dummy= 77;
}
elseif ($satelite_=='VNP14IMGTDL_NRT' & $region_ == 'USA_contiguous_and_Hawaii' & $time_ == '7d')
{
$dummy= 78;
}
//--------------VISS-----------------
function Search($satelite,$zone,$time)
{
$match = $satelite.'_'.$zone.'_'.$time.'.csv';
$sHTML = file_get_contents('https://earthdata.nasa.gov/earth-observation-data/near-real-time/firms/active-fire-data');
$oDOMDoc = new DOMDocument();
$oDOMDoc->loadHTML($sHTML);
$oDOMNodes = $oDOMDoc->getElementsByTagName('a');
$aLinks = array();
for( $i = 0 ; $i <= $oDOMNodes->length ; $i++ ) {
$oDOMNode = $oDOMNodes->item($i);
if (is_object($oDOMNode) && $oDOMNode->hasAttribute('href')) {
$aLinks[] = $oDOMNode->getAttribute('href');
}
}
foreach ($aLinks as &$s)
{
if(strpos($s, $match) !== false)
return $s;
}
}
function Download($inPath,$outPath)
{
$in= fopen($inPath, "rb");
$out= fopen($outPath, "wb");
while ($chunk = fread($in,8192))
{
fwrite($out, $chunk, 8192);
}
fclose($in);
fclose($out);
}
Download(Search($satelite_,$region_,$time_),'data.csv');
Main($dummy);
header('Location: profile.php');
exit;
?>
view raw scrapping.php hosted with ❤ by GitHub
B
Bastidas Mendoza Lisseth Betsabet

The link in github of the Predict Fire Platform

https://github.com/BetsabetBastidas/predictfire.gi...

B
Bastidas Mendoza Lisseth Betsabet
Statistics
Statistics
B
Bastidas Mendoza Lisseth Betsabet
Login
Login
B
Bastidas Mendoza Lisseth Betsabet
The Predict Fire platform
The Predict Fire platform
B
Bastidas Mendoza Lisseth Betsabet

Every year there is a considerable percentage of disasters of all kinds around the world. One of those that stand out are the fires, with an average of more than 100,000 cases annually. In recent years fires have consumed up to 3.6 million hectares (National, 2010).

In view of the aforementioned situation, the development of a system that provides data analysis necessary for the prevention of fires is presented.

The Predict Fire platform is a web application that shows predictions about fires that may occur in a particular region of the world.

Several processes, Scrapping Web and Machine Learning are carried out to obtain results and visualize them in the web site.

Scrapping and Crawling Web is a technique that is used for the software to extract information from websites, in this case most of the information used by this system is taken from the official website of NASA and by this technique we extract all the HTML content To process it and by means of a request to the user this download the respective data file of the official page of the NASA that contains the requested information to later pass to a database manager that allows to have a history to later use it with techniques of automatic learning Supervised (machine learning) and can improve their predictive capacity

Machine Learning is the process that is carried out so that the computer learns data or time series for the purpose of determining events that remain in some memory site in the machine, whose objective is supervised or unsupervised learning, that means through the various variables that are taken into account such as: history of fires occurring around the world (official data obtained from the NASA website), climate, humidity, wind speed, wind direction and windfall, Satelite, capture pixels, the algorithm analyzes this information and through its history in the database manager uses regressive logistic and regression models to be able to model the short and long term events using a mathematical model. Other variables considered are the state of the soil (weeds) and type of fires and solar radiation, but are not yet applied to the project for the time being.

The operation of the platform can achieve prediction of real fire cases, in this way a prevention is achieved and allows l decision making for due treatment and planning regarding the risks of the area that has to be considered.

conclusion

The Fire Prediction platform is based on Web techniques such as Reverse Engineering stories such as Crawling and Web Scrapping, and incorporates techniques of large data for the treatment of information such as Machine Learning that allows the handling of historical data and time series (fires occurring in the World) And experimental data to feedback the system and validation, resulting in an intelligent system layers of historical management and learn over time about the predecessor that concerns about fires for the good of people who is interested in this subject matter


TOOLS:

PHP, JAVASCRIPT, HTML, APACHE, MYSQLServer.

Technical:

Crawling y Scrapping Web, Machine Learning


B
Bastidas Mendoza Lisseth Betsabet
NASA Logo

SpaceApps is a NASA incubator innovation program.