[49] | 1 | <?php
|
---|
| 2 | /* alkisinlaybaurecht.php - Inlay fuer Template: Baurecht
|
---|
| 3 | ALKIS-Buchauskunft, Kommunales Rechenzentrum Minden-Ravensberg/Lippe (Lemgo).
|
---|
| 4 |
|
---|
[105] | 5 | Version:
|
---|
[123] | 6 | 17.12.2010 Astrid Emde: Prepared Statements (pg_query -> pg_prepare + pg_execute)
|
---|
[105] | 7 | 26.07.2011 debug
|
---|
[49] | 8 | */
|
---|
| 9 | ini_set('error_reporting', 'E_ALL & ~ E_NOTICE');
|
---|
| 10 | session_start();
|
---|
[123] | 11 | $gkz=urldecode($_REQUEST["gkz"]);
|
---|
| 12 | require_once("alkis_conf_location.php");
|
---|
[49] | 13 | if ($auth == "mapbender") {
|
---|
| 14 | require_once($mapbender);
|
---|
[123] | 15 | }
|
---|
[49] | 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>
|
---|
[123] | 26 | <link rel="stylesheet" type="text/css" href="alkisauszug.css">
|
---|
| 27 | <link rel="shortcut icon" type="image/x-icon" href="ico/Gericht.ico">
|
---|
[53] | 28 | <base target="_blank">
|
---|
[49] | 29 | </head>
|
---|
[123] | 30 | <body>
|
---|
[49] | 31 |
|
---|
| 32 | <?php
|
---|
[123] | 33 | $gmlid=urldecode($_REQUEST["gmlid"]);
|
---|
[49] | 34 | $con = pg_connect("host=".$dbhost." port=" .$dbport." dbname=".$dbname." user=".$dbuser." password=".$dbpass);
|
---|
[123] | 35 | if (!$con) echo "<p class='err'>Fehler beim Verbinden der DB</p>\n";
|
---|
| 36 | if ($debug > 1) {echo "<p class='err'>DB=".$dbname.", user=".$dbuser."</p>";}
|
---|
[61] | 37 |
|
---|
[123] | 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 ";
|
---|
| 45 | $sql.="WHERE r.gml_id= $1 ;";
|
---|
| 46 |
|
---|
[61] | 47 | $v = array($gmlid);
|
---|
| 48 | $res = pg_prepare("", $sql);
|
---|
[123] | 49 | $res = pg_execute("", $v);
|
---|
[61] | 50 |
|
---|
[123] | 51 | if (!$res) {
|
---|
| 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 | }
|
---|
[123] | 55 | echo "\n<h2><img src='ico/Gericht.ico' width='16' height='16' alt=''> Bau-, Raum- oder Bodenordnungsrecht</h2>\n";
|
---|
| 56 |
|
---|
[49] | 57 | if ($row = pg_fetch_array($res)) {
|
---|
[123] | 58 | echo "\n<table>";
|
---|
| 59 |
|
---|
[49] | 60 | echo "\n<tr>";
|
---|
[123] | 61 | echo "\n\t<td class='li'>Art der Festlegung:</td>\n\t<td><span class='key'>(".$row["adfkey"].")</span> ";
|
---|
[49] | 62 | echo "<span class='wichtig'>".$row["adfbez"]."</span></td>";
|
---|
[123] | 63 | echo "\n</tr>";
|
---|
| 64 |
|
---|
| 65 | $enam=$row["name"];
|
---|
[49] | 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>";
|
---|
[123] | 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>";
|
---|
[123] | 74 | echo "\n</tr>";
|
---|
[49] | 75 |
|
---|
[123] | 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>";
|
---|
[123] | 85 | echo "\n</tr>";
|
---|
| 86 | }
|
---|
| 87 |
|
---|
[49] | 88 | echo "\n<tr>";
|
---|
[123] | 89 | echo "\n\t<td class='li'>Fläche:</td>";
|
---|
[49] | 90 | $flae=number_format($row["flae"],0,",",".")." m²";
|
---|
| 91 | echo "\n\t<td>".$flae."</td>";
|
---|
[123] | 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>";
|
---|
| 101 |
|
---|
[49] | 102 | $sql ="SELECT f.gml_id, f.flurnummer, f.zaehler, f.nenner, f.amtlicheflaeche, ";
|
---|
[123] | 103 | $sql.="round(st_area(ST_Intersection(r.wkb_geometry,f.wkb_geometry))::numeric,1) AS schnittflae ";
|
---|
[49] | 104 | $sql.="FROM ax_flurstueck f, ax_bauraumoderbodenordnungsrecht r ";
|
---|
[123] | 105 | $sql.="WHERE r.gml_id= $1 ";
|
---|
| 106 | $sql.="AND st_intersects(r.wkb_geometry,f.wkb_geometry) = true ";
|
---|
| 107 | $sql.="AND st_area(st_intersection(r.wkb_geometry,f.wkb_geometry)) > 0.05 "; // > 0.0 ist gemeint, Ungenauigkeit durch st_simplify
|
---|
| 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);
|
---|
[123] | 114 | $res = pg_execute("", $v);
|
---|
[61] | 115 |
|
---|
[123] | 116 | if (!$res) {
|
---|
| 117 | echo "\n<p class='err'>Keine Flurstücke ermittelt.<br>\nSQL=<br></p>\n";
|
---|
| 118 | if ($debug > 2) {echo "<p class='err'>SQL=<br>".$sql."<br>$1 = ".$gmlid."</p>\n";}
|
---|
[49] | 119 | }
|
---|
| 120 |
|
---|
[123] | 121 | echo "\n<table class='fs'>";
|
---|
| 122 | echo "\n<tr>"; // Header
|
---|
[49] | 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>";
|
---|
[123] | 126 | echo "\n\t<td class='head nwlink' title='Link zum Flurstück'>weitere Auskunft</td>";
|
---|
[49] | 127 | echo "\n</tr>";
|
---|
[123] | 128 |
|
---|
| 129 | $fscnt=0;
|
---|
| 130 | while($row = pg_fetch_array($res)) {
|
---|
[64] | 131 | $fscnt++;
|
---|
[49] | 132 | echo "\n<tr>";
|
---|
[123] | 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>";
|
---|
[49] | 139 | echo "\n\t<td class='fla'>".$row["schnittflae"]." m²</td>";
|
---|
[123] | 140 | echo "\n\t<td class='fla'>".$row["amtlicheflaeche"]." m²</td>";
|
---|
| 141 | echo "\n\t<td class='nwlink noprint'>";
|
---|
[49] | 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 ";
|
---|
[123] | 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>";
|
---|
[49] | 147 | }
|
---|
[123] | 148 | echo "\n</table>";
|
---|
[49] | 149 |
|
---|
| 150 | if ($fscnt == 40) {
|
---|
[123] | 151 | echo "<p>... und weitere Flurstücke (Limit 40 erreicht).</0>";
|
---|
| 152 | }
|
---|
| 153 |
|
---|
| 154 | ?>
|
---|
[49] | 155 |
|
---|
| 156 | </body>
|
---|
| 157 | </html>
|
---|