1 | <?php |
---|
2 | /* alkisstrasse.php |
---|
3 | |
---|
4 | ALKIS-Buchauskunft, Kommunales Rechenzentrum Minden-Ravensberg/Lippe (Lemgo). |
---|
5 | Alle FlurstÃŒcke an einer Strasse anzeigen, egal ob "mit" oder "ohne" Hausnummer |
---|
6 | Parameter: "gml_id" aus der Tabelle "ax_lagebezeichnungkatalogeintrag" |
---|
7 | |
---|
8 | Version: |
---|
9 | 2016-02-24 Version fuer norGIS-ALKIS-Import |
---|
10 | 2016-11-29 HTML5, Gemeinsam genutzte Datenbanken ermöglichen, SQL optimiert (FS-Liste jetzt schneller) |
---|
11 | 2017-02-23 Neuer Parameter &haus=m/o zum alkisexport.php |
---|
12 | 2017-06-08 Validierung Eingabeparameter, gestreifte Tabelle, Feinkorrekturen |
---|
13 | */ |
---|
14 | session_start(); |
---|
15 | |
---|
16 | $showkey="n"; // Var. aus Parameter initalisieren |
---|
17 | $cntget = extract($_GET); // Parameter in Variable umwandeln |
---|
18 | |
---|
19 | // strikte Validierung aller Parameter |
---|
20 | if (!isset($gmlid) or !preg_match('#^[0-9A-Za-z]{16}$#', $gmlid)) {die("Eingabefehler gmlid");} |
---|
21 | if (!isset($gkz) or !preg_match('#^[0-9]{3}$#', $gkz)) {die("Eingabefehler gkz");} |
---|
22 | if (!preg_match('#^[j|n]{0,1}$#', $showkey)) {die ("Eingabefehler showkey");} |
---|
23 | if ($showkey == "j") {$showkey=true;} else {$showkey=false;} |
---|
24 | |
---|
25 | require_once("alkis_conf_location.php"); |
---|
26 | if ($auth == "mapbender") {require_once($mapbender);} |
---|
27 | include("alkisfkt.php"); |
---|
28 | |
---|
29 | ?> |
---|
30 | <!doctype html> |
---|
31 | <html lang="de"> |
---|
32 | <head> |
---|
33 | <meta charset="utf-8"> |
---|
34 | <meta name="viewport" content="width=device-width, initial-scale=1.0"> |
---|
35 | <title>ALKIS Straße</title> |
---|
36 | <link rel="stylesheet" type="text/css" href="alkisauszug.css"> |
---|
37 | <link rel="shortcut icon" type="image/x-icon" href="ico/Strassen.ico"> |
---|
38 | <script type="text/javascript"> |
---|
39 | function ALKISexport(phaus) { |
---|
40 | window.open(<?php echo "'alkisexport.php?gkz=".$gkz."&tabtyp=strasse&gmlid=".$gmlid."&haus='"; ?> + phaus); |
---|
41 | } |
---|
42 | </script> |
---|
43 | </head> |
---|
44 | <body> |
---|
45 | <?php |
---|
46 | $con = pg_connect($dbconn." options='--application_name=ALKIS-Auskunft_alkisstrasse.php'"); |
---|
47 | if (!$con) echo "\n<p class='err'>Fehler beim Verbinden der DB</p>"; |
---|
48 | |
---|
49 | $sql ="SELECT s.land, s.regierungsbezirk, s.kreis, s.gemeinde, s.lage, s.bezeichnung AS snam, |
---|
50 | b.bezeichnung AS bnam, r.bezeichnung AS rnam, k.bezeichnung AS knam, g.bezeichnung AS gnam, o.gml_id AS ogml |
---|
51 | FROM ax_lagebezeichnungkatalogeintrag s JOIN ax_bundesland b ON s.land=b.land |
---|
52 | JOIN ax_regierungsbezirk r ON s.land=r.land AND s.regierungsbezirk=r.regierungsbezirk |
---|
53 | JOIN ax_kreisregion k ON s.land=k.land AND s.regierungsbezirk=k.regierungsbezirk AND s.kreis=k.kreis |
---|
54 | JOIN ax_gemeinde g ON s.land=g.land AND s.regierungsbezirk=g.regierungsbezirk AND s.kreis=g.kreis AND s.gemeinde=g.gemeinde |
---|
55 | LEFT JOIN ax_lagebezeichnungohnehausnummer o ON s.land=o.land AND s.regierungsbezirk=o.regierungsbezirk AND s.kreis=o.kreis AND s.gemeinde=o.gemeinde AND s.lage=o.lage |
---|
56 | WHERE s.gml_id= $1 AND s.endet IS NULL AND o.endet IS NULL ;"; |
---|
57 | |
---|
58 | $v=array($gmlid); |
---|
59 | $res=pg_prepare("", $sql); |
---|
60 | $res=pg_execute("", $v); |
---|
61 | if (!$res) { |
---|
62 | echo "\n<p class='err'>Fehler bei Lagebezeichnungskatalogeintrag.</p>"; |
---|
63 | if ($debug > 2) {echo "\n<p class='err'>SQL=<br>".htmlentities($sql, ENT_QUOTES, "UTF-8")."<br>$1 = gml_id = '".$gmlid."'</p>";} |
---|
64 | } |
---|
65 | if ($row = pg_fetch_array($res)) { |
---|
66 | $lage=$row["lage"]; // Strassenschluessel |
---|
67 | $snam=$row["snam"]; // Strassenname |
---|
68 | $gem=$row["gemeinde"]; |
---|
69 | // Balken |
---|
70 | $kennz=$gem."-".$lage." (".$snam.")"; // Schluessel als Sucheingabe in NAV brauchbar? |
---|
71 | echo "\n<p class='strasse'>ALKIS Straße ".$kennz." </p>"; |
---|
72 | } else { |
---|
73 | echo "\n<p class='err'>Kein Treffer bei Lagebezeichnungskatalogeintrag.</p>"; |
---|
74 | } |
---|
75 | |
---|
76 | echo "\n<h2><img src='ico/Strassen.png' width='16' height='16' alt=''> Straße</h2>"; |
---|
77 | |
---|
78 | // Tabelle Kennzeichen |
---|
79 | echo "\n<table class='outer'>\n<tr>\n\t<td>" |
---|
80 | ."\n\t<table class='kennzstra' title='Lage'>" |
---|
81 | ."\n\t<tr>" |
---|
82 | ."\n\t\t<td class='head'>Land</td>" |
---|
83 | ."\n\t\t<td class='head'>Reg.-Bez.</td>" |
---|
84 | ."\n\t\t<td class='head'>Kreis</td>" |
---|
85 | ."\n\t\t<td class='head'>Gemeinde</td>" |
---|
86 | ."\n\t\t<td class='head'>Straße</td>" |
---|
87 | ."\n\t</tr>" |
---|
88 | ."\n\t<tr>"; |
---|
89 | echo "\n\t\t<td title='Bundesland'>"; |
---|
90 | if ($showkey) {echo "<span class='key'>".$row["land"]."</span><br>";} |
---|
91 | echo $row["bnam"]." </td>" |
---|
92 | ."\n\t\t<td title='Regierungsbezirk'>"; |
---|
93 | if ($showkey) {echo "<span class='key'>".$row["regierungsbezirk"]."</span><br>";} |
---|
94 | echo $row["rnam"]." </td>" |
---|
95 | ."\n\t\t<td title='Kreis'>"; |
---|
96 | if ($showkey) {echo "<span class='key'>".$row["kreis"]."</span><br>";} |
---|
97 | echo $row["knam"]." </td>" |
---|
98 | ."\n\t\t<td title='Gemeinde'>"; |
---|
99 | if ($showkey) {echo "<span class='key'>".$gem."</span><br>";} |
---|
100 | echo $row["gnam"]." </td>" |
---|
101 | . "\n\t\t<td title='Straße'>"; |
---|
102 | if ($showkey) {echo "<span class='key'>".$lage."</span><br>";} |
---|
103 | echo "<span class='wichtig'>".$snam."</span>" |
---|
104 | . " </td>" |
---|
105 | ."\n\t</tr>" |
---|
106 | ."\n\t</table>"; |
---|
107 | |
---|
108 | echo "\n\t</td>\n\t<td>"; |
---|
109 | |
---|
110 | // Kopf Rechts: |
---|
111 | $ogml=$row["ogml"]; // ID von "Lage Ohne HsNr" |
---|
112 | if ($ogml != "") { |
---|
113 | echo "\n\t\t<p class='nwlink noprint'>" |
---|
114 | ."\n\t\t<a href='alkislage.php?gkz=".$gkz."&ltyp=o&gmlid=".$ogml; |
---|
115 | if ($showkey) {echo "&showkey=j";} |
---|
116 | echo "' title='Lage Ohne Hausnummer'>Lage <img src='ico/Lage_an_Strasse.png' width='16' height='16' alt=''></a>" |
---|
117 | ."\n\t\t</p>"; |
---|
118 | } |
---|
119 | |
---|
120 | echo "\n\t</td>\n</tr>\n</table>"; |
---|
121 | pg_free_result($res); |
---|
122 | // Ende Seitenkopf |
---|
123 | |
---|
124 | // F L U R S T U E C K E |
---|
125 | echo "\n\n<h3 id='fs'><img src='ico/Flurstueck.png' width='16' height='16' alt=''> Flurstücke</h3>" |
---|
126 | ."\n<p>Zusammenfassung von 'Lage mit Hausnummer' und 'Lage ohne Hausnummer' an dieser StraÃe</p>"; |
---|
127 | |
---|
128 | // ax_Flurstueck >weistAuf> ax_LagebezeichnungMitHausnummer > = Hauptgebaeude |
---|
129 | // ax_Flurstueck >zeigtAuf> ax_LagebezeichnungOhneHausnummer > = Strasse |
---|
130 | // Suchkriterium: gml_id aus Katalog |
---|
131 | $sql="SELECT f.gemarkungsnummer, g.bezeichnung, f.gml_id, f.flurnummer, f.zaehler, f.nenner, f.amtlicheflaeche, l.gml_id AS lgml, l.hausnummer, 'm' AS ltyp |
---|
132 | FROM ax_flurstueck f JOIN ax_lagebezeichnungmithausnummer l ON l.gml_id=ANY(f.weistAuf) |
---|
133 | JOIN ax_gemarkung g ON f.land=g.land AND f.gemarkungsnummer=g.gemarkungsnummer |
---|
134 | JOIN ax_lagebezeichnungkatalogeintrag s ON l.land=s.land AND l.regierungsbezirk=s.regierungsbezirk AND l.kreis=s.kreis AND l.gemeinde=s.gemeinde AND l.lage=s.lage |
---|
135 | WHERE s.gml_id = $1 AND f.endet IS NULL AND s.endet IS NULL AND l.endet IS NULL |
---|
136 | UNION SELECT f.gemarkungsnummer, g.bezeichnung, f.gml_id, f.flurnummer, f.zaehler, f.nenner, f.amtlicheflaeche, l.gml_id AS lgml, '' AS hausnummer, 'o' AS ltyp |
---|
137 | FROM ax_flurstueck f JOIN ax_lagebezeichnungohnehausnummer l ON l.gml_id=ANY(f.zeigtauf) |
---|
138 | JOIN ax_gemarkung g ON f.land=g.land AND f.gemarkungsnummer=g.gemarkungsnummer |
---|
139 | JOIN ax_lagebezeichnungkatalogeintrag s ON l.land=s.land AND l.regierungsbezirk=s.regierungsbezirk AND l.kreis=s.kreis AND l.gemeinde=s.gemeinde AND l.lage=s.lage |
---|
140 | WHERE s.gml_id = $1 AND f.endet IS NULL AND s.endet IS NULL AND l.endet IS NULL |
---|
141 | ORDER BY gemarkungsnummer, flurnummer, zaehler, nenner;"; |
---|
142 | |
---|
143 | $v=array($gmlid); |
---|
144 | $resf=pg_prepare("", $sql); |
---|
145 | $resf=pg_execute("", $v); |
---|
146 | if (!$resf) { |
---|
147 | echo "\n<p class='err'>Fehler bei Flurstück.</p>"; |
---|
148 | if ($debug > 2) {echo "\n<p class='err'>SQL=<br>".htmlentities($sql, ENT_QUOTES, "UTF-8")."<br>$1 = gml_id = '".$gmlid."'</p>";} |
---|
149 | } |
---|
150 | |
---|
151 | echo "\n<table class='fs'>" |
---|
152 | ."\n<tr>" |
---|
153 | ."\n\t<td class='heads' title='Name der Gemarkung (Ortsteil)'>Gemarkung<img src='ico/sort.png' width='10' height='10' alt='' title='Sortierung'></td>" |
---|
154 | ."\n\t<td class='heads' title='Flur-Nummer'>Flur<img src='ico/sort.png' width='10' height='10' alt='' title='Sortierung'></td>" |
---|
155 | ."\n\t<td class='heads' title='Flurstücksnummer (Zähler / Nenner)'><img src='ico/sort.png' width='10' height='10' alt='' title='Sortierung'>Flurst.</td>" |
---|
156 | ."\n\t<td class='head fla' title='amtliche Fläche in Quadratmeter'>Fläche</td>" |
---|
157 | ."\n\t<td class='head hsnr' title='Hausnummer aus der Lagebezeichnung des Flurstücks'>HsNr.</td>" |
---|
158 | ."\n\t<td class='head nwlink noprint' title='Verlinkung zu anderen Nachweis-Arten und verbundenen Objekten'>weitere Auskunft</td>" |
---|
159 | ."\n</tr>"; |
---|
160 | $j=0; |
---|
161 | $gwgmkg=""; // Gruppenwechsel |
---|
162 | $gwflur=""; |
---|
163 | $cnths=0; // Count Haus-Lagebezeichnung |
---|
164 | |
---|
165 | $zpaar=false; // Zeilen-Farbwechsel |
---|
166 | while($rowf = pg_fetch_array($resf)) { |
---|
167 | $gmkg=$rowf["bezeichnung"]; |
---|
168 | $flur=str_pad($rowf["flurnummer"], 3, "0", STR_PAD_LEFT); |
---|
169 | $fskenn=$rowf["zaehler"]; // Bruchnummer |
---|
170 | if ($rowf["nenner"] != "") {$fskenn.="/".$rowf["nenner"];} |
---|
171 | $flae=number_format($rowf["amtlicheflaeche"],0,",",".") . " m²"; |
---|
172 | $lgml=$rowf["lgml"]; // ID von "Lage Mit/Ohne" |
---|
173 | $ltyp=$rowf["ltyp"]; // mit/ohne HsNr |
---|
174 | |
---|
175 | if ($zpaar) {$trclass='paa';} else {$trclass='unp';} |
---|
176 | $zpaar=!$zpaar; |
---|
177 | echo "\n<tr class='".$trclass."'>" |
---|
178 | ."\n\t<td>"; |
---|
179 | if ($showkey) {echo "<span class='key'>".$rowf["gemarkungsnummer"]."</span> ";} |
---|
180 | if ($gwgmkg != $gmkg) { |
---|
181 | echo "<b>".$gmkg."</b></td>"; |
---|
182 | $gwgmkg=$gmkg; |
---|
183 | $gwflur=""; |
---|
184 | } else { |
---|
185 | echo $gmkg."</td>"; |
---|
186 | } |
---|
187 | |
---|
188 | if ($gwflur != $flur) { |
---|
189 | echo "\n\t<td><b>".$flur."</b></td>"; |
---|
190 | $gwflur=$flur; |
---|
191 | } else { |
---|
192 | echo "\n\t<td>".$flur."</td>"; |
---|
193 | } |
---|
194 | |
---|
195 | echo "\n\t<td><span class='wichtig'>".$fskenn."</span></td>" |
---|
196 | ."\n\t<td class='fla'>".$flae."</td>" |
---|
197 | ."\n\t<td class='hsnr'>".$rowf["hausnummer"]."</td>" |
---|
198 | ."\n\t<td>\n\t\t<p class='nwlink noprint'>"; |
---|
199 | if ($ltyp == 'm') { // nur Typ "Mit Haus" anzeigen. Dar Typ 'o' ist immer gleich und identisch mit dem Link im Kopf |
---|
200 | echo "\n\t\t<a href='alkislage.php?gkz=".$gkz."&ltyp=".$ltyp."&gmlid=".$lgml; |
---|
201 | if ($showkey) {echo "&showkey=j";} |
---|
202 | echo "' title='Lagebezeichnung mit Hausnummer'>Lage <img src='ico/Lage_mit_Haus.png' width='16' height='16' alt=''></a> "; |
---|
203 | $cnths++; |
---|
204 | } |
---|
205 | // Link FlurstÃŒcksnachweis |
---|
206 | echo "\n\t\t<a href='alkisfsnw.php?gkz=".$gkz."&gmlid=".$rowf["gml_id"]."&eig=n"; |
---|
207 | if ($showkey) {echo "&showkey=j";} |
---|
208 | echo "' title='Flurstücksnachweis'>Flurstück <img src='ico/Flurstueck_Link.png' width='16' height='16' alt=''></a>"; |
---|
209 | echo "\n\t\t</p>\n\t</td>" |
---|
210 | ."\n</tr>"; |
---|
211 | $j++; |
---|
212 | } |
---|
213 | echo "\n</table>"; |
---|
214 | if ($j > 6) { |
---|
215 | echo "<p class='cnt'>".$j." Flurstücke"; |
---|
216 | if ($cnths > 1) {echo " und ".$cnths." Hauptgebäude";} |
---|
217 | echo " mit dieser StraÃe in der Lagebezeichnung</p>"; |
---|
218 | } |
---|
219 | pg_free_result($resf); |
---|
220 | ?> |
---|
221 | |
---|
222 | <div class='buttonbereich noprint'> |
---|
223 | <hr> |
---|
224 | <a title="zurück" href='javascript:history.back()'><img src="ico/zurueck.png" width="16" height="16" alt="zurück"></a> |
---|
225 | <a title="Drucken" href='javascript:window.print()'><img src="ico/print.png" width="16" height="16" alt="Drucken"></a> |
---|
226 | <a title="Export als CSV" href='javascript:ALKISexport("")'>alle<img src="ico/download.png" width="16" height="16" alt="Export"></a> |
---|
227 | <a title="CSV - nur Flurstücke mit Hausnummer" href='javascript:ALKISexport("m")'>mit HsNr<img src="ico/download.png" width="16" height="16" alt="Export"></a> |
---|
228 | <a title="CSV - nur Flurstücke ohne Hausnummer" href='javascript:ALKISexport("o")'>ohne<img src="ico/download.png" width="16" height="16" alt="Export"></a> |
---|
229 | </div> |
---|
230 | |
---|
231 | <?php footer($gmlid, $_SERVER['PHP_SELF']."?", ""); ?> |
---|
232 | |
---|
233 | </body> |
---|
234 | </html> |
---|