[49] | 1 | <?php
|
---|
| 2 | /* alkisinlaybaurecht.php - Inlay fuer Template: Baurecht
|
---|
| 3 | ALKIS-Buchauskunft, Kommunales Rechenzentrum Minden-Ravensberg/Lippe (Lemgo).
|
---|
| 4 |
|
---|
[105] | 5 | Version:
|
---|
| 6 | 17.12.2010 Astrid Emde: Prepared Statements (pg_query -> pg_prepare + pg_execute) |
---|
| 7 | 26.07.2011 debug
|
---|
[49] | 8 | */
|
---|
| 9 | ini_set('error_reporting', 'E_ALL & ~ E_NOTICE');
|
---|
| 10 | session_start();
|
---|
[60] | 11 | $gkz=urldecode($_REQUEST["gkz"]); |
---|
| 12 | require_once("alkis_conf_location.php"); |
---|
[49] | 13 | if ($auth == "mapbender") {
|
---|
| 14 | require_once($mapbender);
|
---|
| 15 | } |
---|
| 16 | ?>
|
---|
| 17 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
---|
| 18 | <html>
|
---|
| 19 | <head>
|
---|
| 20 | <meta name="author" content="F. Jaeger krz" >
|
---|
| 21 | <meta http-equiv="cache-control" content="no-cache">
|
---|
| 22 | <meta http-equiv="pragma" content="no-cache">
|
---|
| 23 | <meta http-equiv="expires" content="0">
|
---|
| 24 | <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
---|
| 25 | <title>ALKIS Bau-, Raum- oder Bodenordnungsrecht</title>
|
---|
| 26 | <link rel="stylesheet" type="text/css" href="alkisauszug.css"> |
---|
[53] | 27 | <link rel="shortcut icon" type="image/x-icon" href="ico/Gericht.ico"> |
---|
| 28 | <base target="_blank">
|
---|
[49] | 29 | </head>
|
---|
| 30 | <body> |
---|
| 31 |
|
---|
| 32 | <?php
|
---|
| 33 | $gmlid=urldecode($_REQUEST["gmlid"]); |
---|
| 34 | $con = pg_connect("host=".$dbhost." port=" .$dbport." dbname=".$dbname." user=".$dbuser." password=".$dbpass);
|
---|
[60] | 35 | if (!$con) echo "<p class='err'>Fehler beim Verbinden der DB</p>\n"; |
---|
[105] | 36 | if ($debug > 1) {echo "<p class='err'>DB=".$dbname.", user=".$dbuser."</p>";} |
---|
[60] | 37 | |
---|
[49] | 38 | // wie View "baurecht" |
---|
| 39 | $sql ="SELECT r.ogc_fid, r.artderfestlegung as adfkey, r.name, r.stelle, r.bezeichnung AS rechtbez, "; |
---|
| 40 | $sql.="a.bezeichner AS adfbez, d.bezeichnung AS stellbez, d.stellenart, "; |
---|
| 41 | $sql.="round(st_area(r.wkb_geometry)::numeric,0) AS flae "; |
---|
| 42 | $sql.="FROM ax_bauraumoderbodenordnungsrecht r "; |
---|
| 43 | $sql.="LEFT JOIN ax_bauraumoderbodenordnungsrecht_artderfestlegung a ON r.artderfestlegung = a.wert "; |
---|
| 44 | $sql.="LEFT JOIN ax_dienststelle d ON r.land = d.land AND r.stelle = d.stelle "; |
---|
[105] | 45 | $sql.="WHERE r.gml_id= $1 ;"; |
---|
[61] | 46 |
|
---|
| 47 | $v = array($gmlid);
|
---|
| 48 | $res = pg_prepare("", $sql);
|
---|
| 49 | $res = pg_execute("", $v); |
---|
| 50 |
|
---|
[49] | 51 | if (!$res) { |
---|
[105] | 52 | echo "\n<p class='err'>Fehler bei Baurecht.</p>\n"; |
---|
| 53 | if ($debug > 2) {echo "<p class='err'>SQL=<br>".$sql."<br>$1 = ".$gmlid."</p>\n";} |
---|
[49] | 54 | }
|
---|
| 55 | echo "\n<h2><img src='ico/Gericht.ico' width='16' height='16' alt=''> Bau-, Raum- oder Bodenordnungsrecht</h2>\n"; |
---|
| 56 | |
---|
| 57 | if ($row = pg_fetch_array($res)) {
|
---|
| 58 | echo "\n<table>"; |
---|
| 59 | |
---|
| 60 | echo "\n<tr>";
|
---|
| 61 | echo "\n\t<td class='li'>Art der Festlegung:</td>\n\t<td><span class='key'>(".$row["adfkey"].")</span> "; |
---|
| 62 | echo "<span class='wichtig'>".$row["adfbez"]."</span></td>";
|
---|
| 63 | echo "\n</tr>"; |
---|
| 64 | |
---|
| 65 | $enam=$row["name"]; |
---|
| 66 | if ($enam != "") {
|
---|
[64] | 67 | echo "\n<tr>";
|
---|
[49] | 68 | echo "\n\t<td class='li'>Eigenname des Gebietes:</td>\n\t<td>".$enam."</td>";
|
---|
| 69 | echo "\n</tr>"; |
---|
[64] | 70 | }
|
---|
[49] | 71 | echo "\n<tr>";
|
---|
| 72 | echo "\n\t<td class='li'>Verfahrensnummer:</td>";
|
---|
| 73 | echo "\n\t<td>".$row["rechtbez"]."</td>";
|
---|
| 74 | echo "\n</tr>"; |
---|
| 75 |
|
---|
| 76 | $stell=$row["stelle"]; |
---|
| 77 | if ($stell != "") { |
---|
| 78 | echo "\n<tr>"; |
---|
| 79 | echo "\n\t<td class='li'>Dienststelle:</td>\n\t<td><span class='key'>(".$stell.")</span> ".$row["stellbez"]; |
---|
| 80 | $stellart=$row["stellenart"]; |
---|
| 81 | if ($stellart != "") { |
---|
| 82 | echo " (".$stellart.")"; // d.stellenart -- weiter entschluesseln |
---|
[64] | 83 | }
|
---|
[49] | 84 | echo "</td>";
|
---|
| 85 | echo "\n</tr>"; |
---|
| 86 | } |
---|
| 87 | |
---|
| 88 | echo "\n<tr>";
|
---|
| 89 | echo "\n\t<td class='li'>Fläche:</td>"; |
---|
| 90 | $flae=number_format($row["flae"],0,",",".")." m²";
|
---|
| 91 | echo "\n\t<td>".$flae."</td>";
|
---|
| 92 | echo "\n</tr>"; |
---|
| 93 | |
---|
| 94 | echo "\n</table>"; |
---|
| 95 | } else { |
---|
| 96 | echo "\n<p class='err'>Fehler! Kein Treffer bei gml_id=".$gmlid."</p>"; |
---|
| 97 | } |
---|
| 98 | |
---|
| 99 | echo "\n<h2><img src='ico/Flurstueck.ico' width='16' height='16' alt=''> betroffene Flurstücke</h2>\n"; |
---|
| 100 | echo "\n<p>Ermittelt durch geometrische Verschneidung. Nach Größe absteigend.</p>"; |
---|
[53] | 101 | |
---|
[49] | 102 | $sql ="SELECT f.gml_id, f.flurnummer, f.zaehler, f.nenner, f.amtlicheflaeche, ";
|
---|
| 103 | $sql.="round(st_area(ST_Intersection(r.wkb_geometry,f.wkb_geometry))::numeric,1) AS schnittflae "; |
---|
| 104 | $sql.="FROM ax_flurstueck f, ax_bauraumoderbodenordnungsrecht r ";
|
---|
[61] | 105 | $sql.="WHERE r.gml_id= $1 "; |
---|
[49] | 106 | $sql.="AND st_intersects(r.wkb_geometry,f.wkb_geometry) = true "; |
---|
[53] | 107 | $sql.="AND st_area(st_intersection(r.wkb_geometry,f.wkb_geometry)) > 0.05 "; // > 0.0 ist gemeint, Ungenauigkeit durch st_simplify |
---|
[49] | 108 | $sql.="ORDER BY schnittflae DESC "; |
---|
| 109 | // Limit: Flurbereinigungsgebiete koennen sehr gross werden! |
---|
| 110 | $sql.="LIMIT 40;"; |
---|
| 111 | // Trotz Limit lange Antwortzeit, wegen OrderBy -> intersection |
---|
[61] | 112 | $v = array($gmlid);
|
---|
| 113 | $res = pg_prepare("", $sql);
|
---|
| 114 | $res = pg_execute("", $v); |
---|
| 115 |
|
---|
[49] | 116 | if (!$res) { |
---|
| 117 | echo "\n<p class='err'>Keine Flurstücke ermittelt.<br>\nSQL=<br></p>\n"; |
---|
| 118 | echo "\n<p class='err'>".$sql."</p>\n"; |
---|
| 119 | }
|
---|
| 120 |
|
---|
| 121 | echo "\n<table class='fs'>"; |
---|
| 122 | echo "\n<tr>"; // Header |
---|
| 123 | echo "\n\t<td class='head' title='Flur- und Flurstücksnummer'>Flurstück</td>";
|
---|
| 124 | echo "\n\t<td class='head fla' title='geometrische Schnittfläche'>Fläche</td>";
|
---|
| 125 | echo "\n\t<td class='head fla' title='amtliche Flurstücksfläche, Buchfläche'>von</td>";
|
---|
| 126 | echo "\n\t<td class='head nwlink' title='Link zum Flurstück'>weitere Auskunft</td>"; |
---|
| 127 | echo "\n</tr>";
|
---|
| 128 | |
---|
| 129 | $fscnt=0; |
---|
[64] | 130 | while($row = pg_fetch_array($res)) { |
---|
| 131 | $fscnt++;
|
---|
[49] | 132 | echo "\n<tr>";
|
---|
| 133 | echo "\n\t<td>".$row["flurnummer"]."-<span class='wichtig'>".$row["zaehler"]; |
---|
| 134 | $nen=$row["nenner"]; |
---|
| 135 | if ($nen != "") { |
---|
| 136 | echo "/".$nen; |
---|
| 137 | } |
---|
| 138 | echo "</span></td>"; |
---|
| 139 | echo "\n\t<td class='fla'>".$row["schnittflae"]." m²</td>";
|
---|
| 140 | echo "\n\t<td class='fla'>".$row["amtlicheflaeche"]." m²</td>"; |
---|
| 141 | echo "\n\t<td class='nwlink noprint'>"; |
---|
| 142 | echo "\n\t\t<a target='_blank' href='alkisfsnw.php?gkz=".$gkz."&gmlid=".$row["gml_id"]."&eig=n";
echo "' title='Flurstücksnachweis'>Flurstück "; |
---|
| 143 | echo "\n\t\t\t<img src='ico/Flurstueck_Link.ico' width='16' height='16' alt=''>"; |
---|
| 144 | echo "\n\t\t</a>"; |
---|
| 145 | echo "\n\t</td>"; |
---|
| 146 | echo "\n</tr>";
|
---|
| 147 | } |
---|
| 148 | echo "\n</table>";
|
---|
| 149 | |
---|
| 150 | if ($fscnt == 40) { |
---|
| 151 | echo "<p>... und weitere Flurstücke (Limit 40 erreicht).</0>"; |
---|
| 152 | } |
---|
| 153 |
|
---|
| 154 | ?>
|
---|
| 155 |
|
---|
| 156 | </body>
|
---|
| 157 | </html>
|
---|