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 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."' "; $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); $result = $db->query($strSQL);
$arrMarker = array(); $arrMarker = array();
$arrDescription = array(); $arrDescription = array();
$description=""; $description="";
while ($row = $result->fetchArray()) { while ($row = $result->fetch(PDO::FETCH_ASSOC)) {
//print_r($row);echo "<hr>"; //print_r($row);echo "<hr>";
$id = $row[0]; $id = $row['OBJECTID'];
$numLng = $row['XGCSWGS84']; $numLng = $row['XGCSWGS84'];
$numLat = $row['YGCSWGS84']; $numLat = $row['YGCSWGS84'];
if ($row['IstRad']) $description .="mit Fahrradbeteiligung, "; if ($row['IstRad']) $description .="mit Fahrradbeteiligung, ";

View File

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