Changeset 430 for trunk/info/info/alkisn/alkisgebaeudenw.php
- Timestamp:
- 07/07/22 08:51:44 (22 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/info/info/alkisn/alkisgebaeudenw.php
r427 r430 18 18 2022-01-13 Neue Functions LnkStf(), DsKy() 19 19 2022-02-17 Neue Bauwerks-Typen 20 2022-07-05 PHP 8.1: Connection verwenden bei "pg_prepare" und "pg_execute", keine NULL-Werte in String-Functions verwenden 20 21 */ 21 22 … … 108 109 ."WHERE f.gml_id= $1 AND f.endet IS NULL AND g.endet IS NULL;"; 109 110 $v=array($gmlid); 110 $resf=pg_prepare( "", $sqlf);111 $resf=pg_execute( "", $v);111 $resf=pg_prepare($con, "", $sqlf); 112 $resf=pg_execute($con, "", $v); 112 113 if (!$resf) { 113 114 echo "\n<p class='err'>Fehler bei Flurstücksdaten.</p>"; … … 169 170 170 171 // GebÀude 171 $sqlg ="SELECT g.gml_id, g.name, g.bauweise, g.gebaeudefunktion, h.beschreibung AS bauweise_beschreibung, u.beschreibung AS bezeichner, u.dokumentation AS gfktd, g.zustand, z.beschreibungAS bzustand,172 $sqlg ="SELECT g.gml_id, g.name, g.bauweise, g.gebaeudefunktion, coalesce(h.beschreibung, '') AS bauweise_beschreibung, u.beschreibung AS bezeichner, u.dokumentation AS gfktd, g.zustand, coalesce(z.beschreibung, '') AS bzustand, 172 173 round(st_area(g.wkb_geometry)::numeric,2) AS gebflae, "; // GEB-FlÀche, auch ausserhalb des FS 173 174 $sqlg.="round(st_area(ST_Intersection(g.wkb_geometry,f.wkb_geometry))::numeric,2) AS schnittflae, "; // wie viel vom GEB liegt im FS? … … 186 187 187 188 $v=array($gmlid); 188 $resg=pg_prepare( "", $sqlg);189 $resg=pg_execute( "", $v);189 $resg=pg_prepare($con, "", $sqlg); 190 $resg=pg_execute($con, "", $v); 190 191 if (!$resg) { 191 192 echo "\n<p class='err'>Fehler bei Gebäude-Verschneidung.</p>"; … … 200 201 $ggml=$rowg["gml_id"]; 201 202 $gebflsum=$gebflsum + $rowg["schnittflae"]; 202 $gnam=trim(trim($rowg["name"], "{}"), '"'); // GebÀude-Name ist ein Array in der DB: '{"A","B"}' 203 if (is_null($rowg["name"])) { 204 $gnam=""; 205 } else { 206 $gnam=trim(trim($rowg["name"], "{}"), '"'); // GebÀude-Name ist ein Array in der DB: '{"A","B"}' 207 } 203 208 // Mehrfachbelegung nur theoretisch. Entklammern reicht. Mal mit und mal ohne "" drum!? 204 209 $gfktk=htmlentities($rowg["gebaeudefunktion"], ENT_QUOTES, "UTF-8"); // Geb.-Funktion Key … … 263 268 $sqll.="ORDER BY bezeichnung, hausnummer, laufendenummer;"; 264 269 $v = array($ggml); 265 $resl = pg_prepare( "", $sqll);266 $resl = pg_execute( "", $v);270 $resl = pg_prepare($con, "", $sqll); 271 $resl = pg_execute($con, "", $v); 267 272 if (!$resl) { 268 273 echo "\n<p class='err'>Fehler bei Lage mit HsNr.</p>"; … … 439 444 440 445 $v=array($gmlid); 441 $resb=pg_prepare("", $sqlb); 442 $resb=pg_execute("", $v); 446 $resb=pg_prepare($con, "", $sqlb); 447 $resb=pg_execute($con, "", $v); 448 449 $baunr=0; // ZÀhler 450 $bauflsum=0; // FlÀchensumme 451 $gwbwtyp=0; // Gruppen-Wechsel Bauwerks-Typ 452 443 453 if (!$resb) { 444 454 echo "\n<p class='err'>Fehler bei Bauwerke-Verschneidung.</p>"; 445 455 if ($dbg > 2) {echo "\n<p class='err'>SQL=<br>".str_replace("$1","'".$gmlid."'",$sqlb)."</p>";} 446 456 if ($dbg > 1) {echo "<p class='dbg'>Fehler:".pg_result_error($resb)."</p>";} 447 } 448 $baunr=0; // ZÀhler 449 $bauflsum=0; // FlÀchensumme 450 $gwbwtyp=0; // Gruppen-Wechsel Bauwerks-Typ 451 452 while($rowb = pg_fetch_assoc($resb)) { 453 $baunr++; 454 $btyp=$rowb["bwtyp"]; // Tabelle 455 $bgml=$rowb["gml_id"]; 456 $bauflsum=$bauflsum + $rowb["schnittflae"]; 457 $bbez=htmlentities($rowb["bezeichnung"], ENT_QUOTES, "UTF-8"); 458 459 $bfktk=htmlentities($rowb["bauwerksfunktion"], ENT_QUOTES, "UTF-8"); 460 $bfktv=htmlentities($rowb["beschreibung"], ENT_QUOTES, "UTF-8"); 461 $bfktd=htmlentities($rowb["dokumentation"], ENT_QUOTES, "UTF-8"); 462 463 $bnam=htmlentities($rowb["name"], ENT_QUOTES, "UTF-8"); 464 $bgeb=$rowb["gehoertzu"]; 465 $drin=$rowb["drin"]; 466 $bgeotyp=$rowb["bgeotyp"]; 467 468 // Lage des Bauwerks zum FlurstÃŒck 469 if ($bgeotyp === "LINESTRING") { 470 if ($drin === "t") { 471 $bstyle="gin"; 457 } else { 458 while($rowb = pg_fetch_assoc($resb)) { 459 $baunr++; 460 $btyp=$rowb["bwtyp"]; // Tabelle 461 $bgml=$rowb["gml_id"]; 462 $bauflsum=$bauflsum + $rowb["schnittflae"]; 463 if (is_null($rowb["bezeichnung"])) { 464 $bbez=""; 472 465 } else { 473 $b style="gtl";474 } 475 $ f1=" ";476 $ f2="Linie";477 } elseif ($bgeotyp === "POINT") {478 if ( $drin === "t") {479 $b style="gin";466 $bbez=htmlentities($rowb["bezeichnung"], ENT_QUOTES, "UTF-8"); 467 } 468 $bfktk=htmlentities($rowb["bauwerksfunktion"], ENT_QUOTES, "UTF-8"); 469 $bfktv=htmlentities($rowb["beschreibung"], ENT_QUOTES, "UTF-8"); 470 $bfktd=htmlentities($rowb["dokumentation"], ENT_QUOTES, "UTF-8"); 471 if (is_null($rowb["name"])) { 472 $bnam=""; 480 473 } else { 481 $bstyle="gtl"; 482 } 483 $f1=" "; 484 $f2="Punkt"; 485 } else { // FlÀche / Multi- 486 if ($drin === "t") { // komplett IM FlurstÃŒck 487 $f1=$rowb["schnittflae"]." m²"; 488 $f2=" "; 489 $bstyle="gin"; // siehe .css 490 } else { 491 if ($rowb["schnittflae"] === "0.00") { // nur angrenzend 492 $bstyle="gan"; 493 $f1=" "; 494 $f2="angrenzend"; 495 } else { // Teile auf FlurstÃŒck 474 $bnam=htmlentities($rowb["name"], ENT_QUOTES, "UTF-8"); 475 } 476 $bgeb=$rowb["gehoertzu"]; 477 $drin=$rowb["drin"]; 478 $bgeotyp=$rowb["bgeotyp"]; 479 480 // Lage des Bauwerks zum FlurstÃŒck 481 if ($bgeotyp === "LINESTRING") { 482 if ($drin === "t") { 483 $bstyle="gin"; 484 } else { 496 485 $bstyle="gtl"; 486 } 487 $f1=" "; 488 $f2="Linie"; 489 } elseif ($bgeotyp === "POINT") { 490 if ($drin === "t") { 491 $bstyle="gin"; 492 } else { 493 $bstyle="gtl"; 494 } 495 $f1=" "; 496 $f2="Punkt"; 497 } else { // FlÀche / Multi- 498 if ($drin === "t") { // komplett IM FlurstÃŒck 497 499 $f1=$rowb["schnittflae"]." m²"; 498 $f2="(von ".$rowb["gebflae"]." m²)"; 500 $f2=" "; 501 $bstyle="gin"; // siehe .css 502 } else { 503 if ($rowb["schnittflae"] === "0.00") { // nur angrenzend 504 $bstyle="gan"; 505 $f1=" "; 506 $f2="angrenzend"; 507 } else { // Teile auf FlurstÃŒck 508 $bstyle="gtl"; 509 $f1=$rowb["schnittflae"]." m²"; 510 $f2="(von ".$rowb["gebflae"]." m²)"; 511 } 512 } 513 } 514 515 // Gruppenwechsel Bauwerks-Typ (Quell-Tabelle) - Zwischen-Ãberschrift 516 If ($btyp != $gwbwtyp) { 517 $gwbwtyp = $btyp; 518 if ($baunr === 1) {bauw_tab_head();} // Tab.-Kopf 519 switch ($btyp) { 520 case $btyp_verkehr: 521 $btyptitle='Bauwerk im Verkehrsbereich'; break; 522 case $btyp_gewaesser: 523 $btyptitle='Bauwerk im Gewässerbereich'; break; 524 case $btyp_sonst: 525 $btyptitle='Sonstiges Bauwerk oder sonstige Einrichtung'; break; 526 case $btyp_indu: 527 $btyptitle="Bauwerk oder Anlage für Industrie und Gewerbe"; break; 528 case $btyp_sport: 529 $btyptitle="Bauwerk oder Anlage für Sport, Freizeit und Erholung"; break; 530 case $btyp_leitg: 531 $btyptitle="Leitung"; break; 532 case $btyp_trans: 533 $btyptitle="Transportanlage"; break; 534 case $btyp_turm: 535 $btyptitle="Turm"; break; 536 case $btyp_vorrat: 537 $btyptitle="Vorratsbehälter, Speicherbauwerk"; break; 538 case $btyp_hist: 539 $btyptitle="Historisches Bauwerk oder historische Einrichtung"; break; 540 case $btyp_heil: 541 $btyptitle="Heilquelle, Gasquelle"; break; 542 case $btyp_oeff: 543 $btyptitle="Einrichtung in öffentlichen Bereichen"; break; 544 case $btyp_bpkt: 545 $btyptitle="Besonderer Bauwerkspunkt"; break; 546 default: 547 $btyptitle='Fehler!'; break; 499 548 } 500 } 549 echo "<tr><td colspan=3></td><td colspan=2 class='gw'>".$btyptitle."</td></tr>"; // ++ Symbol? 550 } 551 552 echo "\n<tr>"; 553 echo "\n\t<td>"; 554 if ($bbez != "") {echo "<span title='Bezeichnung'>".$bbez."</span> ";} 555 if ($bnam != "") {echo "<span title='Name'>".$bnam."</span> ";} 556 echo "</td>"; 557 echo "\n\t<td class='fla'>".$f1."</td>" 558 ."\n\t<td class='".$bstyle."'>".$f2."</td>"; // FlÀchenangaben 559 echo "\n\t<td>".DsKy($bfktk, 'Bauwerksfunktion-*')."<span title='".$bfktd ."'>".$bfktv."</span></td>"; 560 561 // Lage / Haus (nur bei Typ 3 sonstige) 562 echo "\n\t<td class='nwlink noprint'>"; // Link 563 if ($bgeb != "") { // gehört zu GebÀude 564 // bw_gz_lage($bgeb); // Function: Lage (Adresse) ausgeben 565 echo "\n\t\t<a title='gehört zu' href='alkishaus.php?gkz=".$gkz."&gmlid=".$bgeb.LnkStf() 566 ."'>Haus <img src='ico/Haus.png' width='16' height='16' alt=''></a>"; 567 } 568 echo "\n\t</td>"; 569 570 // Bauwerk Details 571 echo "\n\t<td class='nwlink noprint'>" // Link 572 ."\n\t\t<a title='Bauwerksdaten' href='alkisbauwerk.php?gkz=".$gkz."&btyp=".$btyp."&gmlid=".$bgml.LnkStf() 573 ."'>Bauwerk <img src='ico/Haus.png' width='16' height='16' alt=''></a>" // Icon fÃŒr Bauwerk schaffen 574 ."\n\t</td>" 575 ."\n</tr>"; 501 576 } 502 577 503 // Gruppenwechsel Bauwerks-Typ (Quell-Tabelle) - Zwischen-Ãberschrift 504 If ($btyp != $gwbwtyp) { 505 $gwbwtyp = $btyp; 506 if ($baunr === 1) {bauw_tab_head();} // Tab.-Kopf 507 switch ($btyp) { 508 case $btyp_verkehr: 509 $btyptitle='Bauwerk im Verkehrsbereich'; break; 510 case $btyp_gewaesser: 511 $btyptitle='Bauwerk im Gewässerbereich'; break; 512 case $btyp_sonst: 513 $btyptitle='Sonstiges Bauwerk oder sonstige Einrichtung'; break; 514 case $btyp_indu: 515 $btyptitle="Bauwerk oder Anlage für Industrie und Gewerbe"; break; 516 case $btyp_sport: 517 $btyptitle="Bauwerk oder Anlage für Sport, Freizeit und Erholung"; break; 518 case $btyp_leitg: 519 $btyptitle="Leitung"; break; 520 case $btyp_trans: 521 $btyptitle="Transportanlage"; break; 522 case $btyp_turm: 523 $btyptitle="Turm"; break; 524 case $btyp_vorrat: 525 $btyptitle="Vorratsbehälter, Speicherbauwerk"; break; 526 case $btyp_hist: 527 $btyptitle="Historisches Bauwerk oder historische Einrichtung"; break; 528 case $btyp_heil: 529 $btyptitle="Heilquelle, Gasquelle"; break; 530 case $btyp_oeff: 531 $btyptitle="Einrichtung in öffentlichen Bereichen"; break; 532 case $btyp_bpkt: 533 $btyptitle="Besonderer Bauwerkspunkt"; break; 534 default: 535 $btyptitle='Fehler!'; break; 536 } 537 echo "<tr><td colspan=3></td><td colspan=2 class='gw'>".$btyptitle."</td></tr>"; // ++ Symbol? 578 // Footer Bauwerke 579 if ($baunr === 0) { 580 echo "\n<p>Kein Bauwerk auf diesem Flurstück.</p><br>"; 581 // if ($dbg > 2) {echo "\n<p class='err'>SQL=<br>".$sqlb."<br>$1 = gml_id = '".$gmlid."'</p>";} 582 } else { 583 echo "\n<tr>" 584 ."\n\t<td>Summe:</td>" 585 ."\n\t<td class='fla sum' title='von Bauwerken überbaute Fläche des Flurstücks'>".number_format($bauflsum,0,",",".")." m²</td>" 586 ."\n\t<td colspan='6'> </td>" 587 ."\n</tr>" 588 ."\n</table>\n"; 538 589 } 539 540 echo "\n<tr>"; 541 echo "\n\t<td>"; 542 if ($bbez != "") {echo "<span title='Bezeichnung'>".$bbez."</span> ";} 543 if ($bnam != "") {echo "<span title='Name'>".$bnam."</span> ";} 544 echo "</td>"; 545 echo "\n\t<td class='fla'>".$f1."</td>" 546 ."\n\t<td class='".$bstyle."'>".$f2."</td>"; // FlÀchenangaben 547 echo "\n\t<td>".DsKy($bfktk, 'Bauwerksfunktion-*')."<span title='".$bfktd ."'>".$bfktv."</span></td>"; 548 549 // Lage / Haus (nur bei Typ 3 sonstige) 550 echo "\n\t<td class='nwlink noprint'>"; // Link 551 if ($bgeb != "") { // gehört zu GebÀude 552 // bw_gz_lage($bgeb); // Function: Lage (Adresse) ausgeben 553 echo "\n\t\t<a title='gehört zu' href='alkishaus.php?gkz=".$gkz."&gmlid=".$bgeb.LnkStf() 554 ."'>Haus <img src='ico/Haus.png' width='16' height='16' alt=''></a>"; 555 } 556 echo "\n\t</td>"; 557 558 // Bauwerk Details 559 echo "\n\t<td class='nwlink noprint'>" // Link 560 ."\n\t\t<a title='Bauwerksdaten' href='alkisbauwerk.php?gkz=".$gkz."&btyp=".$btyp."&gmlid=".$bgml.LnkStf() 561 ."'>Bauwerk <img src='ico/Haus.png' width='16' height='16' alt=''></a>" // Icon fÃŒr Bauwerk schaffen 562 ."\n\t</td>" 563 ."\n</tr>"; 564 } 565 566 // Footer Bauwerk 567 if ($baunr === 0) { 568 echo "\n<p>Kein Bauwerk auf diesem Flurstück.</p><br>"; 569 // if ($dbg > 2) {echo "\n<p class='err'>SQL=<br>".$sqlb."<br>$1 = gml_id = '".$gmlid."'</p>";} 570 } else { 571 echo "\n<tr>" 572 ."\n\t<td>Summe:</td>" 573 ."\n\t<td class='fla sum' title='von Bauwerken überbaute Fläche des Flurstücks'>".number_format($bauflsum,0,",",".")." m²</td>" 574 ."\n\t<td colspan='6'> </td>" 575 ."\n</tr>" 576 ."\n</table>\n"; 577 } 578 pg_free_result($resb); 590 pg_free_result($resb); 591 } 579 592 580 593 echo "<div class='buttonbereich noprint'>\n<hr>"
Note: See TracChangeset
for help on using the changeset viewer.