several vehicles

This commit is contained in:
Walter Hupfeld 2020-08-02 20:08:48 +02:00
parent 558d336fa0
commit 2ff7124f6f
4 changed files with 97 additions and 63 deletions

View File

@ -12,6 +12,34 @@ $numInfoLng =7.825;
$numZoom=12; $numZoom=12;
$fileGeojson ="geojson/hamm.geojson"; $fileGeojson ="geojson/hamm.geojson";
$arrVehicles = array (
1 => "Fahrrad",
2 => "PKW",
3 => "Fussgänger",
4 => "Kraftrad",
5 => "LKW",
6 => "Sonstiges"
);
$arrVehicles_pl = array (
1 => "Fahrrädern",
2 => "PKWs",
3 => "Fussgängern",
4 => "Krafträdern",
5 => "LKWs",
6 => "Sonstigen"
);
$arrWochentage = array (
1 => "Sonntag",
2 => "Montag",
3 => "Dienstag",
4 => "Mittwoch",
5 => "Donnerstag",
6 => "Freitag",
7 => "Samstag"
);
$arrCategory = array ( $arrCategory = array (
1 => "Unfall mit Getöteten", 1 => "Unfall mit Getöteten",
@ -59,8 +87,6 @@ $arrStrassenzustand = array (
2 => "winterglatt", 2 => "winterglatt",
); );
$arrTopic = array ( $arrTopic = array (
2 => "Radverkehr", 2 => "Radverkehr",
1 => "Fußverkehr", 1 => "Fußverkehr",
@ -70,6 +96,7 @@ $arrTopic = array (
); );
$arrMarkerType = array ( $arrMarkerType = array (
0=>"infoMarker",
1=>"pedestrianMarker", 1=>"pedestrianMarker",
2=>"bicycleMarker", 2=>"bicycleMarker",
3=>"trainMarker", 3=>"trainMarker",
@ -78,18 +105,8 @@ $arrMarkerType = array (
); );
$arrTransport = array (
0 => "keine Angabe",
1 => "kein Auto",
2 => "Auto",
3 => "Motorroller/Motorrad",
4 => "Bus/Bahn",
5 => "Fahrrad",
6 => "Zu Fuß"
);
$arrIcon = array ( $arrIcon = array (
0 => "<i class='wa bg-primary fa fa-info'></i>",
1 => "<i class='wa bg-danger fa fa-male'></i>", 1 => "<i class='wa bg-danger fa fa-male'></i>",
2 => "<i class='wa bg-danger fa fa-bicycle'></i>", 2 => "<i class='wa bg-danger fa fa-bicycle'></i>",
3 => "<i class='wa bg-primary fa fa-bus'></i>", 3 => "<i class='wa bg-primary fa fa-bus'></i>",

View File

@ -45,15 +45,15 @@
<div class="card-body"> <div class="card-body">
<p> Die Unfallkarte basiert auf Daten des Statistischen Bundesamtes:</p> <p> Die Unfallkarte basiert auf Daten des Statistischen Bundesamtes:</p>
<p>&nbsp;</p> <p>&nbsp;</p>
<div><img style="width:220px" src="<?=$strLogo?>" alt="Logo"></div> Weiter Erläuterungen unter <a href="https://unfallatlas.statistikportal.de" target="_blank">https://unfallatlas.statistikportal.de</a>
<p>&nbsp;</p> <p>&nbsp;</p>
<p> <p>
<?= stripslashes(nl2br($strImpressum)) ?>
</p> </p>
<p><a href="<?=$strUrl?>"><?=$strUrlBez?></a></p>
<p>&nbsp;</p> <p>&nbsp;</p>
Anfragen an <a href="mailto:<?=$contactEmail?>"><?=$contactEmail?></a>
<p>&nbsp;</p> <p>&nbsp;</p>
<p>&nbsp;</p> <p>&nbsp;</p>
<!-- Bitte nicht entfernen --> <!-- Bitte nicht entfernen -->

View File

@ -5,33 +5,59 @@
$strIntro ="<h4>".$strTitle."</h4>"; $strIntro ="<h4>".$strTitle."</h4>";
$strIntro .= nl2br2($strIntroText); $strIntro .= nl2br2($strIntroText);
$numKey = (isset($_GET['key'])) ? $_GET['key'] : 1 ; $numVehicle = (isset($_GET['v'])) ? (int) $_GET['v'] : 1;
switch ($numKey) { switch ($numVehicle) {
case 1 : $strKey = "IstRad=1"; case 1:
break; case 0:
case 2: $strKey = "IstPKW=1"; $strWhere ="IstRad = 1";
break; $topic=2;
case 3 : $strKey = "IstFuss=1"; break;
break; case 2:
$strWhere = "IstPKW = 1";
$topic=4;
break;
case 3:
$strWhere = "IstFuss = 1";
$topic=1;
break;
case 4:
$strWhere = "IstKrad = 1";
$topic=0;
break;
case 5:
$strWhere = "IstGkfz = 1";
$topic=5;
break;
case 6:
$strWhere = "IstSonstige = 1";
$topic=3;
break;
default: $strWhere ="IstRad = 1";
$topic=2;
} }
$strSQL="SELECT * FROM Unfallorte2019_Hamm WHERE ".$strWhere;
$strSQL="SELECT * FROM Unfallorte2019_Hamm WHERE ".$strKey;
$result = $db->query($strSQL); $result = $db->query($strSQL);
$arrMarker = array(); $arrMarker = array();
$arrDescription = array(); $arrDescription = array();
$description="";
while ($row = $result->fetchArray()) { while ($row = $result->fetchArray()) {
//print_r($row);echo "<hr>"; //print_r($row);echo "<hr>";
$id = $row[0]; $id = $row[0];
$topic = 2;
$numLng = $row['XGCSWGS84']; $numLng = $row['XGCSWGS84'];
$numLat = $row['YGCSWGS84']; $numLat = $row['YGCSWGS84'];
if ($row['IstRad']) $description .="mit Fahrradbeteiligung, ";
if ($row['IstPKW']) $description .="mit PKW-Beteiligung, ";
if ($row['IstFuss']) $description .="mit Fußgängerbeteiligung, ";
if ($row['IstKrad']) $description .="mit Kraftradbeteiligung, ";
if ($row['IstGkfz']) $description .="mit Güterkraftzeugbeteiligung, ";
if ($row['IstSonstige']) $description .="mit Beteiligung eines oben nicht genannten Verkehrsmittels";
$strDescription=generate_tooltip_description($row); $strDescription=generate_tooltip_description($row);
@ -77,9 +103,16 @@
<div class="collapse navbar-collapse" id="navbars"> <div class="collapse navbar-collapse" id="navbars">
<ul class="navbar-nav mr-auto"> <ul class="navbar-nav mr-auto">
<li class="nav-item active">
<a class="nav-link" href="index.php?ref=1">Karte <span class="sr-only">(current)</span></a> <?php foreach ($arrVehicles as $key => $strVehicle):
</li> $strActive = ($numVehicle==$key) ? "active" : ""
?>
<li class="nav-item <?=$strActive?>">
<a class="nav-link" href="index.php?v=<?=$key?>"><?=$strVehicle?>
<span class="sr-only">(current)</span> </a>
<?php endforeach; ?>
</ul> </ul>
<div> <div>
@ -101,17 +134,10 @@
<nav class="col-md-2 d-none d-md-block bg-light sidebar"> <nav class="col-md-2 d-none d-md-block bg-light sidebar">
<div class="sidebar-sticky"> <div class="sidebar-sticky">
<img class="logo" src="<?=$strLogo?>" alt="Logo" >
<ul class="nav flex-column"> <ul class="nav flex-column">
Unfälle mit
<?php <?php
foreach ($arrTopic as $key=>$topic) { echo $arrVehicles_pl[$numVehicle];
echo "<li class='nav-item'>";
echo "<label>";
echo "<a class='nav-link'>".$arrIcon[$key]." ";
echo "<input type='checkbox' name='check_".$key."' id='check_".$key."' class='check' checked='checked' > ";
echo $topic."</a></label>";
echo "</li>";
}
?> ?>
</ul> </ul>
</div> </div>
@ -187,8 +213,6 @@
// Marker from database ------------------------------------------------------- // Marker from database -------------------------------------------------------
var up="up";
var down="down";
var marker = []; var marker = [];
var arrDescription = []; var arrDescription = [];
@ -196,28 +220,23 @@
foreach ($arrMarker as $idx=>$strMarker) { foreach ($arrMarker as $idx=>$strMarker) {
echo $strMarker."\n"; echo $strMarker."\n";
} }
echo "var marker_max=".$markerid."\n"; echo "var marker_max=".$markerid."\n";
?> ?>
// Info-Marker für Start -------------------------------------------------------- // Info-Marker für Start --------------------------------------------------------
var marker2 = L.marker([<?=$numInfoLat?>, <?=$numInfoLng?>], { icon: infoMarker }).addTo(mymap); var marker2 = L.marker([<?=$numInfoLat?>, <?=$numInfoLng?>], { icon: infoMarker }).addTo(mymap);
<?php <?php
echo "marker2.bindPopup('".$strIntro."').openPopup();"; echo "marker2.bindPopup('".$strIntro."');";
if ($numVehicle==0) {
echo "marker2.openPopup();";
}
?> ?>
hammLayer.on('click',function(e){ e.preventDefault(); })
mymap.on('click', onMapClick);
// Hide and show marker form checkbox ---------------------------------------- // Hide and show marker form checkbox ----------------------------------------
$('.check').click(function() { $('.check').click(function() {

View File

@ -8,18 +8,16 @@ function generate_tooltip_description($row) {
global $arrLicht; global $arrLicht;
global $arrRad; global $arrRad;
global $arrStrassenzustand; global $arrStrassenzustand;
global $arrWochentage;
global $db; global $db;
//$description = $row['description'];
//$id = $row['id'];
//$topic = $row['topic'];
//$numDatum= strtotime($row['created_at']);
//$datum= date("d.m.Y",$numDatum);
$strDescription = "<h3>Daten zum Unfall</h3>"; $strDescription = "<h3>Daten zum Unfall</h3>";
$description = "<strong>Unfallkategorie:</strong> ".$arrCategory[$row['UKATEGORIE']]."<br>"; $description = "<strong>Unfallkategorie:</strong> ".$arrCategory[$row['UKATEGORIE']]."<br>";
$description .= "<strong>Unfallmonat/Jahr:</strong> ".$row['UMONAT']."/".$row['UJAHR']."<br>";
$description .= "<strong>Tag/Stunde:</strong> ".$arrWochentage[$row['UWOCHENTAG']]." ".$row['USTUNDE']." Uhr<br>";
$description .= "<strong>Unfallart:</strong> ".$arrUnfallart[$row['UART']]."<br>"; $description .= "<strong>Unfallart:</strong> ".$arrUnfallart[$row['UART']]."<br>";
$description .= "<strong>Unfalltyp:</strong> ".$arrUnfalltyp[$row['UTYP1']]."<br>"; $description .= "<strong>Unfalltyp:</strong> ".$arrUnfalltyp[$row['UTYP1']]."<br>";
$description .= "<strong>Lichtverhältnisse:</strong> ".$arrLicht[$row['ULICHTVERH']]."<br>"; $description .= "<strong>Lichtverhältnisse:</strong> ".$arrLicht[$row['ULICHTVERH']]."<br>";