154 lines
5.0 KiB
PHP
154 lines
5.0 KiB
PHP
<?php
|
|
$ini = parse_ini_file("conf.ini", true);
|
|
mysql_connect($ini['db']['host'],$ini['db']['user'],$ini['db']['pass']);
|
|
mysql_select_db($ini['db']['db']);
|
|
|
|
$code=0;
|
|
|
|
$url="http://www.earthquakenetwork.it/Historic.kml";
|
|
$xml = simplexml_load_file($url);
|
|
|
|
foreach ($xml->Document->Folder->Folder->Placemark as $place)
|
|
{
|
|
$temp=$place->MultiGeometry->Point->coordinates[0];
|
|
$group = explode(" ",$temp);
|
|
$coordinate=explode(",",$group[0]);
|
|
$name=$place->name;
|
|
$location = 'POINT(' . $coordinate[0] . " " . $coordinate[1] . ')';
|
|
$code=$code+1;
|
|
|
|
$sql=mysql_query("insert into usgs_faults (code,name,age,location) values ($code,'$name','Historic',PointFromText('$location'))");
|
|
|
|
foreach ($place->MultiGeometry->MultiGeometry->LineString as $stringa)
|
|
{
|
|
$line='LINESTRING(';
|
|
$temp=$stringa->coordinates[0];
|
|
$group = explode(" ",$temp);
|
|
for ($i=0;$i<count($group)-1;$i++){
|
|
$coordinate=explode(",",$group[$i]);
|
|
$line=$line.$coordinate[0].' '.$coordinate[1].',';
|
|
}
|
|
$line=rtrim($line,',');
|
|
$line=$line.')';
|
|
$sql=mysql_query("insert into usgs_fault_lines (fault_code,line) values ($code,LineStringFromText('$line'))");
|
|
}
|
|
}
|
|
|
|
$url="http://www.earthquakenetwork.it/Quaternary.kml";
|
|
$xml = simplexml_load_file($url);
|
|
|
|
foreach ($xml->Document->Folder->Folder->Placemark as $place)
|
|
{
|
|
$temp=$place->MultiGeometry->Point->coordinates[0];
|
|
$group = explode(" ",$temp);
|
|
$coordinate=explode(",",$group[0]);
|
|
$name=$place->name;
|
|
$location = 'POINT(' . $coordinate[0] . " " . $coordinate[1] . ')';
|
|
$code=$code+1;
|
|
|
|
$sql=mysql_query("insert into usgs_faults (code,name,age,location) values ($code,'$name','Quaternary',PointFromText('$location'))");
|
|
|
|
foreach ($place->MultiGeometry->MultiGeometry->LineString as $stringa)
|
|
{
|
|
$line='LINESTRING(';
|
|
$temp=$stringa->coordinates[0];
|
|
$group = explode(" ",$temp);
|
|
for ($i=0;$i<count($group)-1;$i++){
|
|
$coordinate=explode(",",$group[$i]);
|
|
$line=$line.$coordinate[0].' '.$coordinate[1].',';
|
|
}
|
|
$line=rtrim($line,',');
|
|
$line=$line.')';
|
|
$sql=mysql_query("insert into usgs_fault_lines (fault_code,line) values ($code,LineStringFromText('$line'))");
|
|
}
|
|
}
|
|
|
|
$url="http://www.earthquakenetwork.it/Mid_LateQuaternary.kml";
|
|
$xml = simplexml_load_file($url);
|
|
|
|
foreach ($xml->Document->Folder->Folder->Placemark as $place)
|
|
{
|
|
$temp=$place->MultiGeometry->Point->coordinates[0];
|
|
$group = explode(" ",$temp);
|
|
$coordinate=explode(",",$group[0]);
|
|
$name=$place->name;
|
|
$location = 'POINT(' . $coordinate[0] . " " . $coordinate[1] . ')';
|
|
$code=$code+1;
|
|
|
|
$sql=mysql_query("insert into usgs_faults (code,name,age,location) values ($code,'$name','Mid-Late Quaternary',PointFromText('$location'))");
|
|
|
|
foreach ($place->MultiGeometry->MultiGeometry->LineString as $stringa)
|
|
{
|
|
$line='LINESTRING(';
|
|
$temp=$stringa->coordinates[0];
|
|
$group = explode(" ",$temp);
|
|
for ($i=0;$i<count($group)-1;$i++){
|
|
$coordinate=explode(",",$group[$i]);
|
|
$line=$line.$coordinate[0].' '.$coordinate[1].',';
|
|
}
|
|
$line=rtrim($line,',');
|
|
$line=$line.')';
|
|
$sql=mysql_query("insert into usgs_fault_lines (fault_code,line) values ($code,LineStringFromText('$line'))");
|
|
}
|
|
}
|
|
|
|
$url="http://www.earthquakenetwork.it/LateQuaternary.kml";
|
|
$xml = simplexml_load_file($url);
|
|
|
|
foreach ($xml->Document->Folder->Folder->Placemark as $place)
|
|
{
|
|
$temp=$place->MultiGeometry->Point->coordinates[0];
|
|
$group = explode(" ",$temp);
|
|
$coordinate=explode(",",$group[0]);
|
|
$name=$place->name;
|
|
$location = 'POINT(' . $coordinate[0] . " " . $coordinate[1] . ')';
|
|
$code=$code+1;
|
|
|
|
$sql=mysql_query("insert into usgs_faults (code,name,age,location) values ($code,'$name','Late Quaternary',PointFromText('$location'))");
|
|
|
|
foreach ($place->MultiGeometry->MultiGeometry->LineString as $stringa)
|
|
{
|
|
$line='LINESTRING(';
|
|
$temp=$stringa->coordinates[0];
|
|
$group = explode(" ",$temp);
|
|
for ($i=0;$i<count($group)-1;$i++){
|
|
$coordinate=explode(",",$group[$i]);
|
|
$line=$line.$coordinate[0].' '.$coordinate[1].',';
|
|
}
|
|
$line=rtrim($line,',');
|
|
$line=$line.')';
|
|
$sql=mysql_query("insert into usgs_fault_lines (fault_code,line) values ($code,LineStringFromText('$line'))");
|
|
}
|
|
}
|
|
|
|
$url="http://www.earthquakenetwork.it/Holocene_LatestPleistocene.kml";
|
|
$xml = simplexml_load_file($url);
|
|
|
|
foreach ($xml->Document->Folder->Folder->Placemark as $place)
|
|
{
|
|
$temp=$place->MultiGeometry->Point->coordinates[0];
|
|
$group = explode(" ",$temp);
|
|
$coordinate=explode(",",$group[0]);
|
|
$name=$place->name;
|
|
$location = 'POINT(' . $coordinate[0] . " " . $coordinate[1] . ')';
|
|
$code=$code+1;
|
|
|
|
$sql=mysql_query("insert into usgs_faults (code,name,age,location) values ($code,'$name','Holocene Latest Pleistocene',PointFromText('$location'))");
|
|
|
|
foreach ($place->MultiGeometry->MultiGeometry->LineString as $stringa)
|
|
{
|
|
$line='LINESTRING(';
|
|
$temp=$stringa->coordinates[0];
|
|
$group = explode(" ",$temp);
|
|
for ($i=0;$i<count($group)-1;$i++){
|
|
$coordinate=explode(",",$group[$i]);
|
|
$line=$line.$coordinate[0].' '.$coordinate[1].',';
|
|
}
|
|
$line=rtrim($line,',');
|
|
$line=$line.')';
|
|
$sql=mysql_query("insert into usgs_fault_lines (fault_code,line) values ($code,LineStringFromText('$line'))");
|
|
}
|
|
}
|
|
|
|
mysql_close();
|
|
?>
|