diff --git a/README.md b/README.md
index d652f5e..6c6b6a9 100644
--- a/README.md
+++ b/README.md
@@ -1,3 +1,3 @@
# unfallkarte
-Unfallkarte
\ No newline at end of file
+Unfallkarte
diff --git a/db/unfallorte-soest b/db/unfallorte-soest
new file mode 100644
index 0000000..e69de29
diff --git a/geojson/soest.geojson b/geojson/soest.geojson
new file mode 100644
index 0000000..ca01935
--- /dev/null
+++ b/geojson/soest.geojson
@@ -0,0 +1 @@
+{"type":"FeatureCollection","features":[{"type": "Feature", "geometry": {"type": "Polygon", "coordinates": [[[8.137922921032658, 51.61409002991987], [8.13748793839373, 51.614954413528274], [8.134143636846078, 51.61448240654068], [8.133155287076836, 51.618441794285275], [8.126881351695491, 51.618144399038606], [8.126734846551042, 51.61919884011858], [8.12251566554531, 51.619113963253994], [8.122892932990203, 51.62315835587188], [8.11893211899948, 51.62285353528218], [8.118540588246892, 51.62537490535286], [8.114619785632636, 51.62527048175815], [8.114135237765238, 51.62751836257576], [8.109265692480719, 51.62756277846895], [8.108757439358047, 51.62586637720656], [8.103395492794874, 51.62567195004171], [8.099831501777112, 51.62502314206821], [8.099125681548736, 51.62689900807225], [8.086947014784837, 51.623914468035], [8.084589481287548, 51.624469342791244], [8.080941016599581, 51.6237285803484], [8.083233143152615, 51.62194829137314], [8.078096916452482, 51.620087841844004], [8.078494188476625, 51.619411904701224], [8.075359832164075, 51.61934758442796], [8.075743990732603, 51.61755524604498], [8.0732743640936, 51.61695544423246], [8.07179643347161, 51.61510682587478], [8.077571580805126, 51.61362325684614], [8.076908189471945, 51.61277253730809], [8.07909781432175, 51.61194445710631], [8.076497851016466, 51.609033243106076], [8.075380825171274, 51.609324672285055], [8.069497378063875, 51.60204380929504], [8.065718981691658, 51.602425006267694], [8.065451160222372, 51.601753392428265], [8.06041557771677, 51.60247177393717], [8.059109154007542, 51.60304460547231], [8.055188260126021, 51.600407100239174], [8.054273893551196, 51.60074820716424], [8.048846817718381, 51.593857647695366], [8.044873801294383, 51.59199939819329], [8.044390289746882, 51.5923653636075], [8.040643139455755, 51.59037251358493], [8.041273310327778, 51.588758358680494], [8.042475206201257, 51.58871138609767], [8.044629177035228, 51.5895033384117], [8.045541919060623, 51.5894593183831], [8.046781906936545, 51.588431949277656], [8.047906814807469, 51.58820329451769], [8.047251243670898, 51.58452612666776], [8.049414255313625, 51.584066998332624], [8.046504542081305, 51.57932189176943], [8.045305170715785, 51.57958086461165], [8.044932588062139, 51.57883004741579], [8.04595895564044, 51.57850845081228], [8.045428093629724, 51.57756617055869], [8.04778765266509, 51.57450977456685], [8.044646024392378, 51.5739084256728], [8.044156018832153, 51.57192283686452], [8.04068068320798, 51.57088213107934], [8.040129811470807, 51.56996664813923], [8.038524964915807, 51.56972613452525], [8.037882962195928, 51.56769641712877], [8.033873378554347, 51.56678451326133], [8.03267251129532, 51.56799981967284], [8.029389383081304, 51.56850268438166], [8.027644058227029, 51.56855185012572], [8.027419220232574, 51.56931878869853], [8.024802892100933, 51.56766344608325], [8.022567611698957, 51.5674450351763], [8.017758988374323, 51.564835184245574], [8.016028449126974, 51.564563825692595], [8.01440053331705, 51.56498680441834], [8.010308331457386, 51.56400301205038], [8.009874603017327, 51.56507403977727], [8.00647022347429, 51.564933715160684], [8.006547539828619, 51.56331144989378], [7.998390551420083, 51.563255718572286], [7.998170593976309, 51.562736041401536], [7.996565978488571, 51.562730568447364], [7.995210075516828, 51.559014933390756], [7.995480966909732, 51.557036857264684], [7.992860100497062, 51.556639097169516], [7.993472478522903, 51.55521185523177], [7.990546937952357, 51.553742755684354], [7.991178190121998, 51.553098843235105], [7.990698887547449, 51.55180424578248], [7.988563520695406, 51.550984634721594], [7.988490987875156, 51.549146749058664], [7.986553107093034, 51.54920446762327], [7.985606761915665, 51.548032071974006], [7.984239830315428, 51.53479740223914], [7.983291877367643, 51.533125057141454], [7.984714107087793, 51.532467076592376], [7.986162056160124, 51.533710291560496], [7.986217527382357, 51.53130594709352], [7.990236545028489, 51.53322552362278], [7.991741451801075, 51.53363863544359], [7.996760837548112, 51.53403116181268], [7.998403630987378, 51.53401841004653], [7.998071701884601, 51.53520221162746], [8.001341540619148, 51.536160404244036], [8.008780907843105, 51.53631788844042], [8.014712957535542, 51.5374413641053], [8.016628140795486, 51.53738093601982], [8.017767708903957, 51.538019768243686], [8.018646116874708, 51.53752517474369], [8.021522752940458, 51.53637949192359], [8.023105099759821, 51.53514353659253], [8.021845781525421, 51.534823288417726], [8.022676388920885, 51.532173280812536], [8.027579449547027, 51.52622681272335], [8.03172272499861, 51.52685421256128], [8.03614168665419, 51.527297425446356], [8.04062105560221, 51.528667039849275], [8.04156576559947, 51.528138972483944], [8.041580057736079, 51.52644829715126], [8.046528573073578, 51.527938984691446], [8.047555701580249, 51.52595024013366], [8.050635323479467, 51.524388533136126], [8.052398567640427, 51.523339209813415], [8.05371792539715, 51.52150892768605], [8.060180902465866, 51.5234529827471], [8.061059478042285, 51.52416184585412], [8.06697856636248, 51.52485580691678], [8.067589044881077, 51.52558289916027], [8.075913544205516, 51.52865338127219], [8.080095814038856, 51.529252416551444], [8.080626324644106, 51.527129990507], [8.082234168695653, 51.52728900980855], [8.081405084070237, 51.5290542617253], [8.08397268934247, 51.52934996726354], [8.084026272391517, 51.53161940004976], [8.08793129406215, 51.53063723618643], [8.092164357728112, 51.5286265001244], [8.094581603344485, 51.52546240518241], [8.095571159601441, 51.52475349684508], [8.1076489207994, 51.52530537412402], [8.108456167941977, 51.5242146079417], [8.122731922120002, 51.52829298709633], [8.130812506608985, 51.528194669782614], [8.133308395594819, 51.52777327490814], [8.136958186654564, 51.52807514868766], [8.138037366284147, 51.527582369448645], [8.138367863774661, 51.52650300664281], [8.140694589655775, 51.526249539175346], [8.141238309583182, 51.52503154482442], [8.147144623081733, 51.52471445188994], [8.1519224768471, 51.524962775887104], [8.153921833253646, 51.52649677623602], [8.155952255112876, 51.52686122097026], [8.164843825265686, 51.52765882582525], [8.168773491257385, 51.526961810525115], [8.169590317168707, 51.52836278629998], [8.169220939797105, 51.529880068382425], [8.173186701159782, 51.53003309128617], [8.17637540086489, 51.530784519810055], [8.172973864280277, 51.5321794148765], [8.172697565628352, 51.53554603023935], [8.167736550899109, 51.53518693699275], [8.167568840581083, 51.537064823407185], [8.164794741241344, 51.53683887559175], [8.164291625219434, 51.538215059166575], [8.15985230421546, 51.53724490620554], [8.155262814604585, 51.540907122016044], [8.153716665992478, 51.54178545971073], [8.148688500967873, 51.54441258427791], [8.146363117394111, 51.545842350295175], [8.144957808584595, 51.547344462343645], [8.147047231779222, 51.5477012189102], [8.14666090555988, 51.549601726622704], [8.157308666626523, 51.55086689871478], [8.159540912998592, 51.55012814710157], [8.161808038629387, 51.55011912483629], [8.161019096062134, 51.55426192260465], [8.158577003731239, 51.555995645521826], [8.148553516617815, 51.559423587114225], [8.150107658335171, 51.56188169076456], [8.151081249030282, 51.56167246086223], [8.155593651879723, 51.569364023477426], [8.154800241269648, 51.5696340316653], [8.154655564136993, 51.572803514837766], [8.153420949063824, 51.57417908879991], [8.152037560065668, 51.57700936585076], [8.149145501139317, 51.57856245191965], [8.150906295276238, 51.57887655518183], [8.151136386500138, 51.5819954592606], [8.146786626688703, 51.58089167426706], [8.140002381038432, 51.58021610186436], [8.13993797062607, 51.58146594900711], [8.138850858876086, 51.58349642005559], [8.138028615814859, 51.585712203724285], [8.138464356392182, 51.58762913044761], [8.141735235830323, 51.59092145202301], [8.138989886393318, 51.59166674232604], [8.139485632237275, 51.593619967751934], [8.138121237247729, 51.59516446193958], [8.135959251388883, 51.59640891132787], [8.134207300005457, 51.594543082787794], [8.12824858349513, 51.59619532717601], [8.129246672568225, 51.59730135048269], [8.128635978764809, 51.59757486351407], [8.124076849144087, 51.598132513390915], [8.1260802980675, 51.600189047555965], [8.123715963687491, 51.60174364552015], [8.126520761198364, 51.60284419207913], [8.129055991593296, 51.60105894711197], [8.130508714807387, 51.60147516081832], [8.129323352346004, 51.602594480919045], [8.135031315917967, 51.60394745600348], [8.136235437351123, 51.60432880022937], [8.134893441343518, 51.60513544493042], [8.139117430216182, 51.60702993815869], [8.141153060123683, 51.60537977183403], [8.144039824502588, 51.60760560311915], [8.147621580919418, 51.611043356786915], [8.146355784808728, 51.61091911867223], [8.145761581182953, 51.61318779067625], [8.143526641363033, 51.61276216526868], [8.139116127015205, 51.612245383262994], [8.137922921032658, 51.61409002991987]]]}, "properties": {"gem_name": "Stadt Soest", "lan_code": "05", "vwg_name": "Gemeinschaftsfreie Gemeinde Soest", "year": "2020", "geo_point_2d": [51.5656440733, 8.08628923069], "gem_area_code": "DEU", "lan_name": "Nordrhein-Westfalen", "krs_name": "Kreis Soest", "vwg_code": "059740040", "krs_code": "05974", "gem_code": "059740040040", "gem_type": "Stadt", "gem_name_short": "Soest"}}]}
\ No newline at end of file
diff --git a/index.php b/index.php
index 08f3708..9457c21 100644
--- a/index.php
+++ b/index.php
@@ -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 "
";
- $id = $row[0];
+ $id = $row['OBJECTID'];
$numLng = $row['XGCSWGS84'];
$numLat = $row['YGCSWGS84'];
if ($row['IstRad']) $description .="mit Fahrradbeteiligung, ";
diff --git a/lib/functions.php b/lib/functions.php
index 6f1e072..7a90524 100644
--- a/lib/functions.php
+++ b/lib/functions.php
@@ -88,13 +88,14 @@ function nl2br2($string) {
global $arrUnfallart;
global $arrUnfalltyp;
global $arrCategory;
+ global $strLocation;
$strTable="Unfallkategorie
";
$strTable.="";
- $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.="".$arrCategory[$row['UKATEGORIE']]." | ".$row['anz']." |
\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.="Unfallbeteiligte
";
$strTable.="";
//$strTable.="Unfallbeteiligte | Anzahl |
";
- while ($row = $result->fetchArray()) {
+ while ($row = $result->fetch(PDO::FETCH_ASSOC)) {
$strTable.="Fahrräder | ".$row['rad']." |
";
$strTable.="PKWs | ".$row['pkw']." |
";
$strTable.="Fussgänger | ".$row['fuss']." |
";
@@ -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.="Alleinunfälle und Unfälle mit geicher Fahrzeugart | ".$row['count']." |
";
}
$strTable.="
";
//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.="Unfallart
";
$strTable.="";
$result = $db->query($strSQL);
- while ($row = $result->fetchArray()) {
+ while ($row = $result->fetch(PDO::FETCH_ASSOC)) {
$strTable.="".$arrUnfallart[$row['UART']]." | ".$row['anz']." |
\n";
}
$strTable.="
";
//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.="Unfalltyp
";
$strTable.="";
$result = $db->query($strSQL);
- while ($row = $result->fetchArray()) {
+ while ($row = $result->fetch(PDO::FETCH_ASSOC)) {
$strTable.="".$arrUnfalltyp[$row['UTYP1']]." | ".$row['anz']." |
\n";
}
$strTable.="
";