source: trunk/info/info/alkis/alkisbaurecht.php @ 330

Revision 330, 6.9 KB checked in by frank.jaeger, 10 years ago (diff)

Umstellung von PostNAS 0.7 auf PostNAS 0.8, ohne Tabelle "alkis_beziehungen".

RevLine 
[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)
7        2014-09-10 PostNAS 0.8: ohne Tab. "alkis_beziehungen", mehr "endet IS NULL", Spalten varchar statt integer
8
9        ToDo: id-Anzeige hinzufÃŒgen fÃŒr Baurecht und FlurstÃŒck
10*/
[287]11session_start();
[330]12$cntget = extract($_GET);
13require_once("alkis_conf_location.php");
14if ($auth == "mapbender") {require_once($mapbender);}
[287]15include("alkisfkt.php"); // f. Footer
[330]16if ($id == "j") {$idanzeige=true;} else {$idanzeige=false;}
17$keys = isset($_GET["showkey"]) ? $_GET["showkey"] : "n";
[287]18if ($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);
37if (!$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
41FROM ax_bauraumoderbodenordnungsrecht r
42LEFT JOIN ax_bauraumoderbodenordnungsrecht_artderfestlegung a ON r.artderfestlegung=a.wert
43LEFT JOIN ax_dienststelle d ON r.land=d.land AND r.stelle=d.stelle WHERE r.gml_id= $1 ;";
44
45$v = array($gmlid);
46$res = pg_prepare("", $sql);
47$res = pg_execute("", $v);
48
49if (!$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]54if ($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."&nbsp;</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 "&nbsp;"; // 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&auml;che:</td>";
113                        $flae=number_format($row["flae"],0,",",".")." m&#178;";
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
122echo "\n<h2><img src='ico/Flurstueck.ico' width='16' height='16' alt=''> betroffene Flurst&uuml;cke</h2>\n";
123echo "\n<p>Ermittelt durch geometrische Verschneidung. Nach Gr&ouml;&szlig;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
126FROM ax_flurstueck f, ax_bauraumoderbodenordnungsrecht r
127WHERE r.gml_id= $1 AND st_intersects(r.wkb_geometry,f.wkb_geometry) = true
128AND st_area(st_intersection(r.wkb_geometry,f.wkb_geometry)) > 0.05
129ORDER BY schnittflae DESC LIMIT 40;";
130// > 0.0 ist gemeint, Ungenauigkeit durch st_simplify
131// Limit: Flurbereinig. kann gross werden!
132// Trotz Limit lange Antwortzeit, wegen OrderBy -> intersection
133$v = array($gmlid);
134$res = pg_prepare("", $sql);
135$res = pg_execute("", $v);
136
137if (!$res) {
138        echo "\n<p class='err'>Keine Flurst&uuml;cke ermittelt.<br>\nSQL=<br></p>\n";
139        if ($debug > 2) {echo "<p class='err'>SQL=<br>".$sql."<br>$1 = ".$gmlid."</p>\n";}
140}
141
142echo "\n<table class='fs'>";
143        echo "\n<tr>"; // Header
144                echo "\n\t<td class='head' title='Flur- und Flurst&uuml;cksnummer'>Flurst&uuml;ck</td>";
145                echo "\n\t<td class='head fla' title='geometrische Schnittfl&auml;che'>Fl&auml;che</td>";
146                echo "\n\t<td class='head fla' title='amtliche Flurst&uuml;cksfl&auml;che, Buchfl&auml;che'>von</td>";
147                echo "\n\t<td class='head nwlink' title='Link zum Flurst&uuml;ck'>weitere Auskunft</td>";
148        echo "\n</tr>";
149
150        $fscnt=0;
151        while($row = pg_fetch_array($res)) {
152                $fscnt++;
153                echo "\n<tr>";
154                        echo "\n\t<td>".$row["flurnummer"]."-<span class='wichtig'>".$row["zaehler"];
155                        $nen=$row["nenner"];
156                        if ($nen != "") {
157                                echo "/".$nen;
158                        }
159                        echo "</span></td>";
160                        echo "\n\t<td class='fla'>".$row["schnittflae"]." m&#178;</td>";
161                        echo "\n\t<td class='fla'>".$row["amtlicheflaeche"]." m&#178;</td>";
162                        echo "\n\t<td class='nwlink noprint'>";
163                                echo "\n\t\t<a href='alkisfsnw.php?gkz=".$gkz."&amp;gmlid=".$row["gml_id"]."&amp;eig=n' " ;
164                                        echo "title='Flurst&uuml;cksnachweis'>Flurst&uuml;ck ";
165                                        echo "\n\t\t\t<img src='ico/Flurstueck_Link.ico' width='16' height='16' alt=''>";
166                                echo "\n\t\t</a>";
167                        echo "\n\t</td>";
168                echo "\n</tr>";
169        }
170echo "\n</table>";
171
172if ($fscnt == 40) {
173        echo "<p>... und weitere Flurst&uuml;cke (Limit 40 erreicht).</p>";
174}
175
176pg_close($con);
177echo <<<END
178
179<form action=''>
180        <div class='buttonbereich noprint'>
[287]181        <hr>
182                <a title="zur&uuml;ck" href='javascript:history.back()'><img src="ico/zurueck.ico" width="16" height="16" alt="zur&uuml;ck" /></a>&nbsp;
183                <a title="Drucken" href='javascript:window.print()'><img src="ico/print.ico" width="16" height="16" alt="Drucken" /></a>&nbsp;
[330]184        </div>
185</form>
186END;
[287]187
188footer($gmlid, $_SERVER['PHP_SELF']."?", "");
[330]189
190?>
191
192</body>
193</html>
Note: See TracBrowser for help on using the repository browser.