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

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

Rückbau von "substring(gml_id)" in Views und Programmen.
Namensänderung von Schlüsseltabellen von ax_* auf v_*.

Line 
1<?php
2/*      alkisbaurecht.php - Baurecht
3        ALKIS-Buchauskunft, Kommunales Rechenzentrum Minden-Ravensberg/Lippe (Lemgo).
4
5        Version:
6        2013-06-27Neu als Variante von alkis*inlay*baurecht.ph (mit Footer, Balken und Umschaltung Key)
7        2014-09-15 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*/
11session_start();
12$cntget = extract($_GET);
13require_once("alkis_conf_location.php");
14if ($auth == "mapbender") {require_once($mapbender);}
15include("alkisfkt.php"); // f. Footer
16if ($id == "j") {$idanzeige=true;} else {$idanzeige=false;}
17$keys = isset($_GET["showkey"]) ? $_GET["showkey"] : "n";
18if ($keys == "j") {$showkey=true;} else {$showkey=false;}
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 v_baurecht_adf 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 AND r.endet IS NULL AND d.endet IS NULL;";
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";}
52}
53
54if ($row = pg_fetch_array($res)) {
55        $artfest=$row["adfkey"];  // Art der Festlegung, Key
56        $verfnr=$row["rechtbez"]; // Verfahrens-Nummer
57        $enam=$row["name"];
58        $stellk=$row["stelle"]; // LEFT JOIN !
59        $stellb=$row["stellbez"];
60        $stella=$row["stellenart"];
61
62        // Balken
63        echo "<p class='recht'>ALKIS Bau-, Raum- oder Bodenordnungsrecht ".$artfest."-".$verfnr."&nbsp;</p>\n";
64
65        echo "\n<h2><img src='ico/Gericht.ico' width='16' height='16' alt=''> Bau-, Raum- oder Bodenordnungsrecht</h2>\n";
66
67        echo "\n<table>";
68
69                echo "\n<tr>";
70                        echo "\n\t<td class='li'>Art der Festlegung:</td>\n\t<td>";
71                        if ($showkey) {
72                                echo "<span class='key'>(".$artfest.")</span> ";
73                        }
74                        echo "<span class='wichtig'>".$row["adfbez"]."</span></td>";
75                echo "\n</tr>";
76
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
83                if ($verfnr != "") {
84                        echo "\n<tr>";
85                                echo "\n\t<td class='li'>Verfahrensnummer:</td>";
86                                echo "\n\t<td>".$verfnr."</td>";
87                                // if ($idanzeige) {linkgml($gkz, $gmlid, "Verfahren", ""); } // KEINE Bez.!
88                        echo "\n</tr>";
89                }
90
91                if ($stellb != "") { // z.B. Umlegung mit und Baulast ohne Dienststelle
92                        echo "\n<tr>";
93                                echo "\n\t<td class='li'>Dienststelle:</td>\n\t<td>";
94                                        if ($showkey) {echo "<span class='key'>(".$stellk.")</span> ";}
95                                        echo $stellb;
96                                echo "</td>";
97                        echo "\n</tr>";
98                        if ($stella != "") {
99                                echo "\n<tr>";
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
106                                        echo "</td>";
107                                echo "\n</tr>";
108                        }
109                }
110
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>";
116
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 f.endet IS NULL AND r.endet IS NULL
128AND st_intersects(r.wkb_geometry,f.wkb_geometry) = true
129AND st_area(st_intersection(r.wkb_geometry,f.wkb_geometry)) > 0.05
130ORDER 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
138if (!$res) {
139        echo "\n<p class='err'>Keine Flurst&uuml;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
143echo "\n<table class='fs'>";
144        echo "\n<tr>"; // Header
145                echo "\n\t<td class='head' title='Flur- und Flurst&uuml;cksnummer'>Flurst&uuml;ck</td>";
146                echo "\n\t<td class='head fla' title='geometrische Schnittfl&auml;che'>Fl&auml;che</td>";
147                echo "\n\t<td class='head fla' title='amtliche Flurst&uuml;cksfl&auml;che, Buchfl&auml;che'>von</td>";
148                echo "\n\t<td class='head nwlink' title='Link zum Flurst&uuml;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&#178;</td>";
162                        echo "\n\t<td class='fla'>".$row["amtlicheflaeche"]." m&#178;</td>";
163                        echo "\n\t<td class='nwlink noprint'>";
164                                echo "\n\t\t<a href='alkisfsnw.php?gkz=".$gkz."&amp;gmlid=".$row["gml_id"]."&amp;eig=n' " ;
165                                        echo "title='Flurst&uuml;cksnachweis'>Flurst&uuml;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        }
171echo "\n</table>";
172
173if ($fscnt == 40) {
174        echo "<p>... und weitere Flurst&uuml;cke (Limit 40 erreicht).</p>";
175}
176
177pg_close($con);
178echo <<<END
179
180<form action=''>
181        <div class='buttonbereich noprint'>
182        <hr>
183                <a title="zur&uuml;ck" href='javascript:history.back()'><img src="ico/zurueck.ico" width="16" height="16" alt="zur&uuml;ck" /></a>&nbsp;
184                <a title="Drucken" href='javascript:window.print()'><img src="ico/print.ico" width="16" height="16" alt="Drucken" /></a>&nbsp;
185        </div>
186</form>
187END;
188
189footer($gmlid, $_SERVER['PHP_SELF']."?", "");
190
191?>
192
193</body>
194</html>
Note: See TracBrowser for help on using the repository browser.