[330] | 1 | <?php |
---|
| 2 | /* alkisbaurecht.php - Baurecht |
---|
| 3 | ALKIS-Buchauskunft, Kommunales Rechenzentrum Minden-Ravensberg/Lippe (Lemgo). |
---|
| 4 | |
---|
[287] | 5 | Version: |
---|
[330] | 6 | 2013-06-27Neu als Variante von alkis*inlay*baurecht.ph (mit Footer, Balken und Umschaltung Key) |
---|
[334] | 7 | 2014-09-15 PostNAS 0.8: ohne Tab. "alkis_beziehungen", mehr "endet IS NULL", Spalten varchar statt integer |
---|
[330] | 8 | |
---|
| 9 | ToDo: id-Anzeige hinzufÃŒgen fÃŒr Baurecht und FlurstÃŒck |
---|
| 10 | */ |
---|
[287] | 11 | session_start(); |
---|
[330] | 12 | $cntget = extract($_GET); |
---|
| 13 | require_once("alkis_conf_location.php"); |
---|
| 14 | if ($auth == "mapbender") {require_once($mapbender);} |
---|
[287] | 15 | include("alkisfkt.php"); // f. Footer |
---|
[330] | 16 | if ($id == "j") {$idanzeige=true;} else {$idanzeige=false;} |
---|
| 17 | $keys = isset($_GET["showkey"]) ? $_GET["showkey"] : "n"; |
---|
[287] | 18 | if ($keys == "j") {$showkey=true;} else {$showkey=false;} |
---|
[330] | 19 | |
---|
| 20 | ?> |
---|
| 21 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> |
---|
| 22 | <html> |
---|
| 23 | <head> |
---|
| 24 | <meta name="author" content="b600352" > |
---|
| 25 | <meta http-equiv="cache-control" content="no-cache"> |
---|
| 26 | <meta http-equiv="pragma" content="no-cache"> |
---|
| 27 | <meta http-equiv="expires" content="0"> |
---|
| 28 | <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> |
---|
| 29 | <title>ALKIS Bau-, Raum- oder Bodenordnungsrecht</title> |
---|
| 30 | <link rel="stylesheet" type="text/css" href="alkisauszug.css"> |
---|
| 31 | <link rel="shortcut icon" type="image/x-icon" href="ico/Gericht.ico"> |
---|
| 32 | </head> |
---|
| 33 | <body> |
---|
| 34 | |
---|
| 35 | <?php |
---|
| 36 | $con = pg_connect("host=".$dbhost." port=" .$dbport." dbname=".$dbname." user=".$dbuser." password=".$dbpass); |
---|
| 37 | if (!$con) echo "<p class='err'>Fehler beim Verbinden der DB</p>\n"; |
---|
| 38 | |
---|
| 39 | // wie View "baurecht" |
---|
| 40 | $sql ="SELECT r.ogc_fid, r.artderfestlegung as adfkey, r.name, r.stelle, r.bezeichnung AS rechtbez, a.bezeichner AS adfbez, d.bezeichnung AS stellbez, d.stellenart, round(st_area(r.wkb_geometry)::numeric,0) AS flae |
---|
| 41 | FROM ax_bauraumoderbodenordnungsrecht r |
---|
[339] | 42 | LEFT JOIN v_baurecht_adf a ON r.artderfestlegung=a.wert |
---|
[334] | 43 | LEFT JOIN ax_dienststelle d ON r.land=d.land AND r.stelle=d.stelle WHERE r.gml_id= $1 AND r.endet IS NULL AND d.endet IS NULL;"; |
---|
[330] | 44 | |
---|
| 45 | $v = array($gmlid); |
---|
| 46 | $res = pg_prepare("", $sql); |
---|
| 47 | $res = pg_execute("", $v); |
---|
| 48 | |
---|
| 49 | if (!$res) { |
---|
| 50 | echo "\n<p class='err'>Fehler bei Baurecht.</p>\n"; |
---|
| 51 | if ($debug > 2) {echo "<p class='err'>SQL=<br>".$sql."<br>$1 = ".$gmlid."</p>\n";} |
---|
[287] | 52 | } |
---|
| 53 | |
---|
[330] | 54 | if ($row = pg_fetch_array($res)) { |
---|
[287] | 55 | $artfest=$row["adfkey"]; // Art der Festlegung, Key |
---|
| 56 | $verfnr=$row["rechtbez"]; // Verfahrens-Nummer |
---|
[288] | 57 | $enam=$row["name"]; |
---|
| 58 | $stellk=$row["stelle"]; // LEFT JOIN ! |
---|
| 59 | $stellb=$row["stellbez"]; |
---|
| 60 | $stella=$row["stellenart"]; |
---|
[287] | 61 | |
---|
[330] | 62 | // Balken |
---|
| 63 | echo "<p class='recht'>ALKIS Bau-, Raum- oder Bodenordnungsrecht ".$artfest."-".$verfnr." </p>\n"; |
---|
[287] | 64 | |
---|
[330] | 65 | echo "\n<h2><img src='ico/Gericht.ico' width='16' height='16' alt=''> Bau-, Raum- oder Bodenordnungsrecht</h2>\n"; |
---|
[287] | 66 | |
---|
[330] | 67 | echo "\n<table>"; |
---|
| 68 | |
---|
| 69 | echo "\n<tr>"; |
---|
[287] | 70 | echo "\n\t<td class='li'>Art der Festlegung:</td>\n\t<td>"; |
---|
| 71 | if ($showkey) { |
---|
| 72 | echo "<span class='key'>(".$artfest.")</span> "; |
---|
[330] | 73 | } |
---|
| 74 | echo "<span class='wichtig'>".$row["adfbez"]."</span></td>"; |
---|
| 75 | echo "\n</tr>"; |
---|
[287] | 76 | |
---|
[330] | 77 | if ($enam != "") { |
---|
| 78 | echo "\n<tr>"; |
---|
| 79 | echo "\n\t<td class='li'>Eigenname des Gebietes:</td>\n\t<td>".$enam."</td>"; |
---|
| 80 | echo "\n</tr>"; |
---|
| 81 | } |
---|
| 82 | |
---|
[288] | 83 | if ($verfnr != "") { |
---|
[330] | 84 | echo "\n<tr>"; |
---|
| 85 | echo "\n\t<td class='li'>Verfahrensnummer:</td>"; |
---|
[288] | 86 | echo "\n\t<td>".$verfnr."</td>"; |
---|
[330] | 87 | // if ($idanzeige) {linkgml($gkz, $gmlid, "Verfahren", ""); } // KEINE Bez.! |
---|
| 88 | echo "\n</tr>"; |
---|
[288] | 89 | } |
---|
| 90 | |
---|
[330] | 91 | if ($stellb != "") { // z.B. Umlegung mit und Baulast ohne Dienststelle |
---|
| 92 | echo "\n<tr>"; |
---|
[287] | 93 | echo "\n\t<td class='li'>Dienststelle:</td>\n\t<td>"; |
---|
| 94 | if ($showkey) {echo "<span class='key'>(".$stellk.")</span> ";} |
---|
| 95 | echo $stellb; |
---|
[330] | 96 | echo "</td>"; |
---|
[287] | 97 | echo "\n</tr>"; |
---|
| 98 | if ($stella != "") { |
---|
[330] | 99 | echo "\n<tr>"; |
---|
[287] | 100 | echo "\n\t<td class='li'>Art der Dienststelle:</td>"; |
---|
| 101 | echo "\n\t<td>"; |
---|
| 102 | if ($showkey) {echo " <span class='key'>(".$stella.")</span>";} |
---|
| 103 | // d.stellenart -- weiter entschluesseln 1000, 1200, 1300 |
---|
| 104 | // Dazu SchlÃŒsseltabelle aus GeoInfoDok erfassen |
---|
| 105 | echo " "; // Platzhalter |
---|
[330] | 106 | echo "</td>"; |
---|
[287] | 107 | echo "\n</tr>"; |
---|
| 108 | } |
---|
[330] | 109 | } |
---|
[287] | 110 | |
---|
[330] | 111 | echo "\n<tr>"; |
---|
| 112 | echo "\n\t<td class='li'>Fläche:</td>"; |
---|
| 113 | $flae=number_format($row["flae"],0,",",".")." m²"; |
---|
| 114 | echo "\n\t<td>".$flae."</td>"; |
---|
| 115 | echo "\n</tr>"; |
---|
[287] | 116 | |
---|
[330] | 117 | echo "\n</table>"; |
---|
| 118 | } else { |
---|
| 119 | echo "\n<p class='err'>Fehler! Kein Treffer bei gml_id=".$gmlid."</p>"; |
---|
| 120 | } |
---|
| 121 | |
---|
| 122 | echo "\n<h2><img src='ico/Flurstueck.ico' width='16' height='16' alt=''> betroffene Flurstücke</h2>\n"; |
---|
| 123 | echo "\n<p>Ermittelt durch geometrische Verschneidung. Nach Größe absteigend.</p>"; |
---|
| 124 | |
---|
| 125 | $sql ="SELECT f.gml_id, f.flurnummer, f.zaehler, f.nenner, f.amtlicheflaeche, round(st_area(ST_Intersection(r.wkb_geometry,f.wkb_geometry))::numeric,1) AS schnittflae |
---|
| 126 | FROM ax_flurstueck f, ax_bauraumoderbodenordnungsrecht r |
---|
[334] | 127 | WHERE r.gml_id= $1 AND f.endet IS NULL AND r.endet IS NULL |
---|
| 128 | AND st_intersects(r.wkb_geometry,f.wkb_geometry) = true |
---|
[330] | 129 | AND st_area(st_intersection(r.wkb_geometry,f.wkb_geometry)) > 0.05 |
---|
| 130 | ORDER BY schnittflae DESC LIMIT 40;"; |
---|
| 131 | // > 0.0 ist gemeint, Ungenauigkeit durch st_simplify |
---|
| 132 | // Limit: Flurbereinig. kann gross werden! |
---|
| 133 | // Trotz Limit lange Antwortzeit, wegen OrderBy -> intersection |
---|
| 134 | $v = array($gmlid); |
---|
| 135 | $res = pg_prepare("", $sql); |
---|
| 136 | $res = pg_execute("", $v); |
---|
| 137 | |
---|
| 138 | if (!$res) { |
---|
| 139 | echo "\n<p class='err'>Keine Flurstücke ermittelt.<br>\nSQL=<br></p>\n"; |
---|
| 140 | if ($debug > 2) {echo "<p class='err'>SQL=<br>".$sql."<br>$1 = ".$gmlid."</p>\n";} |
---|
| 141 | } |
---|
| 142 | |
---|
| 143 | echo "\n<table class='fs'>"; |
---|
| 144 | echo "\n<tr>"; // Header |
---|
| 145 | echo "\n\t<td class='head' title='Flur- und Flurstücksnummer'>Flurstück</td>"; |
---|
| 146 | echo "\n\t<td class='head fla' title='geometrische Schnittfläche'>Fläche</td>"; |
---|
| 147 | echo "\n\t<td class='head fla' title='amtliche Flurstücksfläche, Buchfläche'>von</td>"; |
---|
| 148 | echo "\n\t<td class='head nwlink' title='Link zum Flurstück'>weitere Auskunft</td>"; |
---|
| 149 | echo "\n</tr>"; |
---|
| 150 | |
---|
| 151 | $fscnt=0; |
---|
| 152 | while($row = pg_fetch_array($res)) { |
---|
| 153 | $fscnt++; |
---|
| 154 | echo "\n<tr>"; |
---|
| 155 | echo "\n\t<td>".$row["flurnummer"]."-<span class='wichtig'>".$row["zaehler"]; |
---|
| 156 | $nen=$row["nenner"]; |
---|
| 157 | if ($nen != "") { |
---|
| 158 | echo "/".$nen; |
---|
| 159 | } |
---|
| 160 | echo "</span></td>"; |
---|
| 161 | echo "\n\t<td class='fla'>".$row["schnittflae"]." m²</td>"; |
---|
| 162 | echo "\n\t<td class='fla'>".$row["amtlicheflaeche"]." m²</td>"; |
---|
| 163 | echo "\n\t<td class='nwlink noprint'>"; |
---|
| 164 | echo "\n\t\t<a href='alkisfsnw.php?gkz=".$gkz."&gmlid=".$row["gml_id"]."&eig=n' " ; |
---|
| 165 | echo "title='Flurstücksnachweis'>Flurstück "; |
---|
| 166 | echo "\n\t\t\t<img src='ico/Flurstueck_Link.ico' width='16' height='16' alt=''>"; |
---|
| 167 | echo "\n\t\t</a>"; |
---|
| 168 | echo "\n\t</td>"; |
---|
| 169 | echo "\n</tr>"; |
---|
| 170 | } |
---|
| 171 | echo "\n</table>"; |
---|
| 172 | |
---|
| 173 | if ($fscnt == 40) { |
---|
| 174 | echo "<p>... und weitere Flurstücke (Limit 40 erreicht).</p>"; |
---|
| 175 | } |
---|
| 176 | |
---|
| 177 | pg_close($con); |
---|
| 178 | echo <<<END |
---|
| 179 | |
---|
| 180 | <form action=''> |
---|
| 181 | <div class='buttonbereich noprint'> |
---|
[287] | 182 | <hr> |
---|
| 183 | <a title="zurück" href='javascript:history.back()'><img src="ico/zurueck.ico" width="16" height="16" alt="zurück" /></a> |
---|
| 184 | <a title="Drucken" href='javascript:window.print()'><img src="ico/print.ico" width="16" height="16" alt="Drucken" /></a> |
---|
[330] | 185 | </div> |
---|
| 186 | </form> |
---|
| 187 | END; |
---|
[287] | 188 | |
---|
| 189 | footer($gmlid, $_SERVER['PHP_SELF']."?", ""); |
---|
[330] | 190 | |
---|
| 191 | ?> |
---|
| 192 | |
---|
| 193 | </body> |
---|
| 194 | </html> |
---|