source: trunk/var/www/info/alkis/alkisgebaeudenw.php @ 34

Revision 34, 5.8 KB checked in by hueben, 12 years ago (diff)
Line 
1<?php
2/*      alkisfsnw.php
3        ALKIS-Buchauskunft, Kommunales Rechenzentrum Minden-Ravensberg/Lippe (Lemgo).
4        Flurstücksnachweis fuer ein Flurstückskennzeichen aus ALKIS PostNAS
5        Parameter:      &gkz= &gmlid= &eig=j/n
6        Version:
7        26.01.2010      internet-Version  mit eigener conf
8
9        ToDo: NamNum >bestehtAusRechtsverhaeltnissenZu> NamNum
10
11*/
12ini_set('error_reporting', 'E_ALL & ~ E_NOTICE');
13session_start();
14// Bindung an Mapbender-Authentifizierung
15#require_once("/data/mapwww/http/php/mb_validateSession.php");
16#require_once("/data/conf/alkis_www_conf.php");
17
18#AE
19require_once(dirname(__FILE__)."/../../../php/mb_validateSession.php");
20require_once(dirname(__FILE__)."/../../../../conf/alkis_www_conf.php");
21
22include("alkisfkt.php");
23?>
24<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
25<html>
26<head>
27        <meta name="author" content="F. Jaeger">
28        <meta http-equiv="cache-control" content="no-cache">
29        <meta http-equiv="pragma" content="no-cache">
30        <meta http-equiv="expires" content="0">
31        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
32        <title>ALKIS Geb&auml;udenachweis</title>
33        <link rel="stylesheet" type="text/css" href="alkisauszug.css">
34        <style type='text/css' media='print'>
35                .noprint { visibility: hidden;}
36        </style>
37</head>
38<body>
39<?php
40$gkz=urldecode($_REQUEST["gkz"]);
41$gmlid=urldecode($_REQUEST["gmlid"]);
42$eig=urldecode($_REQUEST["eig"]);
43$id = isset($_GET["id"]) ? $_GET["id"] : "n";
44$idanzeige=false;
45if ($id == "j") {$idanzeige=true;}
46$style=isset($_GET["style"]) ? $_GET["style"] : "kompakt";
47$dbname = 'alkis05' . $gkz;
48$con = pg_connect("host=".$dbhost." port=" .$dbport." dbname=".$dbname." user=".$dbuser." password=".$dbpass);
49
50// Gebaeude
51$sql ="SELECT f.name, f.flurnummer, f.zaehler, f.nenner, f.amtlicheflaeche, f.zeitpunktderentstehung, ";
52$sql.="round(area(g.wkb_geometry)::numeric,2) as flaeche, g.description, g.bauweise, g.gebaeudefunktion, ";
53$sql.="h.bauweise_id, h.bauweise_beschreibung ";
54$sql.="FROM ax_flurstueck f, ax_gebaeude g LEFT JOIN ax_bauweise_gebaeude h ON g.bauweise = h.bauweise_id ";
55$sql.="WHERE f.gml_id='".$gmlid."' ";
56$sql.="and within(g.wkb_geometry,f.wkb_geometry) = true order by flaeche DESC;";
57
58// echo $sql;
59$res=pg_query($con,$sql);
60if (!$res) echo "\n<p class='err'>Fehler bei Flurstuecksdaten\n<br>".$sql."</p>\n";
61if ($row = pg_fetch_array($res)) {
62        $gemkname=htmlentities($row["bezeichnung"], ENT_QUOTES, "UTF-8");
63        #$gmkgnr=$row["gemarkungsnummer"];
64        $flurnummer=$row["flurnummer"];
65        $flstnummer=$row["zaehler"];
66        $nenner=$row["nenner"];
67        if ($nenner > 0) $flstnummer.="/".$nenner; // BruchNr
68        $flstflaeche = $row["amtlicheflaeche"] ;
69        $gesamtflaechegebaeude =  $row["flaeche"];
70        $flstflaeche_minus_gesamtflaechegebaeude = 0;
71       
72        while($row = pg_fetch_array($res)) {
73                $gesamtflaechegebaeude = $gesamtflaechegebaeude + $row["flaeche"];
74        }
75        $flstflaeche_minus_gesamtflaechegebaeude = number_format(($flstflaeche - $gesamtflaechegebaeude),0,",",".") . " m&#178;";
76        $flstflaeche = number_format($flstflaeche,0,",",".") . " m&#178;";
77        $gesamtflaechegebaeude =  number_format($gesamtflaechegebaeude,0,",",".") . " m&#178;";
78       
79} else {echo "Fehler! Kein Treffer fuer gml_id=".$gmlid;}
80if ($eig=="j") {
81        echo "<p class='fsei'>Flurst&uuml;ck ".$gmkgnr."-".$flurnummer."-".$flstnummer."&nbsp;</p>\n";
82        echo "\n<h2>ALKIS Geb&auml;udenachweis</h2>\n";
83}
84else {
85        echo "<p class='fskennz'>Flurst&uuml;ck ".$gmkgnr."-".$flurnummer."-".$flstnummer."&nbsp;</p>\n";
86        echo "\n<h2>ALKIS Flurst&uuml;cksnachweis</h2>\n";
87}
88echo "\n<table class='outer'>\n<tr>\n<td>";
89
90        echo "\n\t<table class='kennz' title='Flurst&uuml;ckskennzeichen'>\n\t<tr>";
91                echo "\n\t\t<td class='head'>Flur</td>\n\t\t<td class='head'>Flurst-Nr.</td>\n\t</tr>";
92                echo "\n\t\t<td title='Flurnummer'>".$flurnummer."</td>";
93                echo "\n\t\t<td title='Flurst&uuml;cksnummer (Z&auml;hler / Nenner)'>".$flstnummer."</td>\n\t</tr>";
94        echo "\n\t</table>\n";
95        echo "\n<p class='fsd'>Flurst&uuml;cksfl&auml;che: <b>".$flstflaeche."</b></p>\n";
96        echo "\n<p class='fsd'>Flurst&uuml;cksfl&auml;che abz&uuml;glich Geb&auml;udefl&auml;che: <b>".$flstflaeche_minus_gesamtflaechegebaeude."</b></p>\n";
97        echo "\n<p class='fsd'>Gesamtfl&auml;che Geb&auml;ude: <b>".$gesamtflaechegebaeude."</b></p>\n";
98       
99       
100echo "</td>\n<td>";
101
102echo "\n\t</td>\n</tr>\n</table>";
103// Ende Seitenkopf
104
105echo "\n<h2>Auflistung der Geb&auml;ude</h2>";
106
107        $res=pg_query($con,$sql);
108        if (!$res) echo "\n<p class='err'>Keine Geb&auml;ude.<br>\nSQL= ".$sql."</p>\n";
109        $gebnr=0;
110        echo "\n<hr>\n<table class='outer'>\n<tr>\n"; // link *neben* GB-Rahmen
111        echo "\n\t\t<td class='head'>Lfd. Nr.</td>";
112        echo "\n\t\t<td class='head'>Fl&auml;che</td>";
113        echo "\n\t\t<td class='head'>Geb&auml;udefunktion</td>";
114        echo "\n\t\t<td class='head'>Bauweise</td>";
115        echo "\n\t\t<td class='head'>Beschreibung</td>\n\t\t</tr>";
116        while($row = pg_fetch_array($res)) {
117                $gebnr = $gebnr + 1;
118                echo "\n\t<tr>";
119                echo "\n\t\t<td title='Nr'>".$gebnr."</td>";
120                echo "\n\t\t<td title='Fl&auml;che'>".$row["flaeche"]. " m&#178;". "</td>";
121                echo "\n\t\t<td title='Geb&auml;udefunktion'>".$row["gebaeudefunktion"]. "</td>";
122                echo "\n\t\t<td title='Bauweise'>".$row["bauweise_beschreibung"]. "</td>";
123                echo "\n\t\t<td title='Beschreibung'>".$row["description"]. "</td>";
124                echo "\n\t</tr>\n\t";
125        }
126        echo "</table>";
127?>
128
129<form action=''>
130        <div class='buttonbereich noprint'>
131        <hr>
132                <input type='button' name='back'  value='&lt;&lt;' title='Zur&uuml;ck'  onClick='javascript:history.back()'>&nbsp;
133                <input type='button' name='print' value='Druck' title='Seite Drucken' onClick='window.print()'>&nbsp;
134                <input type='button' name='close' value='X' title='Fenster schlie&szlig;en' onClick='window.close()'>
135        </div>
136</form>
137
138<?php footer($gkz, $gmlid, $idanzeige, $self, $hilfeurl,$style); ?>
139
140</body>
141</html>
Note: See TracBrowser for help on using the repository browser.