This commit is contained in:
Walter Hupfeld 2021-10-17 10:07:21 +02:00
parent 449b1d5a00
commit 4c54b396ac
5 changed files with 30 additions and 27 deletions

View File

@ -1,3 +1,3 @@
# unfallkarte
Unfallkarte
Unfallkarte

0
db/unfallorte-soest Normal file
View File

1
geojson/soest.geojson Normal file

File diff suppressed because one or more lines are too long

View File

@ -42,16 +42,17 @@
$strYear = " AND UJAHR='".$numYear."' ";
$strSQL="SELECT * FROM Unfallorte_Hamm WHERE ".$strWhere.$strYear;
$strSQL="SELECT * FROM data WHERE ".$strWhere.$strYear.$strLocation;
echo $strSQL;
$result = $db->query($strSQL);
$arrMarker = array();
$arrDescription = array();
$description="";
while ($row = $result->fetchArray()) {
while ($row = $result->fetch(PDO::FETCH_ASSOC)) {
//print_r($row);echo "<hr>";
$id = $row[0];
$id = $row['OBJECTID'];
$numLng = $row['XGCSWGS84'];
$numLat = $row['YGCSWGS84'];
if ($row['IstRad']) $description .="mit Fahrradbeteiligung, ";

View File

@ -88,13 +88,14 @@ function nl2br2($string) {
global $arrUnfallart;
global $arrUnfalltyp;
global $arrCategory;
global $strLocation;
$strTable="<h5>Unfallkategorie</h5>";
$strTable.="<table class='statistik'>";
$strSQL="SELECT UKATEGORIE, count(UKATEGORIE) as anz FROM Unfallorte_Hamm WHERE ".$strWhere.$strYear." GROUP BY UKATEGORIE";
$strSQL="SELECT UKATEGORIE, count(UKATEGORIE) as anz FROM data WHERE ".$strWhere.$strYear.$strLocation." GROUP BY UKATEGORIE";
$result = $db->query($strSQL);
while ($row = $result->fetchArray()) {
while ($row = $result->fetch(PDO::FETCH_ASSOC)) {
$strTable.="<tr><td>".$arrCategory[$row['UKATEGORIE']]."</td><td>".$row['anz']."</td></tr>\n";
}
@ -109,14 +110,14 @@ function nl2br2($string) {
sum(IstGkfz) as lkw,
sum(IstSonstige) as sonstiges,
count(*) as summe
FROM Unfallorte_Hamm
WHERE ".$strWhere.$strYear;
FROM data
WHERE ".$strWhere.$strYear.$strLocation;
$result = $db->query($strSQL);
$strTable.="<h5>Unfallbeteiligte</h5>";
$strTable.="<table class='statistik'>";
//$strTable.="<tr><th>Unfallbeteiligte</th><th>Anzahl</th></tr>";
while ($row = $result->fetchArray()) {
while ($row = $result->fetch(PDO::FETCH_ASSOC)) {
$strTable.="<tr><td>Fahrräder</td><td>".$row['rad']."</td></tr>";
$strTable.="<tr><td>PKWs</td><td>".$row['pkw']."</td></tr>";
$strTable.="<tr><td>Fussgänger</td><td>".$row['fuss']."</td></tr>";
@ -127,61 +128,61 @@ function nl2br2($string) {
}
/*
$strSQL="SELECT count(*) as count
FROM Unfallorte_Hamm
FROM data
WHERE IstRad=0 and IstPKW=0 and IstFuss=0 and IstKrad=0 and IstGkfz=0 and IstSonstige=0";
*/
switch ($numVehicle) {
case 1:
case 0:
$strSQL="SELECT count(*) as count FROM Unfallorte_Hamm
WHERE IstPKW=0 and IstFuss=0 and IstKrad=0 and IstGkfz=0 and IstSonstige=0";
$strSQL="SELECT count(*) as count FROM data
WHERE IstPKW=0 and IstFuss=0 and IstKrad=0 and IstGkfz=0 and IstSonstige=0".$strLocation;
break;
case 2:
$strSQL="SELECT count(*) as count FROM Unfallorte_Hamm
WHERE IstRad=0 and IstFuss=0 and IstKrad=0 and IstGkfz=0 and IstSonstige=0";
$strSQL="SELECT count(*) as count FROM data
WHERE IstRad=0 and IstFuss=0 and IstKrad=0 and IstGkfz=0 and IstSonstige=0".$strLocation;
break;
case 3:
$strSQL="SELECT count(*) as count FROM Unfallorte_Hamm
WHERE IstPKW=0 and IstRad=0 and IstKrad and IstGkfz=0 and IstSonstige=0";
$strSQL="SELECT count(*) as count FROM data
WHERE IstPKW=0 and IstRad=0 and IstKrad and IstGkfz=0 and IstSonstige=0".$strLocation;
break;
case 4:
$strSQL="SELECT count(*) as count FROM Unfallorte_Hamm
WHERE IstPKW=0 and IstFuss=0 and IstRad=0 and IstGkfz=0 and IstSonstige=0";
$strSQL="SELECT count(*) as count FROM data
WHERE IstPKW=0 and IstFuss=0 and IstRad=0 and IstGkfz=0 and IstSonstige=0".$strLocation;
break;
case 5:
$strSQL="SELECT count(*) as count FROM Unfallorte_Hamm
WHERE IstPKW=0 and IstFuss=0 and IstKrad=0 and IstRad=0 and IstSonstige=0";
$strSQL="SELECT count(*) as count FROM data
WHERE IstPKW=0 and IstFuss=0 and IstKrad=0 and IstRad=0 and IstSonstige=0".$strLocation;
break;
case 6:
$strSQL="SELECT count(*) as count FROM Unfallorte_Hamm
WHERE IstPKW=0 and IstFuss=0 and IstKrad=0 and IstGkfz=0 and IstRad=0";
$strSQL="SELECT count(*) as count FROM data
WHERE IstPKW=0 and IstFuss=0 and IstKrad=0 and IstGkfz=0 and IstRad=0".$strLocation;
break;
}
$result = $db->query($strSQL.$strYear);
if ($row = $result->fetchArray()) {
if ($row = $result->fetch(PDO::FETCH_ASSOC)) {
$strTable.="<tr><td>Alleinunfälle und Unfälle mit geicher Fahrzeugart</td><td>".$row['count']."</td></tr>";
}
$strTable.="</table>";
//Unfallart
$strSQL="SELECT UART, count(UART) as anz FROM Unfallorte_Hamm WHERE ".$strWhere.$strYear." GROUP BY UART";
$strSQL="SELECT UART, count(UART) as anz FROM data WHERE ".$strWhere.$strYear.$strLocation." GROUP BY UART";
$strTable.="<h5>Unfallart</h5>";
$strTable.="<table class='statistik'>";
$result = $db->query($strSQL);
while ($row = $result->fetchArray()) {
while ($row = $result->fetch(PDO::FETCH_ASSOC)) {
$strTable.="<tr><td>".$arrUnfallart[$row['UART']]."</td><td>".$row['anz']."</td></tr>\n";
}
$strTable.="</table>";
//Unfallart
$strSQL="SELECT UTYP1, count(UTYP1) as anz FROM Unfallorte_Hamm WHERE ".$strWhere.$strYear." GROUP BY UTYP1";
$strSQL="SELECT UTYP1, count(UTYP1) as anz FROM data WHERE ".$strWhere.$strYear.$strLocation." GROUP BY UTYP1";
$strTable.="<h5>Unfalltyp</h5>";
$strTable.="<table class='statistik'>";
$result = $db->query($strSQL);
while ($row = $result->fetchArray()) {
while ($row = $result->fetch(PDO::FETCH_ASSOC)) {
$strTable.="<tr><td>".$arrUnfalltyp[$row['UTYP1']]."</td><td>".$row['anz']."</td></tr>\n";
}
$strTable.="</table>";