GIService 2 anni fa
parent
commit
435808a90a
  1. 1369
      bckmap.php
  2. 1471
      cataistanze.php
  3. 1490
      catamap.php
  4. 200
      catasearch.php
  5. 769
      catavincoli.php
  6. 657
      cdu_level.php
  7. 42
      cfg.php
  8. 25
      cfg_srv.php
  9. 7
      decrypt.php
  10. 1387
      detail.php
  11. 166
      draw.php
  12. 68
      encrypt.php
  13. 56
      error.php
  14. BIN
      favicon.ico
  15. 413
      index.php
  16. 29
      intro.php
  17. 236
      legenda.php
  18. 65
      load.php
  19. 50
      load2.php
  20. 458
      map_info.php
  21. BIN
      marker-icon-2x.png
  22. BIN
      marker-icon.png
  23. 27
      mc_footer2.php
  24. 28
      mc_header2.php
  25. 1341
      mobile_detect.php
  26. 54
      routine.php
  27. 359
      routine_feature.php
  28. 80
      routine_map.php
  29. 109
      routine_map_bckoffice.php
  30. 90
      routine_map_interventi.php
  31. 42
      routine_map_ricercageo.php
  32. 1671
      routine_rec.php

1369
bckmap.php

File diff soppresso perché troppo grande Load Diff

1471
cataistanze.php

File diff soppresso perché troppo grande Load Diff

1490
catamap.php

File diff soppresso perché troppo grande Load Diff

200
catasearch.php

@ -0,0 +1,200 @@
<?php include_once "cfg.php" ?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>CDU</title>
<link href="https://fonts.googleapis.com/css?family=Open+Sans:400,300,600,700&subset=all" rel="stylesheet" type="text/css"/>
<link href="assets/fontawesome/css/all.css" rel="stylesheet" type="text/css" />
<link href="assets/css/bootstrap-italia.min.css" rel="stylesheet">
<link href="https://cdn.jsdelivr.net/npm/docsearch.js@2/dist/cdn/docsearch.min.css" rel="stylesheet">
<link href="assets/css/docs.min.css" rel="stylesheet">
<script type="text/javascript" src="assets/js/jquery.min.js"></script>
<script type="text/javascript" src="assets/js/reCopy.js"></script>
<script type="text/javascript">
$(function(){
var removeLink = '&nbsp;&nbsp;<a class="remove" href="#" onclick="$(this).parent().slideUp(function(){ $(this).remove() }); return false"><b><i class="far fa-minus-square fa-lg"></i></b></a>';
$('a.add').relCopy({ append: removeLink});
});
</script>
<style>
html, body { width: 98%; height: 98%; margin: 2; align-self: center; }
th, td {
padding: 10px;
}
.cataform {
width: 60%;
height: 34px;
padding: 6px 12px;
background-color: #fff;
border: 1px solid #c2cad8;
font-size: 14px;
border-radius: 4px;
-webkit-box-shadow: inset 0 1px 1px rgba(0,0,0,.075);
box-shadow: inset 0 1px 1px rgba(0,0,0,.075);
-webkit-transition: border-color ease-in-out .15s,box-shadow ease-in-out .15s;
}
</style>
</head>
<body>
<div width="100%" style="padding:10px">
<?php
//echo "CATASTALI=".$_SESSION['cataparticella']."<br>";
//echo "QUERY=".$_SESSION['QUERY_CDU']."<br>";
//echo "PROV=".strtolower($_SESSION['COMUNE_PROV'])."<br>";
if ($_GET['mode'] == "new") {
$_SESSION['QUERY_CDU'] = "";
$_SESSION['PARTICELLE'] = "";
$_SESSION['CATA_TABLE'] = "";
$_SESSION['cataparticella'] = "";
}
if (!empty($_SESSION['cataparticella'])) {
//$arraycata[] = $_SESSION['cataparticella'];
$arraycata = explode(";", $_SESSION['cataparticella']);
}
if (!empty($_POST['mappale'])) {
$arraycata = $_POST['mappale'];
}
$valorecata = count($arraycata);
// INIZIO PROCEDURA DI RICERCA PROVENIENTE DA FORM QUESTA PAGINA
//if($_POST['mappale']) {
if($valorecata > 0) {
echo "<span style='margin-bottom:15px; font-size:18px'><b>Dati catastali inseriti:</b></span><br><br>";
foreach( $arraycata as $index => $mappale ) {
if(strlen($valorecata) > 0) { //CALCOLA LA LUNGHEZZA DELLA STRINGA ARRAY
$arr = explode("-", $mappale);
echo '&raquo; Foglio: <b>'.$arr[0].'</b>&nbsp;&nbsp;&nbsp;Particella: <b>'.$arr[1].'</b>';
$query = "SELECT id FROM ".strtolower($_SESSION['COMUNE_PROV']).".particelle WHERE comune = '".$_SESSION['COMUNE_BELF']."' AND mappale ='".trim($mappale)."'";
$result_query = pg_query($conn, $query) or die('ERROR query_mappale: ');
$numrec = pg_numrows($result_query);
//echo "REC = ". $numrec ."<br>";
if ($numrec > 0) {
while($rowparticelle = pg_fetch_assoc($result_query)) { $gidquery[] = $rowparticelle['id']; }
echo "<br>";
$_SESSION['CATA_TABLE'] = strtolower($_SESSION['COMUNE_PROV']).".particelle";
} elseif ($numrec == 0) {
$query = "SELECT id FROM public.particelle_modificate WHERE comune = '".$_SESSION['COMUNE_BELF']."' AND mappale ='".$mappale."'";
$result_query = pg_query($conn, $query) or die('ERROR query_mappale_modificato: ');
while($rowparticelle = pg_fetch_assoc($result_query)) { $gidquery[] = $rowparticelle['id']; }
echo "<br>";
$_SESSION['CATA_TABLE'] = "public.particelle_modificate";
} else { echo "<div style=\"color:#F00\">".$foglioparticella."&nbsp;&nbsp;&nbsp;<b>&raquo; particella non trovata</b></div>";}
}
}
$valorearray = count($gidquery);
$stringa = implode(' OR id=', $gidquery);
$_SESSION['QUERY_CDU'] = $stringa;
//echo '<br>STRINGA: '.$_SESSION['QUERY_CDU'];
if ($stringa != "") {
// INIZIO CALCOLO GEOMETRIE E ZOOM
if(!$strcoordinate = @pg_query("SELECT ST_X(ST_Transform(ST_Centroid(ST_Union(geom)),4326)) as long, ST_Y(ST_Transform(ST_Centroid(ST_union(geom)),4326)) as lat FROM ".$_SESSION['CATA_TABLE']." WHERE comune = '".$_SESSION['COMUNE_BELF']."' AND id=".$_SESSION['QUERY_CDU'].";"))
die("Errore CENTRO PARTICELLA: " . pg_last_error($conn));
while($rowcoord = pg_fetch_assoc($strcoordinate)) {
$_SESSION['CENTER'] = $rowcoord['lat'] .", ".$rowcoord['long'];
}
function escapeJsonString($value) { # list from www.json.org: (\b backspace, \f formfeed)
$escapers = array("\\", "/", "\"", "\n", "\r", "\t", "\x08", "\x0c");
$replacements = array("\\\\", "\\/", "\\\"", "\\n", "\\r", "\\t", "\\f", "\\b");
$result = str_replace($escapers, $replacements, $value);
return $result;
}
// CALCOLA GEOMETRIA PARTICELLA
//$sql_catasto = "SELECT ST_AsGeoJSON(ST_Transform(geom,4326)) AS cata_geojson, round(ST_Area(geom)::numeric,2) as area
$sql_catasto = "SELECT ST_AsGeoJSON(ST_Transform(geom,4326)) AS cata_geojson FROM ".$_SESSION['CATA_TABLE']." WHERE comune = '".$_SESSION['COMUNE_BELF']."' AND id=".$_SESSION['QUERY_CDU']."";
$rs = pg_query($conn, $sql_catasto);
if (!$rs) {
echo "ERROR GEOM PARTICELLE.\n";
} else {
// echo "QUERY OKKEY <br><br>";
}
$output = ''; $rowOutput = '';
while ($row = pg_fetch_assoc($rs)) {
$rowOutput = (strlen($rowOutput) > 0 ? ',' : '') . '{"type": "Feature", "properties": {';
$props = '';
$id = '';
foreach ($row as $key => $val) {
if ($key != "cata_geojson") {
$props .= (strlen($props) > 0 ? ',' : '') . '"' . $key . '":"' . escapeJsonString($val) . '"';
}
if ($key == "id") {
$id .= ',"id":"' . escapeJsonString($val) . '"';
}
}
$rowOutput .= $props . '}, "geometry": ' . $row['cata_geojson'] . '';
$rowOutput .= $id;
$rowOutput .= '}';
$output .= $rowOutput;
}
$_SESSION['SELECT_PARTICELLA'] = '{ "type": "FeatureCollection", "crs": { "type": "name", "properties": { "name": "urn:ogc:def:crs:EPSG::4326" } }, "features": [ ' . $output . ' ] }';
$_SESSION['ZOOM'] = 16;
// FINE CALCOLO GEOMETRIE E ZOOM
echo "<script>window.open('catamap?cdu=2','map');</script>";
?>
<br>
<div style="margin-bottom:20px; font-size:18px"><i class="far fa-map fa-lg"></i>&nbsp;&nbsp; <a href="catamap?cdu=2" target="map">Visualizza mappa</a></div>
<div style="margin-bottom:20px; font-size:18px"><i class="far fa-file-certificate fa-lg"></i>&nbsp;&nbsp; <a href="load2" target="map"> Completa la geolocalizzazione</a></div>
<div style="margin-bottom:20px; font-size:18px"><i class="far fa-object-group fa-lg"></i>&nbsp;&nbsp; <a href="draw" target="map">Localizza intervento</a></div>
<div style="margin-bottom:20px; font-size:18px"><i class="far fa-redo-alt fa-lg"></i>&nbsp;&nbsp; <a href="?mode=new"> Nuova interrogazione </a></div>
<?php
} else {
echo "<span style=\"color:#F00\" class=\"error\" ><br><b>Verificare con esattezza i dati catastali.</b><br>è possibile che sia presente un frazionamento recente o un'area riservata; <br>contattare il supporto.</span>";
}
}
?>
<?php if(strlen($stringa)==0) { // tutte le variabili di ricerca a 0
?>
<!-- INSERIMENTO DATI PER RICERCA PARTICELLE -->
<div style="margin-bottom:15px; font-size:18px">Verifica regime vincolistico:</div>
<small><b>Foglio-Particella</b>, es: 15-234<br><br>
<form method="post" action="">
<p class="clone"> <input type="text" name="mappale[]" style="width: 75%; font-size:18px" size="14px" class="cataform"/>&nbsp;&nbsp;&nbsp;&nbsp;<a href="#" class="add" rel=".clone"><i class="far fa-plus-square fa-lg" style="padding-top:8px"></i></a></p>
<input type="submit" class="btn btn-primary" style="width: 84%" value=" Conferma Dati" /><br><br>
</form>
<p>
<?php } // end all variable ?>
</div>
</body>
</html>

769
catavincoli.php

@ -0,0 +1,769 @@
<?php if (session_id() == "")session_start();ob_start(); ?>
<?php include_once "cfg.php" ?>
<?php
$comunebelf = $_SESSION['COMUNE_BELF'];
if ($comunebelf == "") {
//header("location: ../index");
// $start = microtime(true);
?>
<script>window.location.href = 'index';</script>
<?php } ?>
<link href="assets/css/bootstrap-italia.min.css" rel="stylesheet">
<link href="assets/fontawesome/css/all.css" rel="stylesheet" type="text/css" />
<style type="text/css">
.zoning_title { border-bottom: 1px solid #cccccc; background: #f6f6f6; font-weight: bold; color: #333333; outline: none; font-size: 13px;}
.zoning { border-bottom: 1px solid #cccccc; font-style:italic; color: #333333; outline: none; font-size: 12px;}
.zoning2 { border-bottom: 1px solid #cccccc; font-style:italic; color: #333333; outline: none; font-size: 12px;text-align:center;}
.particella { border-bottom: 1px solid #cccccc; background: #f6f6f6; font-weight: bold; font-style:italic; color: #333333; font-size: 12px; outline: none; }
.titolo { font-weight: bold; font-style:italic; color: #333333; font-size: 12px; outline: none; }
.body2 {overflow: hidden; height:auto; border: none; }
body {
font-family: "Open Sans",sans-serif;
background: rgba(242, 242, 242, 0.9);
margin: 0;
padding: 0;
text-align: center;
}
.center {
width: 750px ;
margin-left: auto;
margin-right: auto;
}
</style>
<?php
function fixtags($text){
$text = htmlspecialchars($text);
$text = preg_replace("/=/", "=\"\"", $text);
$text = preg_replace("/&quot;/", "&quot;\"", $text);
$tags = "/&lt;(\/|)(\w*)(\ |)(\w*)([\\\=]*)(?|(\")\"&quot;\"|)(?|(.*)?&quot;(\")|)([\ ]?)(\/|)&gt;/i";
$replacement = "<$1$2$3$4$5$6$7$8$9$10>";
$text = preg_replace($tags, $replacement, $text);
$text = preg_replace("/=\"\"/", "=", $text);
return $text;
}
$mode = $_GET['mode'];
$idwg = $_GET['id'];
if ($mode == "wg") {
if (strlen($idwg) > 9) {
$cata = explode(".", $idwg); //VARIABILE PER LA RICERCA DEI CATASTALI
$cataid = $cata[1]; //VARIABILE PER LA RICERCA DEI CATASTALI
} else {
$cataid = $idwg; //VARIABILE PER LA RICERCA DEI CATASTALI
}
} else {
$cataid = $_SESSION['QUERY_CDU']; //VARIABILE PER LA RICERCA DEI CATASTALI
}
$comu_cata = strtolower($_SESSION['COMUNE_PROV']).".particelle"; // COMPOSIZIONE TABELLA PARTICELLE-COMUNE
$comu_prg = strtolower($_SESSION['COMUNE_PROV']).".zoning"; // COMPOSIZIONE TABELLA ZONING-COMUNE
$comu = $_SESSION['COMUNE_BELF']; // COMPOSIZIONE TABELLA ZONING-COMUNE
$comu_vincoprg = strtolower($_SESSION['COMUNE_PROV']).".vincoli"; // COMPOSIZIONE TABELLA ZONING-COMUNE
?>
<table border="0" cellpadding="4" style="font-size:13px" class="center" >
<tr>
<td colspan="2" align="center"><img src="assets/img/logo-rs.png" height="55" alt="logo" /><br><span style="font-size:18px"><b>Regione Siciliana</b></span><br></td>
</tr>
<tr>
<td colspan="2" align="center"><span style="font-size:13px"><b>Dipartimento dei Beni Culturali e dell'Identità Siciliana</b><br> - - - - - - - - - - - - - - -</span></td>
</tr>
<tr>
<td colspan="2" align="center"><span style="font-size:13px"><b>ANTEPRIMA REGIME VINCOLISTICO</b></span></td>
</tr>
<form id="geomap">
<tr>
<td colspan="2">
<br><strong>Particelle individuate</strong>:<br><br>
<?php
//############# BEGIN CADASTRAL LIST
if(!$rs_dati = @pg_query("SELECT *, ST_Area(geom) as area FROM ".$_SESSION['CATA_TABLE']." WHERE comune = '".$_SESSION['COMUNE_BELF']."' AND id = ".$_SESSION['QUERY_CDU'].""))
die("ERROR CATA DATA DA WEBGIS: " . pg_last_error($conn));
$row_dati_list = pg_num_rows($rs_dati);
if ($row_dati_list > 0 ) {
while($lista = pg_fetch_assoc($rs_dati)) {
//$daticata = explode("-", substr($lista['mappale'],5,20));
$daticata = explode("-", $lista['mappale']);
echo "&nbsp;&nbsp;&nbsp;&raquo; Foglio: <b>". $daticata[0]."</b> &nbsp;&nbsp;&nbsp; Particella: <b>".$daticata[1]."</b>&nbsp;&nbsp;&nbsp; (area ".round($lista['area'],3)." m<sup>2</sup>)<br>";
$formcata = $lista['mappale'];
if ($row_dati_list == 1) {
$daticata_view[] = $formcata;
}
if ($row_dati_list > 1) {
$daticata_view[] = $formcata."; ";
}
}
}
//############# END CADASTRAL LIST
//############# BEGIN LAT & LONG
if(!$strcoordinate = @pg_query("SELECT ST_X(ST_Transform(ST_Centroid(ST_Union(geom)),4326)) as long,
ST_Y(ST_Transform(ST_Centroid(ST_union(geom)),4326)) as lat
FROM ".$_SESSION['CATA_TABLE']." WHERE comune = '".$_SESSION['COMUNE_BELF']."' AND id = ".$_SESSION['QUERY_CDU'].""))
die("Errore CENTRO COMUNE: " . pg_last_error($conn));
while($rowcoord = pg_fetch_assoc($strcoordinate)) {
$coord_lat[] = $rowcoord['lat'];
$coord_long[] = $rowcoord['long'];
}
//############# END LAT & LONG
?>
<input type="hidden" name="estremiCatastali" value="<?php foreach($daticata_view as $value){echo $value;}?>">
<br>
</td>
</tr>
<tr>
<td colspan="2">
<table width="100%" border="0" cellspacing="4" cellpadding="2" align="center">
<tr>
<td width="30%" class="zoning_title" ><div align="center"><b>TIPO</b></div></td>
<td width="45%" class="zoning_title" ><div align="center"><b>DESTINAZIONE</b></div></td>
<td width="25%" class="zoning_title" ><div align="center"><b>COPERTURA</b></div></td>
</tr>
<!-- ======================= DATI CDU START ======================== -->
<?php
// AREA INTERESSATA DALLA PARTICELLA RISPETTO ALLA ZONIZZAZIONE
$query3 = "SELECT id, foglio, numero, ST_AsText(geom) AS geometria, ST_Area(geom) as area FROM ".$_SESSION['CATA_TABLE']." WHERE comune = '".$_SESSION['COMUNE_BELF']."' AND id = ".$_SESSION['QUERY_CDU']."";
$result_query3 = pg_query($conn, $query3) or die('ERROR query3: ');
while($row3 = pg_fetch_assoc($result_query3)) {
$_SESSION['geom'] = $row3['geometria'];
// echo "GEOM = ".$_SESSION['geom']."<br>";
$foglio = $row3['foglio'];
$area_sezione = $row3['area'];
$particella = $row3['numero'];
$idparticella = $row3['id'];
// PARTICELLE INTERESSATE
echo "\n\t<tr>\n\t\t<td class='particella' colspan='3'>&nbsp;&nbsp;&nbsp;Foglio {$foglio}&nbsp;&nbsp;e&nbsp;&nbsp;Particella {$particella}</td>\n\t</tr>";
//####### BEGIN RECORD ########
$record_paesaggio[] = "Foglio ".$foglio." - Particella ".$particella."\n";
$record_tutela[] = "Foglio ".$foglio." - Particella ".$particella."\n";
$record_vincoli[] = "Foglio ".$foglio." - Particella ".$particella."\n";
//####### END RECORD ########
// INIZIO DEFINIZIONE DELLA COPERTURA DELLA ZONAZIONE
$query_zoning = "SELECT a.descdest, ST_AREA(ST_intersection(a.geom, b.geom)) AS areazto FROM (SELECT descdest, geom FROM public.zoning_stir) a, (SELECT ST_GeomFromEWKT('SRID=25833;".$_SESSION['geom']."') as geom) b WHERE ST_Intersects (a.geom,b.geom)";
$result_query_zoning = pg_query($conn, $query_zoning) or die('Query query_zoning failied');
if (pg_num_rows($result_query_zoning) > 0) {
while($row4 = pg_fetch_assoc($result_query_zoning)) {
$areazto_percent = round(($row4['areazto']/$area_sezione)*100,2);
//$zto_array[] = $row4['zon_sigla']." - ".row4['zon_descr'];
//####### BEGIN RECORD ########
//$record_form[] = row4['zon_descr']."\n";
//####### END RECORD ########
if ($areazto_percent > 1) {
echo "\n\t<tr>\n\t\t<td class='zoning'>Zona di PRG</td>\n\t\t<td class='zoning'>{$row4['descdest']}</td>\n\t\t<td class='zoning2'>&nbsp;&nbsp;({$areazto_percent}%)</td>\n\t</tr>";
//$ntart[] = $row4['zon_art'];
}}}
// FINE DEFINIZIONE DELLA COPERTURA DELLA ZONAZIONE
// INIZIO DEFINIZIONE DELLA COPERTURA DEI VINCOLI DI PRG
$query_prgvincoli = "SELECT a.zon_descr, ST_AREA(ST_intersection(a.geom, b.geom)) AS areavinc FROM (SELECT zon_descr, geom FROM ".strtolower($_SESSION['COMUNE_PROV']).".vincoli) a, (SELECT ST_GeomFromEWKT('SRID=25833;".$_SESSION['geom']."') as geom) b WHERE ST_Intersects (a.geom,b.geom)";
$result_query_prgvincoli = pg_query($conn, $query_prgvincoli) or die('Query query_prgvincoli failied');
if (pg_num_rows($result_query_prgvincoli) > 0) {
while($row5 = pg_fetch_assoc($result_query_prgvincoli)) {
$areavinc_percent = round(($row5['areavinc']/$area_sezione)*100,2);
if ($areavinc_percent > 10) {
echo "\n\t<tr>\n\t\t<td class='zoning'>Vincolo di PRG</td>\n\t\t<td class='zoning'>{$row5['zon_descr']}</td>\n\t\t<td class='zoning2'>&nbsp;&nbsp;({$areavinc_percent}%)</td>\n\t</tr>";
}
}
}
// FINE DEFINIZIONE DELLA COPERTURA DEI VINCOLI DI PRG
// INIZIO DEFINIZIONE DELLA COPERTURA DEI VINCOLI BBCCAA
$query_regimi = "SELECT a.pl, a.liv_tutela, a.contesto, ST_AREA(ST_intersection(a.geom, b.geom)) AS areabbccaa FROM (SELECT pl, liv_tutela, contesto, geom FROM ".strtolower($_SESSION['COMUNE_PROV']).".regimi_normativi) a, (SELECT ST_GeomFromEWKT('SRID=25833;".$_SESSION['geom']."') as geom) b WHERE ST_Intersects (a.geom,b.geom)";
$result_query_regimi = pg_query($conn, $query_regimi) or die('Query query_regimi failied');
if (pg_num_rows($result_query_regimi) > 0) {
while($row6 = pg_fetch_assoc($result_query_regimi)) {
$area_bbccaa_percent = round(($row6['areabbccaa']/$area_sezione)*100,2);
switch ($row6['liv_tutela']) {
case 1:
$bbccaa = "Livello di tutela 1";
break;
case 2:
$bbccaa = "Livello di tutela 2";
break;
case 3:
$bbccaa = "Livello di tutela 3";
break;
case 4:
$bbccaa = "Livello di tutela 4";
break;
default:
$bbccaa = "";
}
if ($area_bbccaa_percent > 1) {
echo "\n\t<tr>\n\t\t<td class='zoning'>Piano Paesaggistico Regionale<br>Regimi Normativi</td>\n\t\t<td class='zoning'>Paesaggio locale <b>{$row6['pl']}</b><br>{$bbccaa} - Contesto <b>{$row6['contesto']}</b><br>
<b>{$row6['contesto']}</b></td>\n\t\t<td class='zoning2'>&nbsp;&nbsp;&nbsp;({$area_bbccaa_percent}%)</td>\n\t</tr>";
//####### BEGIN RECORD ########
$record_paesaggio[] = "Paesaggio Locale: ".$row6['pl']." &nbsp;&nbsp;&nbsp; Contesto: ".$row6['contesto']."\n";
$record_tutela[] = $bbccaa."\n";
//####### END RECORD ########
}}}
// FINE DEFINIZIONE DELLA COPERTURA DEI VINCOLI BBCCAA
if ($_SESSION['COMUNE_PROV'] == 'TP') {
// INIZIO DEFINIZIONE DELLA COPERTURA REGIMI NORMATIVI TP1
$query_regimi_tp1 = "SELECT a.regime_nor, a.denominazi, a.codice, ST_AREA(ST_intersection(a.geom, b.geom)) AS areatp1 FROM (SELECT regime_nor, denominazi, codice, geom FROM ".strtolower($_SESSION['COMUNE_PROV']).".regimi_normativi_tp1) a, (SELECT ST_GeomFromEWKT('SRID=25833;".$_SESSION['geom']."') as geom) b WHERE ST_Intersects (a.geom,b.geom)";
$result_query_regimi_tp1 = pg_query($conn, $query_regimi_tp1) or die('Query query_regimi_tp1 failied');
if (pg_num_rows($result_query_regimi_tp1) > 0) {
while($row6 = pg_fetch_assoc($result_query_regimi_tp1)) {
$area_bbccaa_percent = round(($row6['areatp1']/$area_sezione)*100,2);
if ($area_bbccaa_percent > 1) {
echo "\n\t<tr>\n\t\t<td class='zoning'>Piano Paesaggistico Regionale<br>Regimi Normativi (Ambito 1)</td>\n\t\t<td class='zoning'>Denominazione <b>{$row6['denominazi']}</b><br>Codice {$row6['codice']} - Reg. Norm. <b>{$row6['regime_nor']}</b><br>
<b>{$row6['contesto']}</b></td>\n\t\t<td class='zoning2'>&nbsp;&nbsp;&nbsp;({$area_bbccaa_percent}%)</td>\n\t</tr>";
//####### BEGIN RECORD ########
$record_paesaggio[] = "Denominazione: ".$row6['denominazi']." &nbsp;&nbsp;&nbsp; Codice: ".$row6['codice']."\n";
//####### END RECORD ########
}}}
// FINE DEFINIZIONE DELLA COPERTURA REGIMI NORMATIVI TP1
// INIZIO DEFINIZIONE DELLA COPERTURA FASCIA COSTA
$query_costa = "SELECT ST_AREA(ST_intersection(a.geom, b.geom)) AS area_costa FROM (SELECT geom FROM ".strtolower($_SESSION['COMUNE_PROV']).".fascia_rispetto_costa) a, (SELECT ST_GeomFromEWKT('SRID=25833;".$_SESSION['geom']."') as geom) b WHERE ST_Intersects (a.geom,b.geom)";
$result_query_costa = pg_query($conn, $query_costa) or die('Query query_costa failied');
if (pg_num_rows($result_query_costa) > 0) {
while($row6bb = pg_fetch_assoc($result_query_costa)) {
$area_v_percent = round(($row6bb['area_costa']/$area_sezione)*100,2);
if ($area_v_percent > 1) {
echo "\n\t<tr>\n\t\t<td class='zoning'>Piano Paesaggistico Regionale<br>Regimi Normativi (Ambito 1)</td>\n\t\t<td class='zoning'>Fascia di rispetto della costa - art. 54 NdA</td>\n\t\t<td class='zoning2'>&nbsp;&nbsp;({$area_v_percent}%)</td>\n\t</tr>";
//####### BEGIN RECORD ########
$record_vincoli[] = "Fascia di rispetto della costa - art. 54 NdA\n";
//####### BEGIN RECORD ########
}}}
// FINE DEFINIZIONE DELLA COPERTURA FASCIA COSTA
// INIZIO DEFINIZIONE DELLA COPERTURA AREA RECUPERO
$query_recupero = "SELECT ST_AREA(ST_intersection(a.geom, b.geom)) AS area_recupero FROM (SELECT geom FROM ".strtolower($_SESSION['COMUNE_PROV']).".area_recupero) a, (SELECT ST_GeomFromEWKT('SRID=25833;".$_SESSION['geom']."') as geom) b WHERE ST_Intersects (a.geom,b.geom)";
$result_query_recupero = pg_query($conn, $query_recupero) or die('Query query_recupero failied');
if (pg_num_rows($result_query_recupero) > 0) {
while($row6cc = pg_fetch_assoc($result_query_recupero)) {
$area_v_percent = round(($row6cc['area_recupero']/$area_sezione)*100,2);
if ($area_v_percent > 1) {
echo "\n\t<tr>\n\t\t<td class='zoning'>Piano Paesaggistico Regionale<br>Regimi Normativi (Ambito 1)</td>\n\t\t<td class='zoning'>Area di recupero - art. 51 NdA</td>\n\t\t<td class='zoning2'>&nbsp;&nbsp;({$area_v_percent}%)</td>\n\t</tr>";
//####### BEGIN RECORD ########
$record_vincoli[] = "Area di recupero - art. 51 NdA\n";
//####### BEGIN RECORD ########
}}}
// FINE DEFINIZIONE DELLA COPERTURA AREA RECUPERO
}
// INIZIO DEFINIZIONE DELLA COPERTURA V_1497
$query_v_1497 = "SELECT ST_AREA(ST_intersection(a.geom, b.geom)) AS area_v_1497 FROM (SELECT geom FROM ".strtolower($_SESSION['COMUNE_PROV']).".v_1497) a, (SELECT ST_GeomFromEWKT('SRID=25833;".$_SESSION['geom']."') as geom) b WHERE ST_Intersects (a.geom,b.geom)";
$result_query_v_1497 = pg_query($conn, $query_v_1497) or die('Query query_v_1497 failied');
if (pg_num_rows($result_query_v_1497) > 0) {
while($row6a = pg_fetch_assoc($result_query_v_1497)) {
$area_v_percent = round(($row6a['area_v_1497']/$area_sezione)*100,2);
if ($area_v_percent > 1) {
echo "\n\t<tr>\n\t\t<td class='zoning'>BENI PAESAGGISTICI</td>\n\t\t<td class='zoning'>Area tutelata (art.136, D.lgs.42/04)</td>\n\t\t<td class='zoning2'>&nbsp;&nbsp;({$area_v_percent}%)</td>\n\t</tr>";
//####### BEGIN RECORD ########
$record_vincoli[] = "Area tutelata (art.136, D.lgs.42/04)\n";
//####### BEGIN RECORD ########
}}}
// FINE DEFINIZIONE DELLA COPERTURA V_1497
// INIZIO DEFINIZIONE DELLA COPERTURA V_ARCHEO
$query_v_archeo = "SELECT ST_AREA(ST_intersection(a.geom, b.geom)) AS area_v_archeo FROM (SELECT geom FROM ".strtolower($_SESSION['COMUNE_PROV']).".v_archeo) a, (SELECT ST_GeomFromEWKT('SRID=25833;".$_SESSION['geom']."') as geom) b WHERE ST_Intersects (a.geom,b.geom)";
$result_query_v_archeo = pg_query($conn, $query_v_archeo) or die('Query query_v_archeo failied');
if (pg_num_rows($result_query_v_archeo) > 0) {
while($row6b = pg_fetch_assoc($result_query_v_archeo)) {
$area_v_archeo_percent = round(($row6b['area_v_archeo']/$area_sezione)*100,2);
if ($area_v_archeo_percent > 1) {
echo "\n\t<tr>\n\t\t<td class='zoning'>BENI PAESAGGISTICI</td>\n\t\t<td class='zoning'>Vincolo Archeologico (art.10, D.lgs.42/04)</td>\n\t\t<td class='zoning2'>&nbsp;&nbsp;({$area_v_archeo_percent}%)</td>\n\t</tr>";
//####### BEGIN RECORD ########
$record_vincoli[] = "Vincolo Archeologico (art.10, D.lgs.42/04)\n";
//####### BEGIN RECORD ########
}}}
// FINE DEFINIZIONE DELLA COPERTURA V_ARCHEO
// INIZIO DEFINIZIONE DELLA COPERTURA V_BOSCHI
/* */
$query_v_boschi = "SELECT ST_AREA(ST_intersection(a.geom, b.geom)) AS area_v_boschi FROM (SELECT geom FROM ".strtolower($_SESSION['COMUNE_PROV']).".v_boschi) a, (SELECT ST_GeomFromEWKT('SRID=25833;".$_SESSION['geom']."') as geom) b WHERE ST_Intersects (a.geom,b.geom)";
$result_query_v_boschi = pg_query($conn, $query_v_boschi) or die('Query query_v_boschi failied');
if (pg_num_rows($result_query_v_boschi) > 0) {
while($row6c = pg_fetch_assoc($result_query_v_boschi)) {
$area_v_boschi_percent = round(($row6c['area_v_boschi']/$area_sezione)*100,2);
if ($area_v_boschi_percent > 1) {
echo "\n\t<tr>\n\t\t<td class='zoning'>BENI PAESAGGISTICI</td>\n\t\t<td class='zoning'>Aree boscate (art.142, lett. g, D.lgs.42/04)</td>\n\t\t<td class='zoning2'>&nbsp;&nbsp;({$area_v_boschi_percent}%)</td>\n\t</tr>";
//####### BEGIN RECORD ########
$record_vincoli[] = "Aree boscate (art.142, lett. g, D.lgs.42/04)\n";
//####### BEGIN RECORD ########
}}}
// FINE DEFINIZIONE DELLA COPERTURA V_BOSCHI
// INIZIO DEFINIZIONE DELLA COPERTURA V_COSTA
$query_v_costa = "SELECT ST_AREA(ST_intersection(a.geom, b.geom)) AS area_v_costa FROM (SELECT geom FROM ".strtolower($_SESSION['COMUNE_PROV']).".v_costa) a, (SELECT ST_GeomFromEWKT('SRID=25833;".$_SESSION['geom']."') as geom) b WHERE ST_Intersects (a.geom,b.geom)";
//echo $query_v_costa."<br>";
$result_query_v_costa = pg_query($conn, $query_v_costa) or die('Query query_v_costa failied');
if (pg_num_rows($result_query_v_costa) > 0) {
while($row6d = pg_fetch_assoc($result_query_v_costa)) {
$area_v_percent = round(($row6d['area_v_costa']/$area_sezione)*100,2);
if ($area_v_percent > 1) {
echo "\n\t<tr>\n\t\t<td class='zoning'>BENI PAESAGGISTICI</td>\n\t\t<td class='zoning'>Aree costa 300m (art.142, lett.a, D.lgs. 42/04)</td>\n\t\t<td class='zoning2'>&nbsp;&nbsp;({$area_v_percent}%)</td>\n\t</tr>";
//####### BEGIN RECORD ########
$record_vincoli[] = "Aree costa 300m (art.142, lett.a, D.lgs. 42/04)\n";
//####### BEGIN RECORD ########
}}}
// FINE DEFINIZIONE DELLA COPERTURA V_COSTA
// INIZIO DEFINIZIONE DELLA COPERTURA V_FIUMI
$query_v_fiumi = "SELECT ST_AREA(ST_intersection(a.geom, b.geom)) AS area_v_fiumi FROM (SELECT geom FROM ".strtolower($_SESSION['COMUNE_PROV']).".v_fiumi) a, (SELECT ST_GeomFromEWKT('SRID=25833;".$_SESSION['geom']."') as geom) b WHERE ST_Intersects (a.geom,b.geom)";
$result_query_v_fiumi = pg_query($conn, $query_v_fiumi) or die('Query query_v_fiumi failied');
if (pg_num_rows($result_query_v_fiumi) > 0) {
while($row6e = pg_fetch_assoc($result_query_v_fiumi)) {
$area_v_percent = round(($row6e['area_v_fiumi']/$area_sezione)*100,2);
if ($area_v_percent > 1) {
echo "\n\t<tr>\n\t\t<td class='zoning'>BENI PAESAGGISTICI</td>\n\t\t<td class='zoning'>Aree fiumi 150m (art.142, lett. c, D.lgs.42/04)</td>\n\t\t<td class='zoning2'>&nbsp;&nbsp;({$area_v_percent}%)</td>\n\t</tr>";
//####### BEGIN RECORD ########
$record_vincoli[] = "Aree fiumi 150m (art.142, lett. c, D.lgs.42/04)\n";
//####### BEGIN RECORD ########
}}}
// FINE DEFINIZIONE DELLA COPERTURA V_FIUMI
// INIZIO DEFINIZIONE DELLA COPERTURA V_INTERESSE_ARCHEO
$query_v_interesse_archeo = "SELECT ST_AREA(ST_intersection(a.geom, b.geom)) AS area_v_interesse_archeo FROM (SELECT geom FROM ".strtolower($_SESSION['COMUNE_PROV']).".v_interesse_archeo) a, (SELECT ST_GeomFromEWKT('SRID=25833;".$_SESSION['geom']."') as geom) b WHERE ST_Intersects (a.geom,b.geom)";
$result_query_v_interesse_archeo = pg_query($conn, $query_v_interesse_archeo) or die('Query query_v_interesse_archeo failied');
if (pg_num_rows($result_query_v_interesse_archeo) > 0) {
while($row6f = pg_fetch_assoc($result_query_v_interesse_archeo)) {
$area_v_percent = round(($row6f['area_v_interesse_archeo']/$area_sezione)*100,2);
if ($area_v_percent > 1) {
echo "\n\t<tr>\n\t\t<td class='zoning'>BENI PAESAGGISTICI</td>\n\t\t<td class='zoning'>Aree di interesse archeologico (art.142, lett. m, D.lgs.42/04)</td>\n\t\t<td class='zoning2'>&nbsp;&nbsp;({$area_v_percent}%)</td>\n\t</tr>";
//####### BEGIN RECORD ########
$record_vincoli[] = "Aree di interesse archeologico (art.142, lett. m, D.lgs.42/04)\n";
//####### BEGIN RECORD ########
}}}
// FINE DEFINIZIONE DELLA COPERTURA V_INTERESSE_ARCHEO
// INIZIO DEFINIZIONE DELLA COPERTURA V_LAGHI
$query_v_laghi = "SELECT ST_AREA(ST_intersection(a.geom, b.geom)) AS area_v_laghi FROM (SELECT geom FROM ".strtolower($_SESSION['COMUNE_PROV']).".v_laghi) a, (SELECT ST_GeomFromEWKT('SRID=25833;".$_SESSION['geom']."') as geom) b WHERE ST_Intersects (a.geom,b.geom)";
$result_query_v_laghi = pg_query($conn, $query_v_laghi) or die('Query query_v_laghi failied');
if (pg_num_rows($result_query_v_laghi) > 0) {
while($row6g = pg_fetch_assoc($result_query_v_laghi)) {
$area_v_percent = round(($row6g['area_v_laghi']/$area_sezione)*100,2);
if ($area_v_percent > 1) {
echo "\n\t<tr>\n\t\t<td class='zoning'>BENI PAESAGGISTICI</td>\n\t\t<td class='zoning'>Aree laghi 300m (art.142, lett. b, D.lgs. 42/04)</td>\n\t\t<td class='zoning2'>&nbsp;&nbsp;({$area_v_percent}%)</td>\n\t</tr>";
//####### BEGIN RECORD ########
$record_vincoli[] = "Aree laghi 300m (art.142, lett. b, D.lgs. 42/04)\n";
//####### BEGIN RECORD ########
}}}
// FINE DEFINIZIONE DELLA COPERTURA V_LAGHI
// INIZIO DEFINIZIONE DELLA COPERTURA V_LETTERA_C
$query_v_lettera_c = "SELECT ST_AREA(ST_intersection(a.geom, b.geom)) AS area_v_lettera_c FROM (SELECT geom FROM ".strtolower($_SESSION['COMUNE_PROV']).".v_lettera_c) a, (SELECT ST_GeomFromEWKT('SRID=25833;".$_SESSION['geom']."') as geom) b WHERE ST_Intersects (a.geom,b.geom)";
$result_query_v_lettera_c = pg_query($conn, $query_v_lettera_c) or die('Query query_v_lettera_c failied');
if (pg_num_rows($result_query_v_lettera_c) > 0) {
while($row6h = pg_fetch_assoc($result_query_v_lettera_c)) {
$area_v = $row6h['area_v_lettera_c'];
$area_v_percent = round(($area_v/$area_sezione)*100,2);
if ($area_v_percent > 1) {
echo "\n\t<tr>\n\t\t<td class='zoning'>BENI PAESAGGISTICI</td>\n\t\t<td class='zoning'>Aree tutelate (art.134, lett. c, D.lgs. 42/04)</td>\n\t\t<td class='zoning2'>&nbsp;&nbsp;({$area_v_percent}%)</td>\n\t</tr>";
//####### BEGIN RECORD ########
$record_vincoli[] = "Aree tutelate (art.134, lett. c, D.lgs. 42/04)\n";
//####### BEGIN RECORD ########
}}}
// FINE DEFINIZIONE DELLA COPERTURA V_LETTERA_C
// INIZIO DEFINIZIONE DELLA COPERTURA V_RISERVE
$query_v_riserve = "SELECT ST_AREA(ST_intersection(a.geom, b.geom)) AS area_v_riserve FROM (SELECT geom FROM ".strtolower($_SESSION['COMUNE_PROV']).".v_riserve) a, (SELECT ST_GeomFromEWKT('SRID=25833;".$_SESSION['geom']."') as geom) b WHERE ST_Intersects (a.geom,b.geom)";
$result_query_v_riserve = pg_query($conn, $query_v_riserve) or die('Query query_v_riserve failied');
if (pg_num_rows($result_query_v_riserve) > 0) {
while($row6i = pg_fetch_assoc($result_query_v_riserve)) {
$area_v = $row6i['area_v_riserve'];
$area_v_percent = round(($area_v/$area_sezione)*100,2);
if ($area_v_percent > 1) {
echo "\n\t<tr>\n\t\t<td class='zoning'>BENI PAESAGGISTICI</td>\n\t\t<td class='zoning'>Aree riserve regionali (art.142, lett. f, D.lgs.42/04)</td>\n\t\t<td class='zoning2'>&nbsp;&nbsp;({$area_v_percent}%)</td>\n\t</tr>";
//####### BEGIN RECORD ########
$record_vincoli[] = "Aree riserve regionali (art.142, lett. f, D.lgs.42/04)\n";
//####### BEGIN RECORD ########
}}}
// FINE DEFINIZIONE DELLA COPERTURA V_RISERVE
// INIZIO DEFINIZIONE DELLA COPERTURA V_PARCHI
$query_v_parchi = "SELECT ST_AREA(ST_intersection(a.geom, b.geom)) AS area_v_parchi FROM (SELECT geom FROM ".strtolower($_SESSION['COMUNE_PROV']).".v_parchi) a, (SELECT ST_GeomFromEWKT('SRID=25833;".$_SESSION['geom']."') as geom) b WHERE ST_Intersects (a.geom,b.geom)";
$result_query_v_parchi = pg_query($conn, $query_v_parchi) or die('Query query_v_parchi failied');
if (pg_num_rows($result_query_v_parchi) > 0) {
while($row6l = pg_fetch_assoc($result_query_v_parchi)) {
$area_v_percent = round(($row6l['area_v_parchi']/$area_sezione)*100,2);
if ($area_v_percent > 1) {
echo "\n\t<tr>\n\t\t<td class='zoning'>BENI PAESAGGISTICI</td>\n\t\t<td class='zoning'>Parchi regionali (art.142, lett. f, D.lgs.42/04)<br><b>{$row6l['denom']}</b></td>\n\t\t<td class='zoning2'>&nbsp;&nbsp;({$area_v_percent}%)</td>\n\t</tr>";
//####### BEGIN RECORD ########
$record_vincoli[] = "Parchi regionali (art.142, lett. f, D.lgs.42/04)\n";
//####### BEGIN RECORD ########
}}}
// FINE DEFINIZIONE DELLA COPERTURA V_PARCHI
// INIZIO DEFINIZIONE DELLA COPERTURA V_1200
$query_v_1200 = "SELECT ST_AREA(ST_intersection(a.geom, b.geom)) AS area_v_1200 FROM (SELECT geom FROM ".strtolower($_SESSION['COMUNE_PROV']).".v_1200) a, (SELECT ST_GeomFromEWKT('SRID=25833;".$_SESSION['geom']."') as geom) b WHERE ST_Intersects (a.geom,b.geom)";
$result_query_v_1200 = pg_query($conn, $query_v_1200) or die('Query query_v_1200 failied');
if (pg_num_rows($result_query_v_1200) > 0) {
while($row6m = pg_fetch_assoc($result_query_v_1200)) {
$area_v_percent = round(($row6m['area_v_1200']/$area_sezione)*100,2);
if ($area_v_percent > 1) {
echo "\n\t<tr>\n\t\t<td class='zoning'>BENI PAESAGGISTICI</td>\n\t\t<td class='zoning'>Aree al di sopra di 1200 (art.142, lett. d, D.lgs.42/04)</td>\n\t\t<td class='zoning2'>&nbsp;&nbsp;({$area_v_percent}%)</td>\n\t</tr>";
//####### BEGIN RECORD ########
$record_vincoli[] = "Aree al di sopra di 1200 (art.142, lett. d, D.lgs.42/04)\n";
//####### BEGIN RECORD ########
}}}
// FINE DEFINIZIONE DELLA COPERTURA V_1200
// INIZIO DEFINIZIONE DELLA COPERTURA V_VULCANO
$query_v_vulcano = "SELECT ST_AREA(ST_intersection(a.geom, b.geom)) AS area_vulcano FROM (SELECT geom FROM ".strtolower($_SESSION['COMUNE_PROV']).".v_vulcano) a, (SELECT ST_GeomFromEWKT('SRID=25833;".$_SESSION['geom']."') as geom) b WHERE ST_Intersects (a.geom,b.geom)";
$result_query_v_vulcano = pg_query($conn, $query_v_vulcano) or die('Query query_v_vulcano failied');
if (pg_num_rows($result_query_v_vulcano) > 0) {
while($row6m = pg_fetch_assoc($result_query_v_vulcano)) {
$area_v_percent = round(($row6m['area_vulcano']/$area_sezione)*100,2);
if ($area_v_percent > 1) {
echo "\n\t<tr>\n\t\t<td class='zoning'>BENI PAESAGGISTICI</td>\n\t\t<td class='zoning'>Vincolo area vulcano</td>\n\t\t<td class='zoning2'>&nbsp;&nbsp;({$area_v_percent}%)</td>\n\t</tr>";
//####### BEGIN RECORD ########
$record_vincoli[] = "Vincolo area vulcano\n";
//####### BEGIN RECORD ########
}}}
// FINE DEFINIZIONE DELLA COPERTURA V_VULCANO
// INIZIO DEFINIZIONE DELLA COPERTURA DEL VINCOLO IDROGEOLOGICO
$query_v_idrogeol = "SELECT ST_AREA(ST_intersection(a.geom, b.geom)) AS areaidro FROM (SELECT geom FROM rscarto.sif_vincolo_idrogeo_sicilia) a, (SELECT ST_GeomFromEWKT('SRID=25833;".$_SESSION['geom']."') as geom) b WHERE ST_Intersects (a.geom,b.geom)";
$result_query_v_idrogeol = pg_query($conn, $query_v_idrogeol) or die('Query query_v_idrogeol failied');
if (pg_num_rows($result_query_v_idrogeol) > 0) {
while($row7 = pg_fetch_assoc($result_query_v_idrogeol)) {
$area_idro_percent = round(($row7['areaidro']/$area_sezione)*100,2);
if ($area_idro_percent > 1) {
echo "\n\t<tr>\n\t\t<td class='zoning'>Vincolo Idrogeologico</td>\n\t\t<td class='zoning'>R.D.L. n° 3267 del 30/12/1923</td>\n\t\t<td class='zoning2'>&nbsp;&nbsp;&nbsp;({$area_idro_percent}%)</td>\n\t</tr>";
//####### BEGIN RECORD ########
$record_vincoli[] = "Vincolo Idrogeologico (R.D.L. n° 3267 del 30/12/1923)\n";
//####### BEGIN RECORD ########
}}}
// FINE DEFINIZIONE DELLA COPERTURA VINCOLO IDROGEOLOGICO
// INIZIO DEFINIZIONE DELLA COPERTURA DEL VINCOLO BOSCHI DL227
/* */
$query_dl227 = "SELECT ST_AREA(ST_intersection(a.geom, b.geom)) AS areadl227 FROM (SELECT geom FROM ".strtolower($_SESSION['COMUNE_PROV']).".sif_dl227) a, (SELECT ST_GeomFromEWKT('SRID=25833;".$_SESSION['geom']."') as geom) b WHERE ST_Intersects (a.geom,b.geom)";
$result_query_dl227 = pg_query($conn, $query_dl227) or die('Query query_dl227 failied');
if (pg_num_rows($result_query_dl227) > 0) {
while($row72 = pg_fetch_assoc($result_query_dl227)) {
$area_dl227_percent = round(($row72['areadl227']/$area_sezione)*100,2);
if ($area_dl227_percent > 1) {
echo "\n\t<tr>\n\t\t<td class='zoning'>Vincolo Boschi</td>\n\t\t<td class='zoning'>&nbsp;&nbsp;Art.2 D.L. 18 maggio 2001, n. 227</td>\n\t\t<td class='zoning2'>&nbsp;&nbsp;&nbsp;({$area_dl227_percent}%)</td>\n\t</tr>";
//####### BEGIN RECORD ########
$record_vincoli[] = "Vincolo Boschi (Art.2 D.L. 18 maggio 2001, n. 227)\n";
//####### END RECORD ########
}}}
// FINE DEFINIZIONE DELLA COPERTURA DEL VINCOLO BOSCHI DL227
// INIZIO DEFINIZIONE DELLA COPERTURA DEL VINCOLO BOSCHI LR16
/* */
$query_lr16 = "SELECT ST_AREA(ST_intersection(a.geom, b.geom)) AS arealr16 FROM (SELECT geom FROM ".strtolower($_SESSION['COMUNE_PROV']).".sif_lr16) a, (SELECT ST_GeomFromEWKT('SRID=25833;".$_SESSION['geom']."') as geom) b WHERE ST_Intersects (a.geom,b.geom)";
$result_query_lr16 = pg_query($conn, $query_lr16) or die('Query query_lr16 failied');
if (pg_num_rows($result_query_lr16) > 0) {
while($row8 = pg_fetch_assoc($result_query_lr16)) {
$area_lr16_percent = round(($row8['arealr16']/$area_sezione)*100,2);
if ($area_lr16_percent > 1) {
echo "\n\t<tr>\n\t\t<td class='zoning'>Vincolo Boschi</td>\n\t\t<td class='zoning'>&nbsp;&nbsp;L.R. 16/96 art. 4</td>\n\t\t<td class='zoning2'>&nbsp;&nbsp;&nbsp;{$copertura_lr16}&nbsp;({$area_lr16_percent}%)</td>\n\t</tr>";
//####### BEGIN RECORD ########
$record_vincoli[] = "Vincolo Boschi (L.R. 16/96 art. 4)\n";
//####### END RECORD ########
}}}
// FINE DEFINIZIONE DELLA COPERTURA DEL VINCOLO BOSCHI LR16
// INIZIO DEFINIZIONE DELLA COPERTURA SIC-ZPS
$query_siczps = "SELECT a.denom, ST_AREA(ST_intersection(a.geom, b.geom)) AS areasiczps FROM (SELECT denom, geom FROM rscarto.sic_zps) a, (SELECT ST_GeomFromEWKT('SRID=25833;".$_SESSION['geom']."') as geom) b WHERE ST_Intersects (a.geom,b.geom)";
$result_query_siczps = pg_query($conn, $query_siczps) or die('Query query_siczps failied');
if (pg_num_rows($result_query_siczps) > 0) {
while($row81 = pg_fetch_assoc($result_query_siczps)) {
$area_siczps_percent = round(($row81['areasiczps']/$area_sezione)*100,2);
if ($area_siczps_percent > 1) {
echo "\n\t<tr>\n\t\t<td class='zoning'>SIC - ZPS</td>\n\t\t<td class='zoning'>{$row81['codice']} - {$row81['denom']}</td>\n\t\t<td class='zoning2'>&nbsp;&nbsp;&nbsp;({$area_siczps_percent}%)</td>\n\t</tr>";
//####### BEGIN RECORD ########
$record_vincoli[] = "SIC-ZPS (".$row81['codice']."-".$row81['denom'].")\n";
//####### END RECORD ########
}}}
// FINE DEFINIZIONE DELLA COPERTURA SIC-ZPS
// INIZIO DEFINIZIONE DELLA COPERTURA RISERVE
$query_riserve = "SELECT a.denom, ST_AREA(ST_intersection(a.geom, b.geom)) AS areariserve FROM (SELECT denom, geom FROM rscarto.riserve_sicilia) a, (SELECT ST_GeomFromEWKT('SRID=25833;".$_SESSION['geom']."') as geom) b WHERE ST_Intersects (a.geom,b.geom)";
$result_query_riserve = pg_query($conn, $query_riserve) or die('Query query_riserve failied');
if (pg_num_rows($result_query_riserve) > 0) {
while($row82 = pg_fetch_assoc($result_query_riserve)) {
$area_riserva_percent = round(($row82['areariserve']/$area_sezione)*100,2);
if ($area_riserva_percent > 1) {
echo "\n\t<tr>\n\t\t<td class='zoning'>RISERVE</td>\n\t\t<td class='zoning'>{$row82['codice']} - {$row82['denom']}</td>\n\t\t<td class='zoning2'>&nbsp;&nbsp;&nbsp;({$area_riserva_percent}%)</td>\n\t</tr>";
//####### BEGIN RECORD ########
$record_vincoli[] = "RISERVE (".$row82['codice']."-".$row82['denom'].")\n";
//####### END RECORD ########
}}}
// FINE DEFINIZIONE DELLA COPERTURA RISERVE
// INIZIO DEFINIZIONE DELLA COPERTURA PAI IDRO RISCHIO
$query_idro_rischio = "SELECT a.rischio, ST_AREA(ST_intersection(a.geom, b.geom)) AS area_idro_rischio FROM (SELECT rischio, geom FROM rscarto.pai_idr_r) a, (SELECT ST_GeomFromEWKT('SRID=25833;".$_SESSION['geom']."') as geom) b WHERE ST_Intersects (a.geom,b.geom)";
$result_query_idro_rischio = pg_query($conn, $query_idro_rischio) or die('Query query_idro_rischio failied');
if (pg_num_rows($result_query_idro_rischio) > 0) {
while($row9 = pg_fetch_assoc($result_query_idro_rischio)) {
$area_idro_r_percent = round(($row9['area_idro_rischio']/$area_sezione)*100,2);
if ($area_idro_r_percent > 1) {
echo "\n\t<tr>\n\t\t<td class='zoning'>P.A.I.</td>\n\t\t<td class='zoning'>Rischio Idraulico - {$row9['rischio']}</td>\n\t\t<td class='zoning2'>&nbsp;&nbsp;&nbsp;({$area_idro_r_percent}%)</td>\n\t</tr>";
//####### BEGIN RECORD ########
$record_vincoli[] = "P.A.I. (Rischio Idraulico - ".$row9['rischio'].")\n";
//####### END RECORD ########
}}}
// FINE DEFINIZIONE DELLA COPERTURA PAI IDRO RISCHIO
// INIZIO DEFINIZIONE DELLA COPERTURA PAI IDRO PERICOLOSITA'
$query_idro_pericolo = "SELECT a.pericolo, ST_AREA(ST_intersection(a.geom, b.geom)) AS area_idro_pericolo FROM (SELECT pericolo, geom FROM rscarto.pai_idr_p_sa) a, (SELECT ST_GeomFromEWKT('SRID=25833;".$_SESSION['geom']."') as geom) b WHERE ST_Intersects (a.geom,b.geom)";
$result_query_idro_pericolo = pg_query($conn, $query_idro_pericolo) or die('Query query_idro_pericolo failied');
if (pg_num_rows($result_query_idro_pericolo) > 0) {
while($row10 = pg_fetch_assoc($result_query_idro_pericolo)) {
$area_idro_p_percent = round(($row10['area_idro_pericolo']/$area_sezione)*100,2);
if ($area_idro_r_percent > 1) {
echo "\n\t<tr>\n\t\t<td class='zoning'>P.A.I.</td>\n\t\t<td class='zoning'>Pericolosità Idraulica - {$row10['pericolo']}</td>\n\t\t<td class='zoning2'>&nbsp;&nbsp;&nbsp;({$area_idro_p_percent}%)</td>\n\t</tr>";
//####### BEGIN RECORD ########
$record_vincoli[] = "P.A.I. (Pericolosità Idraulica - ".$row10['pericolo'].")\n";
//####### END RECORD ########
}}}
// FINE DEFINIZIONE DELLA COPERTURA PAI IDRO RISCHIO
// INIZIO DEFINIZIONE DELLA COPERTURA PAI GEOMORF RISCHIO
$query_geo_rischio = "SELECT a.rischio, ST_AREA(ST_intersection(a.geom, b.geom)) AS area_geo_rischio FROM (SELECT rischio, geom FROM rscarto.pai_geo_rischio) a, (SELECT ST_GeomFromEWKT('SRID=25833;".$_SESSION['geom']."') as geom) b WHERE ST_Intersects (a.geom,b.geom)";
$result_query_geo_rischio = pg_query($conn, $query_geo_rischio) or die('Query query_geo_rischio failied');
if (pg_num_rows($result_query_geo_rischio) > 0) {
while($row11 = pg_fetch_assoc($result_query_geo_rischio)) {
$area_geo_r_percent = round(($row11['area_geo_rischio']/$area_sezione)*100,2);
if ($area_geo_r_percent > 10) {
echo "\n\t<tr>\n\t\t<td class='zoning'>P.A.I.</td>\n\t\t<td class='zoning'>Rischio Geomorfologico - {$row11['rischio']}</td>\n\t\t<td class='zoning2'>&nbsp;&nbsp;&nbsp;({$area_geo_r_percent}%)</td>\n\t</tr>";
//####### BEGIN RECORD ########
$record_vincoli[] = "P.A.I. (Rischio Geomorfologico - ".$row11['rischio'].")\n";
//####### END RECORD ########
}}}
// FINE DEFINIZIONE DELLA COPERTURA PAI GEOMORF RISCHIO
// INIZIO DEFINIZIONE DELLA COPERTURA PAI GEOMORF PERICOLOSITA
$query_geo_pericolo = "SELECT a.pericolo, ST_AREA(ST_intersection(a.geom, b.geom)) AS area_geo_pericolo FROM (SELECT pericolo, geom FROM rscarto.pai_geo_peric) a, (SELECT ST_GeomFromEWKT('SRID=25833;".$_SESSION['geom']."') as geom) b WHERE ST_Intersects (a.geom,b.geom)";
$result_query_geo_pericolo = pg_query($conn, $query_geo_pericolo) or die('Query query_geo_pericolo failied');
if (pg_num_rows($result_query_geo_pericolo) > 0) {
while($row12 = pg_fetch_assoc($result_query_geo_pericolo)) {
$area_geo_p_percent = round(($row12['area_geo_pericolo']/$area_sezione)*100,2);
if ($area_geo_p_percent > 1) {
echo "\n\t<tr>\n\t\t<td class='zoning'>P.A.I.</td>\n\t\t<td class='zoning'>Pericolosità Geomorfologica - {$row12['pericolo']}</td>\n\t\t<td class='zoning2'>&nbsp;&nbsp;&nbsp;({$area_geo_p_percent}%)</td>\n\t</tr>";
//####### BEGIN RECORD ########
$record_vincoli[] = "P.A.I. (Pericolosità Geomorfologica - ".$row12['pericolo'].")\n";
//####### END RECORD ########
}}}
// FINE DEFINIZIONE DELLA COPERTURA PAI GEOMORF PERICOLOSITA
// INIZIO DEFINIZIONE DELLA COPERTURA SIN
$query_sin = "SELECT a.denominaz, ST_AREA(ST_intersection(a.geom, b.geom)) AS area_sin FROM (SELECT denominaz, geom FROM rscarto.sin) a, (SELECT ST_GeomFromEWKT('SRID=25833;".$_SESSION['geom']."') as geom) b WHERE ST_Intersects (a.geom,b.geom)";
$result_query_sin = pg_query($conn, $query_sin) or die('Query query_sin failied');
if (pg_num_rows($result_query_sin) > 0) {
while($rowsin = pg_fetch_assoc($result_query_sin)) {
$area_sin_percent = round(($rowsin['area_sin']/$area_sezione)*100,2);
if ($area_sin_percent > 1) {
echo "\n\t<tr>\n\t\t<td class='zoning'>SIN</td>\n\t\t<td class='zoning'>Sito di Interesse Nazionale</td>\n\t\t<td class='zoning2'>&nbsp;&nbsp;&nbsp;({$area_sin_percent}%)</td>\n\t</tr>";
//####### BEGIN RECORD ########
$record_vincoli[] = "SIN (Sito di Interesse Nazionale)\n";
//####### END RECORD ########
}}}
// FINE DEFINIZIONE DELLA COPERTURA SIN
}
//pg_close($conn);
?>
<!-- ======================= DATI CDU STOP ======================== -->
<?php //echo "TEMPO DI ESECUZIONE = ".(microtime(true) - $start).' sec'; ?>
</table>
</td>
</tr>
<tr>
<td colspan="2">&nbsp;</td>
</tr>
<tr>
<td colspan="2">I dati rappresentati non hanno validità legale e devono essere rilasciati ufficialmente dall'ufficio competente.</td>
</tr>
<?php if (count($record_paesaggio) > count($daticata_view)) { ?>
<input type="hidden" name="paesaggioLocale" value="<?php foreach($record_paesaggio as $value){echo $value;}?>">
<?php } ?>
<?php if (count($record_tutela) > count($daticata_view)) { ?>
<input type="hidden" name="livelloDiTutela" value="<?php foreach($record_tutela as $value_tutela){echo $value_tutela;}?>">
<?php } ?>
<?php if (count($record_vincoli) > count($daticata_view)) { ?>
<input type="hidden" name="vincoli" value="<?php foreach($record_vincoli as $value_vincoli){echo $value_vincoli;}?>">
<?php } ?>
<input type="hidden" name="latitudine" value="<?php foreach($coord_lat as $value_lat){echo $value_lat;}?>">
<input type="hidden" name="longitudine" value="<?php foreach($coord_long as $value_long){echo $value_long;}?>">
<!--tr>
<td colspan="2"><input class="btn btn-primary btn-xs btn-block" type="submit" value="Conferma dati"> </td>
</tr-->
</form>
<tr>
<td colspan="2"><br><br><div id="json" style="display:none"></div></td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
</table>
<script>
window.addEventListener('load', function() {
// document.getElementById('geomap').addEventListener('submit', formSubmit);
formSubmit();
});
function formSubmit(e) {
//e.preventDefault();
var form = document.getElementById('geomap');
var formData = new FormData(form);
var dati = JSON.stringify(Object.fromEntries(formData.entries()));
document.getElementById('json').innerText = dati;
window.parent.parent.postMessage(dati, '*');
}
</script>

657
cdu_level.php

@ -0,0 +1,657 @@
<!-- ======================= DATI CDU START ======================== -->
<?php
// AREA INTERESSATA DALLA PARTICELLA RISPETTO ALLA ZONIZZAZIONE
if(!$query3 = @pg_query("SELECT gid, foglio, numero, ST_AsText(the_geom) AS geometria, ST_Area(the_geom) as area FROM ".$comu_cata." where gid = $cataid;"))
die("ERROR STR2: " . pg_last_error($conn));
while($row3 = pg_fetch_assoc($query3)) {
$_SESSION['THE_GEOM'] = $row3['geometria'];
$foglio = $row3['foglio'];
$area_sezione = $row3['area'];
$particella = $row3['numero'];
$idparticella = $row3['gid'];
// PARTICELLE INTERESSATE
echo "\n\t<tr>\n\t\t<td class='particella' colspan='3'>&nbsp;&nbsp;&nbsp;Foglio {$foglio}&nbsp;&nbsp;e&nbsp;&nbsp;Particella {$particella}</td>\n\t</tr>";
//####### BEGIN RECORD ########
$record_paesaggio[] = "Foglio ".$foglio." - Particella".$particella."\n";
$record_tutela[] = "Foglio ".$foglio." - Particella".$particella."\n";
$record_vincoli[] = "Foglio ".$foglio." - Particella".$particella."\n";
//####### END RECORD ########
// INIZIO DEFINIZIONE DELLA COPERTURA DELLA ZONAZIONE
if(!$query4 = @pg_query("SELECT zon_sigla, zon_descr, ST_Area(the_geom) as areazto, zon_art FROM ".
" (SELECT ST_Intersection(e.the_geom, f.the_geom) as the_geom, e.zon_sigla, e.zon_descr, e.zon_art FROM ".
" (SELECT a.the_geom, a.zon_sigla, a.zon_descr, a.zon_art FROM $comu_prg a inner join ".
" (SELECT the_geom FROM $comu_cata where gid = $idparticella) b on ST_Intersects(a.the_geom, b.the_geom)) e inner join ".
" (SELECT * FROM $comu_cata where gid = $idparticella) f on ST_Intersects(e.the_geom, f.the_geom)) a;"))
die("ERROR STR3: " . pg_last_error($conn));
while($row4 = pg_fetch_assoc($query4)) {
$areazto = $row4['areazto'];
$areazto_percent = round(($areazto/$area_sezione)*100,2);
$areazto_percentuale[] = round(($areazto/$area_sezione)*100,2);
// PARAMETRI DELLA COPERTURA DI PRG
if ($areazto_percent > 80) {
$copertura_zonprg = "Completamente";
}
if ($areazto_percent > 60 AND $areazto_percent < 80) {
$copertura_zonprg = "Per la maggior parte";
}
if ($areazto_percent > 40 AND $areazto_percent < 59) {
$copertura_zonprg = "In parte";
}
if ($areazto_percent > 10 AND $areazto_percent < 39) {
$copertura_zonprg = "In minima parte";
}
$zto_array[] = $row4['zon_sigla']." - ".row4['zon_descr'];
//####### BEGIN RECORD ########
//$record_form[] = row4['zon_descr']."\n";
//####### END RECORD ########
if ($areazto_percent > 10) { //SOGLIA DI VISUALIZZAZIONE SOVRAPPOSIZIONE (20%)
echo "\n\t<tr>\n\t\t<td class='zoning'>Zona di PRG</td>\n\t\t<td class='zoning'>{$row4['zon_sigla']} - {$row4['zon_descr']}</td>\n\t\t<td class='zoning'>&nbsp;&nbsp;&nbsp;{$copertura_zonprg}&nbsp;({$areazto_percent}%)</td>\n\t</tr>";
$ntart[] = $row4['zon_art'];
}
}
// FINE DEFINIZIONE DELLA COPERTURA DELLA ZONAZIONE
// INIZIO DEFINIZIONE DELLA COPERTURA DEI VINCOLI DI PRG
if(!$query5 = @pg_query("SELECT zon_descr, ST_Area(the_geom) as areavinc from ".
" (SELECT ST_Intersection(e.the_geom, f.the_geom) as the_geom, e.zon_descr FROM ".
" (SELECT a.the_geom, a.zon_descr from ".$comu_vincoprg." a inner join ".
" (SELECT the_geom FROM ".$comu_cata." where gid=$idparticella) b on ST_Intersects(a.the_geom, b.the_geom)) e inner join ".
" (SELECT * FROM ".$comu_cata." where gid=$idparticella) f on ST_Intersects(e.the_geom, f.the_geom)) a;"))
die("Error STR4: " . pg_last_error($conn));
$row_query5 = pg_num_rows($query5);
if ($row_query5 > 0) {
while($row5 = pg_fetch_assoc($query5)) {
$area_vinc = $row5['areavinc'];
$areavinc_percent = round(($area_vinc/$area_sezione)*100,2);
// PARAMETRI DELLA COPERTURA DEI VINCOLI
if ($areavinc_percent > 80) {
$copertura_vincprg = "Completamente";
}
if ($areavinc_percent > 60 AND $areavinc_percent < 80) {
$copertura_vincprg = "Per la maggior parte";
}
if ($areavinc_percent > 40 AND $areavinc_percent < 59) {
$copertura_vincprg = "In parte";
}
if ($areavinc_percent > 10 AND $areavinc_percent < 39) {
$copertura_vincprg = "In minima parte";
}
if ($areavinc_percent > 10) { //SOGLIA DI VISUALIZZAZIONE SOVRAPPOSIZIONE (20%)
echo "\n\t<tr>\n\t\t<td class='zoning'>Vincolo di PRG</td>\n\t\t<td class='zoning'>{$row5['zon_descr']}</td>\n\t\t<td class='zoning'>&nbsp;&nbsp;&nbsp;{$copertura_vincprg}&nbsp;({$areavinc_percent}%)</td>\n\t</tr>";
}
}
}
// FINE DEFINIZIONE DELLA COPERTURA DEI VINCOLI DI PRG
// INIZIO DEFINIZIONE DELLA COPERTURA DEI VINCOLI BBCCAA
//DEFINIZIONE conndbESSIONE
if(!$query6 = @pg_query("SELECT art142_a, art142_b, art142_c, art142_f, art142_g, art142_m, art10_arch, art134_a, art134_c, liv_tutela, contesto, nome_conte, ST_Area(the_geom) as areabbccaa FROM ".
" (SELECT ST_Intersection(e.the_geom, f.the_geom) as the_geom, e.art142_a, e.art142_b, e.art142_c, e.art142_f, e.art142_g, e.art142_m, e.art10_arch, e.art134_a, e.art134_c, e.liv_tutela, e.contesto, e.nome_conte FROM ".
" (SELECT a.the_geom, a.art142_a, a.art142_b, a.art142_c, a.art142_f, a.art142_g, a.art142_m, a.art10_arch, a.art134_a, a.art134_c, a.liv_tutela, a.contesto, a.nome_conte FROM dbcarto.regimi_normativi_".strtolower($_SESSION['COMUNE_PROV'])." a inner join ".
" (SELECT ST_GeomFromEWKT('SRID=3004;".$_SESSION['THE_GEOM']."') as the_geom) b on ST_Intersects(a.the_geom, b.the_geom)) e inner join ".
" (SELECT ST_GeomFromEWKT('SRID=3004;".$_SESSION['THE_GEOM']."') as the_geom) f on ST_Intersects(e.the_geom, f.the_geom)) a;"))
die("ERROR STR5: " . pg_last_error($conn));
$row_query6 = pg_num_rows($query6);
if ($row_query6 > 0) {
//echo "####".$row_query6. "####";
while($row6 = pg_fetch_assoc($query6)) {
$area_bbccaa = $row6['areabbccaa'];
$area_bbccaa_percent = round(($area_bbccaa/$area_sezione)*100,2);
// PARAMETRI DELLA COPERTURA DEI VINCOLI
if ($area_bbccaa_percent > 80) {
$copertura_bbccaa = "Completamente";
}
if ($area_bbccaa_percent > 60 AND $area_bbccaa_percent < 80) {
$copertura_bbccaa = "Per la maggior parte";
}
if ($area_bbccaa_percent > 40 AND $area_bbccaa_percent < 59) {
$copertura_bbccaa = "In parte";
}
if ($area_bbccaa_percent > 10 AND $area_bbccaa_percent < 39) {
$copertura_bbccaa = "In minima parte";
}
if ($row6['art142_a'] <> "") {
$art142_a = "<b>Art.142a - Aree tutelate per legge</b>:<br>territori costieri compresi in una fascia di 300m dalla linea di battigia<br>";
}
if ($row6['art142_b'] <> "") {
$art142_b = "<b>Art.142b - Aree tutelate per legge</b>:<br>territori contermini ai laghi in una fascia di 300m dalla linea di battigia<br>";
}
if ($row6['art142_c'] <> "") {
$art142_c = "<b>Art.142c - Aree tutelate per legge</b>:<br>fascia di 150m da fiumi, torrenti e corsi d'acqua<br>";
}
if ($row6['art142_f'] <> "") {
$art142_f = "<b>Art.142f - Aree tutelate per legge</b>:<br>parchi e riserve nazionali o regionali<br>";
}
if ($row6['art142_g'] <> "") {
$art142_g = "<b>Art.142g - Aree tutelate per legge</b>:<br>territori coperti da foreste e da boschi anche percorsi o danneggiati dal fuoco<br>";
}
if ($row6['art142_m'] <> "") {
$art142_m = "<b>Art.142m - Aree tutelate per legge</b>:<br>zone di interesse archeologico<br>";
}
if ($row6['art10_arch'] <> "") {
$art10_arch = "<b>Art.10 - comma 11 L.R. 6 aprile 1996</b>:<br>zona di rispetto dei boschi e delle fasce forestali<br>";
}
if ($row6['art134_a'] <> "") {
$art134_a = "<b>Art.134a - Vincoli Paesaggistici ex L. 1497/39</b><br>";
}
if ($row6['art134_c'] <> "") {
$art134_c = "<b>Art.134c - Codice dei Beni Culturali e del Paesaggio<br>";
}
switch ($row6['liv_tutela']) {
case 1:
$bbccaa = "Livello di tutela 1";
break;
case 2:
$bbccaa = "Livello di tutela 2";
break;
case 3:
$bbccaa = "Livello di tutela 3";
break;
case 4:
$bbccaa = "Livello di tutela 4";
break;
default:
$bbccaa = "";
}
if ($area_bbccaa_percent > 1) { //SOGLIA DI VISUALIZZAZIONE SOVRAPPOSIZIONE (20%)
echo "\n\t<tr>\n\t\t<td class='zoning'>Piano Paesaggistico Regionale</td>\n\t\t<td class='zoning'>{$bbccaa} - Contesto <b>{$row6['contesto']}</b><br>
<b>{$row6['nome_conte']}</b><br>
{$art142_a}{$art142_b}{$art142_c}{$art142_f}{$art142_g}{$art142_m}{$art142_m}{$art134_a}{$art134_c}
</td>\n\t\t<td class='zoning'>&nbsp;&nbsp;&nbsp;{$copertura_bbccaa}&nbsp;({$area_bbccaa_percent}%)</td>\n\t</tr>";
//####### BEGIN RECORD ########
$record_paesaggio[] = $row6['nome_conte']."\n";
$record_tutela[] = $bbccaa."\n";
//####### END RECORD ########
}
}
// FINE DEFINIZIONE DELLA COPERTURA DEI VINCOLI BBCCAA
}
// INIZIO DEFINIZIONE DELLA COPERTURA DEL VINCOLO IDROGEOLOGICO
if(!$query7 = @pg_query("SELECT ST_Area(the_geom) as areaidro from ".
" (SELECT ST_Intersection(e.the_geom, f.the_geom) as the_geom FROM ".
" (SELECT a.the_geom FROM dbcarto.sif_vincolo_idrogeo_sicilia a inner join ".
" (SELECT ST_GeomFromEWKT('SRID=3004;".$_SESSION['THE_GEOM']."') as the_geom) b on ST_Intersects(a.the_geom, b.the_geom)) e inner join ".
" (SELECT ST_GeomFromEWKT('SRID=3004;".$_SESSION['THE_GEOM']."') as the_geom) f on ST_Intersects(e.the_geom, f.the_geom)) a;"))
die("ERROR STR6: " . pg_last_error($conn));
$row_query7 = pg_num_rows($query7);
if ($row_query7 > 0) {
//echo "#### - 7 ".$row_query7. "####";
while($row7 = pg_fetch_assoc($query7)) {
$area_idro = $row7['areaidro'];
$area_idro_percent = round(($area_idro/$area_sezione)*100,2);
// PARAMETRI DELLA COPERTURA DEI VINCOLI
if ($area_idro_percent > 80) {
$copertura_idro = "Completamente";
}
if ($area_idro_percent > 60 AND $area_idro_percent < 80) {
$copertura_idro = "Per la maggior parte";
}
if ($area_idro_percent > 40 AND $area_idro_percent < 59) {
$copertura_idro = "In parte";
}
if ($area_idro_percent > 10 AND $area_idro_percent < 39) {
$copertura_idro = "In minima parte";
}
if ($area_idro_percent > 10) { //SOGLIA DI VISUALIZZAZIONE SOVRAPPOSIZIONE (20%)
echo "\n\t<tr>\n\t\t<td class='zoning'>Vincolo Idrogeologico</td>\n\t\t<td class='zoning'>R.D.L. n° 3267 del 30/12/1923</td>\n\t\t<td class='zoning'>&nbsp;&nbsp;&nbsp;{$copertura_idro}&nbsp;({$area_idro_percent}%)</td>\n\t</tr>";
}
}
}
// FINE DEFINIZIONE DELLA COPERTURA VINCOLO IDROGEOLOGICO
// INIZIO DEFINIZIONE DELLA COPERTURA DEL VINCOLO BOSCHI DL227
if(!$query8 = @pg_query("SELECT ST_Area(the_geom) as areadl227 from ".
" (SELECT ST_Intersection(e.the_geom, f.the_geom) as the_geom FROM ".
" (SELECT a.the_geom FROM dbcarto.cfrs_dl227 a inner join ".
" (SELECT ST_GeomFromEWKT('SRID=3004;".$_SESSION['THE_GEOM']."') as the_geom) b on ST_Intersects(a.the_geom, b.the_geom)) e inner join ".
" (SELECT ST_GeomFromEWKT('SRID=3004;".$_SESSION['THE_GEOM']."') as the_geom) f on ST_Intersects(e.the_geom, f.the_geom)) a;"))
die("ERROR STR7: " . pg_last_error($conn));
$row_query8 = pg_num_rows($query8);
if ($row_query8 > 0) {
//echo "#### - 7 ".$row_query7. "####";
while($row8 = pg_fetch_assoc($query8)) {
$area_dl227 = $row8['areadl227'];
$area_dl227_percent = round(($area_dl227/$area_sezione)*100,2);
// PARAMETRI DELLA COPERTURA DEI VINCOLI
if ($area_dl227_percent > 80) {
$copertura_dl227 = "Completamente";
}
if ($area_dl227_percent > 60 AND $area_dl227_percent < 80) {
$copertura_dl227 = "Per la maggior parte";
}
if ($area_dl227_percent > 40 AND $area_dl227_percent < 59) {
$copertura_dl227 = "In parte";
}
if ($area_dl227_percent > 10 AND $area_dl227_percent < 39) {
$copertura_dl227 = "In minima parte";
}
if ($area_dl227_percent > 10) { //SOGLIA DI VISUALIZZAZIONE SOVRAPPOSIZIONE (20%)
echo "\n\t<tr>\n\t\t<td class='zoning'>Vincolo Boschi</td>\n\t\t<td class='zoning'>&nbsp;&nbsp;Art.2 D.L. 18 maggio 2001, n. 227</td>\n\t\t<td class='zoning'>&nbsp;&nbsp;&nbsp;{$copertura_dl227}&nbsp;({$area_dl227_percent}%)</td>\n\t</tr>";
//####### BEGIN RECORD ########
$record_vincoli[] = "Vincolo Boschi (Art.2 D.L. 18 maggio 2001, n. 227)\n";
//####### END RECORD ########
}
}
}
// FINE DEFINIZIONE DELLA COPERTURA DEL VINCOLO BOSCHI DL227
// INIZIO DEFINIZIONE DELLA COPERTURA DEL VINCOLO BOSCHI LR16
if(!$query8 = @pg_query("SELECT ST_Area(the_geom) as arealr16 from ".
" (SELECT ST_Intersection(e.the_geom, f.the_geom) as the_geom FROM ".
" (SELECT a.the_geom FROM dbcarto.cfrs_lr16 a inner join ".
" (SELECT ST_GeomFromEWKT('SRID=3004;".$_SESSION['THE_GEOM']."') as the_geom) b on ST_Intersects(a.the_geom, b.the_geom)) e inner join ".
" (SELECT ST_GeomFromEWKT('SRID=3004;".$_SESSION['THE_GEOM']."') as the_geom) f on ST_Intersects(e.the_geom, f.the_geom)) a;"))
die("ERROR STR8c: " . pg_last_error($conn));
$row_query8 = pg_num_rows($query8);
if ($row_query8 > 0) {
//echo "#### - 7 ".$row_query7. "####";
while($row8 = pg_fetch_assoc($query8)) {
$area_lr16 = $row8['arealr16'];
$area_lr16_percent = round(($area_lr16/$area_sezione)*100,2);
// PARAMETRI DELLA COPERTURA DEI VINCOLI
if ($area_lr16_percent > 80) {
$copertura_lr16 = "Completamente";
}
if ($area_lr16_percent > 60 AND $area_lr16_percent < 80) {
$copertura_lr16 = "Per la maggior parte";
}
if ($area_lr16_percent > 40 AND $area_lr16_percent < 59) {
$copertura_lr16 = "In parte";
}
if ($area_lr16_percent > 10 AND $area_lr16_percent < 39) {
$copertura_lr16 = "In minima parte";
}
if ($area_lr16_percent > 10) { //SOGLIA DI VISUALIZZAZIONE SOVRAPPOSIZIONE (20%)
echo "\n\t<tr>\n\t\t<td class='zoning'>Vincolo Boschi</td>\n\t\t<td class='zoning'>&nbsp;&nbsp;L.R. 16/96 art. 4</td>\n\t\t<td class='zoning'>&nbsp;&nbsp;&nbsp;{$copertura_lr16}&nbsp;({$area_lr16_percent}%)</td>\n\t</tr>";
//####### BEGIN RECORD ########
$record_vincoli[] = "Vincolo Boschi (L.R. 16/96 art. 4)\n";
//####### END RECORD ########
}
}
}
// FINE DEFINIZIONE DELLA COPERTURA DEL VINCOLO BOSCHI LR16
// INIZIO DEFINIZIONE DELLA COPERTURA SIC-ZPS
if(!$query81 = @pg_query("SELECT codice, denomi, ST_Area(the_geom) as areasiczps from ".
" (SELECT ST_Intersection(e.the_geom, f.the_geom) as the_geom, e.codice, e.denomi FROM ".
" (SELECT a.codice, a.denomi, a.the_geom FROM dbcarto.sic_zps_sicilia a inner join ".
" (SELECT ST_GeomFromEWKT('SRID=3004;".$_SESSION['THE_GEOM']."') as the_geom) b on ST_Intersects(a.the_geom, b.the_geom)) e inner join ".
" (SELECT ST_GeomFromEWKT('SRID=3004;".$_SESSION['THE_GEOM']."') as the_geom) f on ST_Intersects(e.the_geom, f.the_geom)) a;"))
die("ERROR STR8a: " . pg_last_error($conndb));
$row_query81 = pg_num_rows($query81);
if ($row_query81 > 0) {
//echo "#### - 7 ".$row_query7. "####";
while($row81 = pg_fetch_assoc($query81)) {
$area_siczps = $row81['areasiczps'];
$area_siczps_percent = round(($area_siczps/$area_sezione)*100,2);
// PARAMETRI DELLA COPERTURA DEI VINCOLI
if ($$area_siczps_percent > 80) {
$copertura_siczps = "Completamente";
}
if ($area_siczps_percent > 60 AND $area_siczps_percent < 80) {
$copertura_siczps = "Per la maggior parte";
}
if ($area_siczps_percent > 40 AND $area_siczps_percent < 59) {
$copertura_siczps = "In parte";
}
if ($$area_siczps_percent > 10 AND $area_siczps_percent < 39) {
$copertura_siczps = "In minima parte";
}
if ($area_siczps_percent > 10) { //SOGLIA DI VISUALIZZAZIONE SOVRAPPOSIZIONE (20%)
echo "\n\t<tr>\n\t\t<td class='zoning'>SIC - ZPS</td>\n\t\t<td class='zoning'>{$row81['codice']} - {$row81['denominazi']}</td>\n\t\t<td class='zoning'>&nbsp;&nbsp;&nbsp;{$copertura_siczps}&nbsp;({$area_siczps_percent}%)</td>\n\t</tr>";
//####### BEGIN RECORD ########
$record_vincoli[] = "SIC-ZPS (".$row81['codice']."-".$row81['denominazi'].")\n";
//####### END RECORD ########
}
}
}
// FINE DEFINIZIONE DELLA COPERTURA SIC-ZPS
// INIZIO DEFINIZIONE DELLA COPERTURA RISERVE
if(!$query82 = @pg_query("SELECT codice, denom, ST_Area(the_geom) as areariserve from ".
" (SELECT ST_Intersection(e.the_geom, f.the_geom) as the_geom, e.codice, e.denom FROM ".
" (SELECT a.codice, a.denom, a.the_geom FROM dbcarto.riserve_sicilia a inner join ".
" (SELECT ST_GeomFromEWKT('SRID=3004;".$_SESSION['THE_GEOM']."') as the_geom) b on ST_Intersects(a.the_geom, b.the_geom)) e inner join ".
" (SELECT ST_GeomFromEWKT('SRID=3004;".$_SESSION['THE_GEOM']."') as the_geom) f on ST_Intersects(e.the_geom, f.the_geom)) a;"))
die("ERROR STR8b: " . pg_last_error($conndb));
$row_query82 = pg_num_rows($query82);
if ($row_query82 > 0) {
//echo "#### - 7 ".$row_query7. "####";
while($row82 = pg_fetch_assoc($query82)) {
$area_riserva = $row82['areariserve'];
$area_riserva_percent = round(($area_riserva/$area_sezione)*100,2);
// PARAMETRI DELLA COPERTURA DEI VINCOLI
if ($area_riserva_percent > 80) {
$copertura_riserva = "Completamente";
}
if ($area_riserva_percent > 60 AND $area_riserva_percent < 80) {
$copertura_riserva = "Per la maggior parte";
}
if ($area_riserva_percent > 40 AND $area_riserva_percent < 59) {
$copertura_riserva = "In parte";
}
if ($area_riserva_percent > 10 AND $area_riserva_percent < 39) {
$copertura_riserva = "In minima parte";
}
if ($area_riserva_percent > 10) { //SOGLIA DI VISUALIZZAZIONE SOVRAPPOSIZIONE (20%)
echo "\n\t<tr>\n\t\t<td class='zoning'>RISERVE</td>\n\t\t<td class='zoning'>{$row82['codice']} - {$row82['denom']}</td>\n\t\t<td class='zoning'>&nbsp;&nbsp;&nbsp;{$copertura_riserva}&nbsp;({$area_riserva_percent}%)</td>\n\t</tr>";
//####### BEGIN RECORD ########
$record_vincoli[] = "RISERVE (".$row82['codice']."-".$row82['denom'].")\n";
//####### END RECORD ########
}
}
}
// FINE DEFINIZIONE DELLA COPERTURA RISERVE
// INIZIO DEFINIZIONE DELLA COPERTURA PAI IDRO RISCHIO
if(!$query9 = @pg_query("SELECT rischio, ST_Area(the_geom) as area_idro_rischio FROM ".
" (SELECT ST_Intersection(e.the_geom, f.the_geom) as the_geom, e.rischio FROM ".
" (SELECT a.the_geom, a.rischio FROM dbcarto.idro_r a inner join ".
" (SELECT ST_GeomFromEWKT('SRID=3004;".$_SESSION['THE_GEOM']."') as the_geom) b on ST_Intersects(a.the_geom, b.the_geom)) e inner join ".
" (SELECT ST_GeomFromEWKT('SRID=3004;".$_SESSION['THE_GEOM']."') as the_geom) f on ST_Intersects(e.the_geom, f.the_geom)) a;"))
die("ERROR STR9: " . pg_last_error($conndb));
$row_query9 = pg_num_rows($query9);
if ($row_query9 > 0) {
//echo "#### - 7 ".$row_query7. "####";
while($row9 = pg_fetch_assoc($query9)) {
$area_idro_r = $row9['area_idro_rischio'];
$area_idro_r_percent = round(($area_idro_r/$area_sezione)*100,2);
// PARAMETRI DELLA COPERTURA DEI VINCOLI
if ($area_idro_r_percent > 80) {
$copertura_pai_idro_r = "Completamente";
}
if ($area_idro_r_percent > 60 AND $area_idro_r_percent < 80) {
$copertura_pai_idro_r = "Per la maggior parte";
}
if ($area_idro_r_percent > 40 AND $area_idro_r_percent < 59) {
$copertura_pai_idro_r = "In parte";
}
if ($area_idro_r_percent > 10 AND $area_idro_r_percent < 39) {
$copertura_pai_idro_r = "In minima parte";
}
if ($area_idro_r_percent > 10) { //SOGLIA DI VISUALIZZAZIONE SOVRAPPOSIZIONE (20%)
echo "\n\t<tr>\n\t\t<td class='zoning'>P.A.I.</td>\n\t\t<td class='zoning'>Rischio Idraulico - {$row9['rischio']}</td>\n\t\t<td class='zoning'>&nbsp;&nbsp;&nbsp;{$copertura_pai_idro_r}&nbsp;({$area_idro_r_percent}%)</td>\n\t</tr>";
//####### BEGIN RECORD ########
$record_vincoli[] = "P.A.I. (Rischio Idraulico - ".$row9['rischio'].")\n";
//####### END RECORD ########
}
}
}
// FINE DEFINIZIONE DELLA COPERTURA PAI IDRO RISCHIO
// INIZIO DEFINIZIONE DELLA COPERTURA PAI IDRO PERICOLOSITA'
if(!$query10 = @pg_query("SELECT pericolo, ST_Area(the_geom) as area_idro_pericolo FROM ".
" (SELECT ST_Intersection(e.the_geom, f.the_geom) as the_geom, e.pericolo FROM ".
" (SELECT a.the_geom, a.pericolo FROM dbcarto.idro_p_sa a inner join ".
" (SELECT ST_GeomFromEWKT('SRID=3004;".$_SESSION['THE_GEOM']."') as the_geom) b on ST_Intersects(a.the_geom, b.the_geom)) e inner join ".
" (SELECT ST_GeomFromEWKT('SRID=3004;".$_SESSION['THE_GEOM']."') as the_geom) f on ST_Intersects(e.the_geom, f.the_geom)) a;"))
die("ERROR STR10: " . pg_last_error($conndb));
$row_query10 = pg_num_rows($query10);
if ($row_query10 > 0) {
//echo "#### - 7 ".$row_query7. "####";
while($row10 = pg_fetch_assoc($query10)) {
$area_idro_p = $row10['area_idro_pericolo'];
$area_idro_p_percent = round(($area_idro_p/$area_sezione)*100,2);
// PARAMETRI DELLA COPERTURA DEI VINCOLI
if ($area_idro_p_percent > 80) {
$copertura_pai_idro_p = "Completamente";
}
if ($area_idro_p_percent > 60 AND $area_idro_p_percent < 80) {
$copertura_pai_idro_p = "Per la maggior parte";
}
if ($area_idro_p_percent > 40 AND $area_idro_p_percent < 59) {
$copertura_pai_idro_p = "In parte";
}
if ($area_idro_p_percent > 10 AND $area_idro_p_percent < 39) {
$copertura_pai_idro_p = "In minima parte";
}
if ($area_idro_r_percent > 10) { //SOGLIA DI VISUALIZZAZIONE SOVRAPPOSIZIONE (20%)
echo "\n\t<tr>\n\t\t<td class='zoning'>P.A.I.</td>\n\t\t<td class='zoning'>Pericolosità Idraulica - {$row10['pericolo']}</td>\n\t\t<td class='zoning'>&nbsp;&nbsp;&nbsp;{$copertura_pai_idro_p}&nbsp;({$area_idro_p_percent}%)</td>\n\t</tr>";
//####### BEGIN RECORD ########
$record_vincoli[] = "P.A.I. (Pericolosità Idraulica - ".$row10['pericolo'].")\n";
//####### END RECORD ########
}
}
}
// FINE DEFINIZIONE DELLA COPERTURA PAI IDRO RISCHIO
// INIZIO DEFINIZIONE DELLA COPERTURA PAI GEOMORF RISCHIO
if(!$query11 = @pg_query("SELECT rischio, ST_Area(the_geom) as area_geo_rischio FROM ".
" (SELECT ST_Intersection(e.the_geom, f.the_geom) as the_geom, e.rischio FROM ".
" (SELECT a.the_geom, a.rischio FROM dbcarto.geo_rischio a inner join ".
" (SELECT ST_GeomFromEWKT('SRID=3004;".$_SESSION['THE_GEOM']."') as the_geom) b on ST_Intersects(a.the_geom, b.the_geom)) e inner join ".
" (SELECT ST_GeomFromEWKT('SRID=3004;".$_SESSION['THE_GEOM']."') as the_geom) f on ST_Intersects(e.the_geom, f.the_geom)) a;"))
die("ERROR STR10: " . pg_last_error($conndb));
$row_query11 = pg_num_rows($query11);
if ($row_query11 > 0) {
//echo "#### - 7 ".$row_query7. "####";
while($row11 = pg_fetch_assoc($query11)) {
$area_geo_r = $row11['area_geo_rischio'];
$area_geo_r_percent = round(($area_geo_r/$area_sezione)*100,2);
// PARAMETRI DELLA COPERTURA DEI VINCOLI
if ($area_geo_r_percent > 80) {
$copertura_pai_geo_r = "Completamente";
}
if ($area_geo_r_percent > 60 AND $area_geo_r_percent < 80) {
$copertura_pai_geo_r = "Per la maggior parte";
}
if ($area_geo_r_percent > 40 AND $area_geo_r_percent < 59) {
$copertura_pai_geo_r = "In parte";
}
if ($area_geo_r_percent > 10 AND $area_geo_r_percent < 39) {
$copertura_pai_geo_r = "In minima parte";
}
if ($area_geo_r_percent > 10) { //SOGLIA DI VISUALIZZAZIONE SOVRAPPOSIZIONE (20%)
echo "\n\t<tr>\n\t\t<td class='zoning'>P.A.I.</td>\n\t\t<td class='zoning'>Rischio Geomorfologico - {$row11['rischio']}</td>\n\t\t<td class='zoning'>&nbsp;&nbsp;&nbsp;{$copertura_pai_geo_r}&nbsp;({$area_geo_r_percent}%)</td>\n\t</tr>";
//####### BEGIN RECORD ########
$record_vincoli[] = "P.A.I. (Rischio Geomorfologico - ".$row11['rischio'].")\n";
//####### END RECORD ########
}
}
}
// FINE DEFINIZIONE DELLA COPERTURA PAI GEOMORF RISCHIO
// INIZIO DEFINIZIONE DELLA COPERTURA PAI GEOMORF PERICOLOSITA
if(!$query12 = @pg_query("SELECT pericolo, ST_Area(the_geom) as area_geo_pericolo FROM ".
" (SELECT ST_Intersection(e.the_geom, f.the_geom) as the_geom, e.pericolo FROM ".
" (SELECT a.the_geom, a.pericolo FROM dbcarto.geo_p_crolli a inner join ".
" (SELECT ST_GeomFromEWKT('SRID=3004;".$_SESSION['THE_GEOM']."') as the_geom) b on ST_Intersects(a.the_geom, b.the_geom)) e inner join ".
" (SELECT ST_GeomFromEWKT('SRID=3004;".$_SESSION['THE_GEOM']."') as the_geom) f on ST_Intersects(e.the_geom, f.the_geom)) a;"))
die("ERROR STR10: " . pg_last_error($conndb));
$row_query12 = pg_num_rows($query12);
if ($row_query12 > 0) {
//echo "#### - 7 ".$row_query7. "####";
while($row12 = pg_fetch_assoc($query12)) {
$area_geo_p = $row12['area_geo_pericolo'];
$area_geo_p_percent = round(($area_geo_p/$area_sezione)*100,2);
// PARAMETRI DELLA COPERTURA DEI VINCOLI
if ($area_geo_p_percent > 80) {
$copertura_pai_geo_p = "Completamente";
}
if ($area_geo_p_percent > 60 AND $area_geo_p_percent < 80) {
$copertura_pai_geo_r = "Per la maggior parte";
}
if ($area_geo_p_percent > 40 AND $area_geo_p_percent < 59) {
$copertura_pai_geo_p = "In parte";
}
if ($area_geo_p_percent > 10 AND $area_geo_p_percent < 39) {
$copertura_pai_geo_p = "In minima parte";
}
if ($area_geo_p_percent > 10) { //SOGLIA DI VISUALIZZAZIONE SOVRAPPOSIZIONE (20%)
echo "\n\t<tr>\n\t\t<td class='zoning'>P.A.I.</td>\n\t\t<td class='zoning'>Pericolosità Geomorfologica - {$row12['pericolo']}</td>\n\t\t<td class='zoning'>&nbsp;&nbsp;&nbsp;{$copertura_pai_geo_p}&nbsp;({$area_geo_p_percent}%)</td>\n\t</tr>";
//####### BEGIN RECORD ########
$record_vincoli[] = "P.A.I. (Pericolosità Geomorfologica - ".$row12['pericolo'].")\n";
//####### END RECORD ########
}
}
}
// FINE DEFINIZIONE DELLA COPERTURA PAI GEOMORF PERICOLOSITA
// INIZIO DEFINIZIONE DELLA COPERTURA INCENDI
if(!$queryfire = @pg_query("SELECT dat_segn, ST_Area(the_geom) as area_fire FROM ".
" (SELECT ST_Intersection(e.the_geom, f.the_geom) as the_geom, e.dat_segn FROM ".
" (SELECT a.the_geom, a.dat_segn FROM public.incendi a inner join ".
" (SELECT ST_GeomFromEWKT('SRID=3004;".$_SESSION['THE_GEOM']."') as the_geom) b on ST_Intersects(a.the_geom, b.the_geom)) e inner join ".
" (SELECT ST_GeomFromEWKT('SRID=3004;".$_SESSION['THE_GEOM']."') as the_geom) f on ST_Intersects(e.the_geom, f.the_geom)) a;"))
die("ERROR STR10: " . pg_last_error($conndb));
$row_queryfire = pg_num_rows($queryfire);
if ($row_queryfire > 0) {
//echo "#### - 7 ".$row_query7. "####";
while($rowfire = pg_fetch_assoc($queryfire)) {
$area_fire = $rowfire['area_fire'];
$area_fire_percent = round(($area_fire/$area_sezione)*100,2);
// PARAMETRI DELLA COPERTURA DEI VINCOLI
if ($area_fire_percent > 80) {
$copertura_fire = "Completamente";
}
if ($area_fire_percent > 60 AND $area_fire_percent < 80) {
$copertura_fire = "Per la maggior parte";
}
if ($area_fire_percent > 40 AND $area_fire_percent < 59) {
$copertura_fire = "In parte";
}
if ($area_fire_percent > 10 AND $area_fire_percent < 39) {
$copertura_fire = "In minima parte";
}
if ($area_fire_percent > 10) { //SOGLIA DI VISUALIZZAZIONE SOVRAPPOSIZIONE (20%)
echo "\n\t<tr>\n\t\t<td class='zoning'>AREE INCENDIATE</td>\n\t\t<td class='zoning'>Evento del {$rowfire['dat_segn']}</td>\n\t\t<td class='zoning'>&nbsp;&nbsp;&nbsp;{$copertura_fire}&nbsp;({$area_fire_percent}%)</td>\n\t</tr>";
}
}
}
// FINE DEFINIZIONE DELLA COPERTURA INCENDI
// INIZIO DEFINIZIONE DELLA COPERTURA SIN
if(!$querysin = @pg_query("SELECT denominaz, ST_Area(the_geom) as area_sin FROM ".
" (SELECT ST_Intersection(e.the_geom, f.the_geom) as the_geom, e.denominaz FROM ".
" (SELECT a.the_geom, a.denominaz FROM dbcarto.sin_priolo a inner join ".
" (SELECT ST_GeomFromEWKT('SRID=3004;".$_SESSION['THE_GEOM']."') as the_geom) b on ST_Intersects(a.the_geom, b.the_geom)) e inner join ".
" (SELECT ST_GeomFromEWKT('SRID=3004;".$_SESSION['THE_GEOM']."') as the_geom) f on ST_Intersects(e.the_geom, f.the_geom)) a;"))
die("ERROR STR10: " . pg_last_error($conndb));
$row_querysin = pg_num_rows($querysin);
if ($row_querysin > 0) {
//echo "#### - 7 ".$row_query7. "####";
while($rowsin = pg_fetch_assoc($querysin)) {
$area_sin = $rowsin['area_sin'];
$area_sin_percent = round(($area_sin/$area_sezione)*100,2);
// PARAMETRI DELLA COPERTURA DEI VINCOLI
if ($area_sin_percent > 80) {
$copertura_sin = "Completamente";
}
if ($area_sin_percent > 60 AND $area_sin_percent < 80) {
$copertura_sin = "Per la maggior parte";
}
if ($area_sin_percent > 40 AND $area_sin_percent < 59) {
$copertura_sin = "In parte";
}
if ($area_sin_percent > 10 AND $area_sin_percent < 39) {
$copertura_sin = "In minima parte";
}
if ($area_sin_percent > 10) { //SOGLIA DI VISUALIZZAZIONE SOVRAPPOSIZIONE (20%)
echo "\n\t<tr>\n\t\t<td class='zoning'>SIN</td>\n\t\t<td class='zoning'>{$rowsin['denominaz']}</td>\n\t\t<td class='zoning'>&nbsp;&nbsp;&nbsp;{$copertura_sin}&nbsp;({$area_sin_percent}%)</td>\n\t</tr>";
//####### BEGIN RECORD ########
$record_vincoli[] = "SIN (".$rowsin['denominaz'].")\n";
//####### END RECORD ########
}
}
}
// FINE DEFINIZIONE DELLA COPERTURA SIN
}
//pg_close($conndb);
?>
<!-- ======================= DATI CDU STOP ======================== -->

42
cfg.php

@ -0,0 +1,42 @@
<?php if (session_id() == "")session_start(); ob_start(); ?>
<?php include_once "cfg_srv.php" ?>
<?php
global $conn, $obj, $id, $comuneuser, $comunebelf, $titoloportlet, $page, $daticata, $foglioparticella, $gidquery, $stringa;
define('CHARSET', 'UTF-8');
// *********** PAGE ***********
$page = basename($_SERVER['PHP_SELF']);
// *********** PAGE ***********
// *********** TIMEOUT SYSTEM DOWNTIME***********
$inactive = 24000;
// check to see if $_SESSION["timeout"] is set
if (isset($_SESSION["timeout"])) {
// calculate the session's "time to live"
$sessionTTL = time() - $_SESSION["timeout"];
if ($sessionTTL > $inactive) {
session_destroy();
//header("Location: logout.php");
echo "<script language=\"javascript\">window.open(\"index\",\"_top\");</script>";
}
}
$_SESSION["timeout"] = time();
if (isset($_GET['obj'])) { $obj = $_GET['obj']; }
if (isset($_GET['id'])) { $id = $_GET['id']; }
//if (!isset($_GET['risk'])) { $_SESSION['RISK'] = ""; }
if (isset($_GET['risk'])) { $_SESSION['RISK'] = $_GET['risk']; }
//$tabella = $_GET['tab'];
//$id = $_REQUEST['id'];
//echo $risk;
$php_blot_key = "rep2021aus";
?>

25
cfg_srv.php

@ -0,0 +1,25 @@
<?php
// *********** HOST DB ***********
global $conn, $hostdb, $dbname, $userdb, $passworddb, $portdb;
//$hostdb = "172.21.1.111";
$hostdb = "localhost";
$dbname ="bbccaa2021";
$userdb = "postgres";
//$passworddb = "AdminRS#2021";
$passworddb = "postgres";
$portdb = "5432";
//DEFINIZIONE CONNESSIONE
$conn = pg_connect ("host=".$hostdb." dbname=".$dbname." user=".$userdb." password=".$passworddb." port=".$portdb."");
if(!$conn) {
//die('Connessione fallita !<br />');
header("location: 500");
} else {
// echo 'Connessione riuscita !<br />';
}
?>

7
decrypt.php

@ -0,0 +1,7 @@
<?php
/**
* define('PHP_BOLT_KEY', 'kyc7fh'); We want give key to client
*/
define('PHP_BOLT_KEY', 'kyc7fh');
bolt_encrypt( 'cfg.php', PHP_BOLT_KEY); return 0;
// ##!!!##i4psiIu8tLxssa+0u2xztLG4uLtsw7u+uLBzh2w=

1387
detail.php

File diff soppresso perché troppo grande Load Diff

166
draw.php

@ -0,0 +1,166 @@
<?php if (session_id() == "")session_start();ob_start(); ?>
<?php include_once "cfg.php" ?>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" type="image/x-icon" href="./assets/img/favicon.png">
<title>mapcloud.it for BBCCAA Regione Sicilia</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" />
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.7.1/dist/leaflet.css" />
<link href="assets/fontawesome/css/all.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Work+Sans">
<link rel="stylesheet" href="assets/css/leaflet.draw.css"/>
<link rel="stylesheet" href="assets/css/style.css"/>
<!--link rel="stylesheet" href="assets/component/leaflet/sidebar/leaflet-sidebar.css" /-->
<link rel="stylesheet" href="assets/component/leaflet/layertree/L.Control.Layers.Tree.css" />
<style>
#sidebar {
z-index: 999;
position: fixed;
width: 230px;
height: 100%;
left: 0px;
overflow-y: auto;
background: #455963;
-webkit-transition: all 0.5s ease;
-moz-transition: all 0.5s ease;
-o-transition: all 0.5s ease;
transition: all 0.5s ease;
}
#sidebar .sidebar-header a {
color: #fff;
display: block;
text-decoration: none;
font-weight: bold;
letter-spacing: 3px;
padding: 5px 0px;
}
#sidebar .sidebar-header {
background-color: #455963;
font-size: 16px;
font-weight: normal;
line-height: 12px;
text-align: center;
}
#sidebar ul li a {
padding: 15px 10px;
font-size: 17px;
display: block;
color: #fff;
border-bottom: 1px solid #939fa5;
text-decoration: none;
transition: 0.4s;
}
#sidebar ul li a:hover {
color: #263238;
background: #fff;
}
#sidebar ul ul a {
font-size: 16px !important;
padding-left: 30px !important;
background: #263238;
}
a.dropdown-toggle.collapsed.dropdown-toggle::after {
display: inline-block;
width: 0;
height: 0;
margin-left: 5px;
vertical-align: 5px;
content: "";
border-bottom: 5px solid;
border-right: 5px solid transparent;
border-top: 0;
float: right;
margin-top: 10px;
}
#sidebar .dropdown-toggle::after {
float: right;
margin-top: 10px;
}
#sidebar .icon {
padding-right: 15px;
}
</style>
<body class="" style="padding-top:0px;">
<div id="app" style="margin-left: 230px;"></div>
<div class="modal fade" id="modalbox" tabindex="-1" role="dialog" aria-labelledby="app_modal_label" aria-hidden="true">
<div id="app_modal_size" class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="app_modal_label"></h5>
</div>
<div id="app_modal_body" class="modal-body"></div>
<div id="app_modal_footer" class="modal-footer">
<button type="button" class="btn btn-secondary btn-sm" data-dismiss="modal"><i class="fa fa-power-off"></i>&nbsp;Close</button>
</div>
</div>
</div>
</div>
<div class="modal fade" id="modalform" tabindex="-1" role="dialog" aria-labelledby="form_modal_label" aria-hidden="true">
<div id="form_modal_size" class="modal-dialog" role="document">
<div class="modal-content">
<form id="dynamicform" name="dynamicform">
<div class="modal-header">
<h5 class="modal-title" id="form_modal_label"></h5>
</div>
<div id="form_modal_body" class="modal-body"></div>
<div id="form_modal_footer" class="modal-footer"></div>
</form>
</div>
</div>
</div>
<div class="modal fade" id="featureModal" tabindex="-1" role="dialog">
<div id="feature_modal_size" class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" id="feature-title"></h4>
</div>
<div id="feature-info" class="modal-body"></div>
<div id="feature_modal_footer" class="modal-footer">
<button type="button" class="btn btn-default btn-sm" data-dismiss="modal"><i class="fa fa-power-off"></i>&nbsp;Tutup</button>
</div>
</div>
</div>
</div>
<div id="dataPropModal" class="dataPropertyModal">
<span class="dataPropertyClose">&times;</span>
<img class="dataPropertyModal-content" id="imgtoshow"/>
<div id="dataPropertyCaption"></div>
</div>
<input type="hidden" id="editobjectgid" value=""/>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" ></script>
<script src="https://unpkg.com/leaflet@1.7.1/dist/leaflet.js"></script>
<!--script src="assets/component/leaflet/sidebar/leaflet-sidebar.js"></script-->
<script src="assets/component/leaflet/layertree/L.Control.Layers.Tree.js"></script>
<script src="assets/js/Leaflet.draw.full-fledged.min.js"></script>
<script src="assets/js/terraformer.min.js"></script>
<script src="assets/js/terraformer-wkt-parser.min.js"></script>
<script src="assets/app/app.php"></script>
<script src="assets/app/create.php"></script>
<script src="assets/app/read.php"></script>
<script src="assets/app/update_point.php"></script>
<script src="assets/app/update_linestring.php"></script>
<script src="assets/app/update_polygon.php"></script>
<script src="assets/app/delete.php"></script>
</body>
</html>

68
encrypt.php

@ -0,0 +1,68 @@
<?php
/**
* src : source folder
* encrypted : Output folder
*/
$src = 'crypt/';
$php_blot_key = "rep2021aus";
/**
* No need to edit following code
*/
$excludes = array('vendor');
foreach($excludes as $key => $file){
$excludes[ $key ] = $src.'/'.$file;
}
$rec = new RecursiveIteratorIterator(new RecursiveDirectoryIterator( $src ));
$require_funcs = array('include_once', 'include', 'require', 'require_once');
foreach ($rec as $file) {
if ($file->isDir()) {
$newDir = str_replace( 'src', 'encrypted', $file->getPath() );
if( !is_dir( $newDir ) ) mkdir( $newDir );
continue;
};
$filePath = $file->getPathname();
if( pathinfo($filePath, PATHINFO_EXTENSION) != 'php' ||
in_array( $filePath, $excludes ) ) {
$newFile = str_replace('src', 'encrypted', $filePath );
copy( $filePath, $newFile );
continue;
}
$contents = file_get_contents( $filePath );
$preppand = '<?php bolt_decrypt( __FILE__ , PHP_BOLT_KEY); return 0;
##!!!##';
$re = '/\<\?php/m';
preg_match($re, $contents, $matches );
if(!empty($matches[0]) ){
$contents = preg_replace( $re, '', $contents );
##!!!##';
}
/*$cipher = bolt_encrypt( "?> ".$contents, $php_blot_key );*/
$cipher = bolt_encrypt( $contents, $php_blot_key );
$newFile = str_replace('src', 'encrypted', $filePath );
$fp = fopen( $newFile, 'w');
fwrite($fp, $preppand.$cipher);
fclose($fp);
unset( $cipher );
unset( $contents );
}
$out_str = substr_replace($src, '', 0, 4);
$file_location = __DIR__."/encrypted/".$out_str;
echo "Successfully Encrypted... Please check in <b>" .$file_location."</a></b> folder.";

56
error.php

@ -0,0 +1,56 @@
<?php if (session_id() == "")session_start();ob_start(); ?>
<?php include_once "cfg.php" ?>
<?php
if (!isset($_SESSION['USER_ID'])) {
header("location: login");
}
?>
<!-- HEADER -->
<?php include_once "mc_header.php" ?>
<!-- MENU -->
<?php include_once "mc_menu.php" ?>
<?php include_once "routine_count.php" ?>
<style>
.p2 {
padding: 4px!important;
}
.scheda {
background: #fff;
-webkit-box-shadow: 4px 4px 8px 0 rgba(0,0,0,0.1);
-moz-box-shadow: 4px 4px 8px 0 rgba(0,0,0,0.1);
box-shadow: 4px 4px 8px 0 rgba(0,0,0,0.1);
border: 1px solid #eceff1;
position: relative;
/*height: 100%;*/
display: flex;
flex-direction: column;
}
.scheda-round {
border-radius: 4px;
padding: 10px;
height: 230px;
}
</style>
<!-- BODY -->
<main class="col-12 col-md-9 col-xl-10 py-md-3 px-md-3 bd-content">
<div class="d-block d-sm-none" style="height:90px">XXXX </div>
<div class="row">
<div class="col-sm-12">
<div class="row" style="margin:60px;">
<div class="col-sm-12"><i class="fal fa-exclamation-triangle" style="font-size: 80px;margin-top: 60px;margin-bottom: 20px"></i><h5><p class="text-monospace">Qualcosa non ha funzionato<br> prova a riperete la procedura <i class="fal fa-smile-wink"></i></p></h5></div>
</div>
</div>
</div>
</main>
<!-- FOOTER -->
<?php include_once "mc_footer.php" ?>

BIN
favicon.ico

File binario non mostrato.

Dopo

Larghezza:  |  Altezza:  |  Dimensione: 1.1 KiB

413
index.php

@ -0,0 +1,413 @@
<?php
if (session_id() == "") session_start();
ob_start();
session_unset();
session_destroy();
unset($_SESSION['COMUNE_BELF']);
unset($_SESSION['COMUNE_PROV']);
unset($_SESSION['ZOOM']);
unset($_SESSION['CENTER']);
unset($_SESSION['BOUND']);
?>
<?php include_once "cfg_srv.php" ?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<!--meta http-equiv="X-Frame-Options" content="SAMEORIGIN"-->
<meta http-equiv="cache-control" content="no-cache" />
<meta name="referrer" content="no-referrer" />
<title>Paesaggistica Sicilia</title>
<!-- HEADER -->
<link rel="stylesheet" href="assets/css/loader.css" />
<style>
.p2 {
padding: 4px !important;
}
.scheda {
background: #fff;
-webkit-box-shadow: 4px 4px 8px 0 rgba(0, 0, 0, 0.1);
-moz-box-shadow: 4px 4px 8px 0 rgba(0, 0, 0, 0.1);
box-shadow: 4px 4px 8px 0 rgba(0, 0, 0, 0.1);
border: 1px solid #eceff1;
position: relative;
/*height: 100%;*/
display: flex;
flex-direction: column;
}
.scheda-round {
border-radius: 4px;
padding: 10px;
height: 230px;
}
</style>
</head>
<?php
session_set_cookie_params(["SameSite" => "lax"]); //none, lax, strict
session_set_cookie_params(["Secure" => "true"]); //false, true
session_set_cookie_params(["HttpOnly" => "true"]); //false, true
//session_start();
?>
<?php include_once "cfg.php" ?>
<?php
// https://paesaggistica.sicilia.it/rs/index?client=RG&prov=&idcom=G211&url=https%3A%2F%2Fpaesaggistica.sicilia.it%2Fportos-bo-portlet%2Fmappe%2Flist%3Fc%3D23576&date=1652128505&auth=57a4a0fc2935e5f88f1b91c7c6a79faa12272fff7ee9396a68243aa7890d942d
// https://paesaggistica.sicilia.it/rs/index?client=RG&prov=SR&idcom=&url=https%3A%2F%2Fpaesaggistica.sicilia.it%2Fportos-bo-portlet%2Fmappe%2Flist%3Fp%3D089&date=1652128894&auth=5729f4d46501d3ea8ce5b5256df69c1549288fe79c869bb3bb07e9710ff1bf4a
if (empty($_GET['idcom'])) {
$idcomume = '0';
} else {
$_SESSION['COMUNE_BELF'] = strtoupper($_GET['idcom']);
}
if (empty($_GET['estremiCatastali'])) {
$_SESSION['cataparticella'] = "";
} else {
$estremicata = trim($_GET['estremiCatastali']);
//echo "estremicata = ".$estremicata."<br>";
if (strlen($estremicata) > 8){
$_SESSION['cataparticella'] = substr($estremicata,0,-1);
} else {
$_SESSION['cataparticella'] = $estremicata;
}
}
if (empty($_GET['readOnly'])) {
$_SESSION['STATUS'] = '';
} else {
$_SESSION['STATUS'] = $_GET['readOnly'];
}
if (empty($_GET['idPratica'])) {
$_SESSION['IDPRATICA'] = 0;
} else {
$_SESSION['IDPRATICA'] = $_GET['idPratica'];
}
if (empty($_GET['npratica'])) {
$npratica = "0";
} else {
$npratica = $_GET['npratica'];
}
if (empty($_GET['lat'])) {
$_SESSION['LAT'] = 0;
} else {
$_SESSION['LAT'] = $_GET['lat'];
}
if (empty($_GET['lng'])) {
$_SESSION['LONG'] = 0;
} else {
$_SESSION['LONG'] = $_GET['lng'];
}
$rs_provincia = "SELECT provincia FROM public.comuni WHERE cod_belf = '" . $_SESSION['COMUNE_BELF'] . "'";
$result_prov = pg_query($conn, $rs_provincia) or die('Query failed0');
if (pg_num_rows($result_prov) > 0) {
while ($result_row = pg_fetch_assoc($result_prov)) {
//$_SESSION['COMUNE_PROV'] = strtolower($result_row['provincia']);
$_SESSION['COMUNE_PROV'] = $result_row['provincia'];
switch ($result_row['provincia']) {
case "SR":
$_SESSION['PROV_NOME'] = "Siracusa";
break;
case "CT":
$_SESSION['PROV_NOME'] = "Catania";
break;
case "EN":
$_SESSION['PROV_NOME'] = "Enna";
break;
case "PA":
$_SESSION['PROV_NOME'] = "Palermo";
break;
case "RG":
$_SESSION['PROV_NOME'] = "Ragusa";
break;
case "ME":
$_SESSION['PROV_NOME'] = "Messina";
break;
case "CL":
$_SESSION['PROV_NOME'] = "Caltanissetta";
break;
case "TP":
$_SESSION['PROV_NOME'] = "Trapani";
break;
case "AG":
$_SESSION['PROV_NOME'] = "Agrigento";
break;
default:
$_SESSION['PROV_NOME'] = "";
}
}
}
if ($_GET['client'] == 'BO') {
$routine_map = 'routine_map_bckoffice';
} elseif ($_GET['client'] == 'RG') { //RICERCA GEOGRAFICA
if (empty($_GET['prov'])) {
$_SESSION['COMUNE_PROV'] = "";
$rs_provincia = "SELECT provincia FROM public.comuni WHERE cod_belf = '" . $_SESSION['COMUNE_BELF'] . "'";
$result_prov = pg_query($conn, $rs_provincia) or die('Query failed0');
if (pg_num_rows($result_prov) > 0) {
while ($result_row = pg_fetch_assoc($result_prov)) {
//$_SESSION['COMUNE_PROV'] = strtolower($result_row['provincia']);
$_SESSION['COMUNE_PROV'] = $result_row['provincia'];
switch ($result_row['provincia']) {
case "SR":
$_SESSION['PROV_NOME'] = "Siracusa";
break;
case "CT":
$_SESSION['PROV_NOME'] = "Catania";
break;
case "EN":
$_SESSION['PROV_NOME'] = "Enna";
break;
case "PA":
$_SESSION['PROV_NOME'] = "Palermo";
break;
case "RG":
$_SESSION['PROV_NOME'] = "Ragusa";
break;
case "ME":
$_SESSION['PROV_NOME'] = "Messina";
break;
case "CL":
$_SESSION['PROV_NOME'] = "Caltanissetta";
break;
case "TP":
$_SESSION['PROV_NOME'] = "Trapani";
break;
case "AG":
$_SESSION['PROV_NOME'] = "Agrigento";
break;
default:
$_SESSION['PROV_NOME'] = "";
}
}
}
} else {
$_SESSION['COMUNE_PROV'] = $_GET['prov'];
$_SESSION['DATA_PROV'] = "prov";
switch ($_GET['prov']) {
case "SR":
$_SESSION['PROV_NOME'] = "Siracusa";
break;
case "CT":
$_SESSION['PROV_NOME'] = "Catania";
break;
case "EN":
$_SESSION['PROV_NOME'] = "Enna";
break;
case "PA":
$_SESSION['PROV_NOME'] = "Palermo";
break;
case "RG":
$_SESSION['PROV_NOME'] = "Ragusa";
break;
case "ME":
$_SESSION['PROV_NOME'] = "Messina";
break;
case "CL":
$_SESSION['PROV_NOME'] = "Caltanissetta";
break;
case "TP":
$_SESSION['PROV_NOME'] = "Trapani";
break;
case "AG":
$_SESSION['PROV_NOME'] = "Agrigento";
break;
default:
$_SESSION['PROV_NOME'] = "";
}
}
if (empty($_GET['idcom'])) {
$_SESSION['COMUNE_BELF'] = "";
} else {
$_SESSION['COMUNE_BELF'] = $_GET['idcom'];
$_SESSION['DATA_PROV'] = "comu";
}
$routine_map = 'routine_map_ricercageo';
$url = $_GET['url'];
function getCurl(string $url): ?array
{
$result = null;
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_PROXY, '172.21.1.1:3128');
$data = curl_exec($curl);
$rc = curl_getinfo($curl, CURLINFO_HTTP_CODE);
curl_close($curl);
if (200 == $rc) {
$result = json_decode($data, true);
}
return $result;
}
$list = getCurl($url);
// Inizio Modifica TURE
$geodata = [
'type' => 'FeatureCollection',
'crs' => [
'type' => 'name',
'properties' => [
'name' => 'urn:ogc:def:crs:EPSG::4326',
],
],
'features' => [],
];
foreach ($list as $item) {
$geodata['features'][] = [
'type' => 'Feature',
'properties' => [
'prov' => $item['provincia'],
'comune' => $item['nomeComune'],
'descrizione' => $item['descrizione'],
'estremi_catastali' => $item['estremiCatastali'],
'lat' => $item['lat'],
'lng' => $item['lng'],
'numero_progetto' => $item['numeroProgetto'],
'url' => $item['url'],
],
'geometry' => [
'type' => 'Point',
'coordinates' => [
$item['lng'],
$item['lat'],
],
],
];
}
$_SESSION['GEODATA'] = json_encode($geodata, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);
// Fine modifica Ture
} else {
$routine_map = 'routine_map';
//INSERISCE LOG
$instanza = "INSERT INTO public.istanze (comune,data_creaz,estremi_catastali,attivo,auth,idpratica,npratica,lat,lng) VALUES ('" . $_GET['idcom'] . "', '" . date("Y-m-d h:i:sa", time()) . "', '" . $_SESSION['cataparticella'] . "', '" . $_GET['readOnly'] . "', '" . $_GET['auth'] . "', " . $_SESSION['IDPRATICA'] . ", '" . $npratica . "', " . $_SESSION['LAT'] . ", ".$_SESSION['LONG'].")";
//echo $instanza;
$result_instanza = pg_query($conn, $instanza) or die('Query failed3');
function getSharedSecret(): string
{
return 'prosecco';
}
function verificaLogin($httpReferer, $date, $auth)
{
$remoteHost = parse_url($httpReferer, PHP_URL_HOST);
$hash = hash('sha256', $date . getSharedSecret() . $remoteHost);
return $hash === $auth;
}
if (!verificaLogin($_SERVER['HTTP_REFERER'], $_GET['date'], $_GET['auth'])) {
// Il server remoto non si è autenticato correttamente.
echo 'REFERER:' . $_SERVER['HTTP_REFERER'] . "<br>";
echo '<h1>Accesso non autorizzato</h1>';
}
$rs_comune = "SELECT * FROM public.comuni WHERE cod_belf = '" . $_SESSION['COMUNE_BELF'] . "'";
$result = pg_query($conn, $rs_comune) or die('Query failed4');
$row_comune = pg_num_rows($result);
if ($row_comune > 0) {
while ($comunesession = pg_fetch_assoc($result)) {
$_SESSION['COMUNE_NAME'] = $comunesession['comune'];
$_SESSION['COMUNE_ISTAT'] = "0" . substr($comunesession['cod_istat'], 0, 2);
$_SESSION['COMUNE_PROV'] = $comunesession['provincia'];
$_SESSION['CENTER'] = $comunesession['lat'] .", ".$comunesession['long'];
$_SESSION['BOUND'] = $comunesession['bound'];
}
}
$arraymappale = explode(';', $_SESSION['cataparticella']);
if (count($arraymappale) > 0) {
foreach ($arraymappale as $index => $mappale) {
if (!$query = @pg_query("SELECT id FROM ".strtolower($_SESSION['COMUNE_PROV']).".particelle WHERE comune = '" . $_SESSION['COMUNE_BELF'] . "' AND mappale ='" . $mappale . "';"))
die("Errore nella query CERCA PARTICELLA: " . pg_last_error($conn));
if (pg_numrows($query) > 0) {
while ($rowparticelle = pg_fetch_assoc($query)) {
$gidquery[] = $rowparticelle['id'];
}
}
}
//$valorearray = count($gidquery);
$stringa = implode(' OR id=', $gidquery);
$_SESSION['QUERY_CDU'] = $stringa;
$_SESSION['GET_CDU'] = 1;
} else {
unset($_SESSION['cataparticella']);
unset($_SESSION['QUERY_CDU']);
$_SESSION['GET_CDU'] = 0;
}
}
?>
<!-- BODY -->
<body>
<main class="col-12 col-md-12 col-xl-12 py-md-3 px-md-3 bd-content">
<div class="container2">
<div style="width: 100%!important">
<div class="row">
<div class="col-md-12">
<div class="row row-eq-height">
<div class='container'>
<i class='layer'></i>
<i class='layer'></i>
<i class='layer'></i>
</div>
<iframe src="<?php echo $routine_map; ?>.php" style="width:0;height:0;border: 0px;border: none;background-color: #ADDBFF" referrerpolicy="strict-origin-when-cross-origin"></iframe>
</div>
</div>
</div>
</div>
</div>
<?php
if ($_GET['client'] == 'RG') {
header("refresh:1;url=bckmap");
} elseif ($_GET['client'] == 'BO') {
header("refresh:1;url=detail");
} else {
header("refresh:1;url=intro");
}
?>
</main>
</body>
</html>

29
intro.php

@ -0,0 +1,29 @@
<?php
//session_set_cookie_params(["SameSite" => "lax"]); //none, lax, strict
//session_set_cookie_params(["Secure" => "true"]); //false, true
//session_set_cookie_params(["HttpOnly" => "true"]); //false, true
//session_start();
?>
<?php include_once "cfg.php" ?>
<?php include_once "mc_header2.php" ?>
<main class="col-12 col-md-12 col-xl-12 py-md-3 px-md-3 bd-content" style="height: calc(100vh - 6px);">
<div class="row" style="height: 100%!important" >
<div class="col-sm-auto">
<iframe
width="100%" height="100%!important" frameborder="0" src="catasearch.php" scrolling="auto" name="cdusearch">
</iframe>
</div>
<div class="col" >
<iframe width="100%" height="100%!important" frameborder="0" src="catamap?id=<?php echo $_GET['id']; ?>&cdu=<?php echo $_SESSION['GET_CDU']; ?>" scrolling="auto" name="map"></iframe>
</div>
</div>
</main>
<!-- FOOTER -->
<?php include_once "mc_footer2.php" ?>

236
legenda.php

@ -0,0 +1,236 @@
<?php if (session_id() == "")session_start();ob_start(); ?>
<?php include_once "cfg.php" ?>
<?php
$legendaid = $_POST['legendaid'];
switch ($legendaid) {
case "zoning":
$title = 'P.R.G.';
$subtitle = 'Zonizzazioni di P.R.G.';
$widthitem = 270;
$column = 1;
$layer = $_SESSION['COMUNE_PROV']."_zoning";
break;
case "vincoli":
$title = 'P.R.G.';
$subtitle = 'Vincoli di P.R.G.';
$widthitem = 200;
$column = 1;
$layer = "vincoli_".$_SESSION['COMUNE_BELF'];
break;
case "pai_geo_dissesti_att":
$title = 'Piano per l\'Assetto Idrogeologico';
$subtitle = 'Geomorfologia - Dissesti per attività';
$widthitem = 280;
$column = 1;
$layer = $legendaid;
break;
case "pai_geo_dissesti_tipo": // OBJ POINT
$title = 'Piano per l\'Assetto Idrogeologico';
$subtitle = 'Geomorfologia - Dissesti per tipo';
$widthitem = 300;
$column = 1;
$layer = $legendaid;
break;
case "pai_geo_pericolo": // OBJ POINT
$title = 'Piano per l\'Assetto Idrogeologico';
$subtitle = 'Geomorfologia - Pericolosità';
$widthitem = 70;
$column = 1;
$layer = $legendaid;
break;
case "pai_geo_rischio": // OBJ POINT
$title = 'Piano per l\'Assetto Idrogeologico';
$subtitle = 'Geomorfologia - Rischio';
$widthitem = 70;
$column = 1;
$layer = $legendaid;
break;
case "pai_geo_sa": // OBJ POINT
$title = 'Piano per l\'Assetto Idrogeologico';
$subtitle = 'Geomorfologia - Siti di attenzione';
$widthitem = 70;
$column = 1;
$layer = $legendaid;
break;
case "pai_idro_pericolo": // OBJ POINT
$title = 'Piano per l\'Assetto Idrogeologico';
$subtitle = 'Idrogeologia - Pericolosità';
$widthitem = 70;
$column = 1;
$layer = $legendaid;
break;
case "pai_idro_rischio": // OBJ POINT
$title = 'Piano per l\'Assetto Idrogeologico';
$subtitle = 'Idrogeologia - Rischio';
$widthitem = 70;
$column = 1;
$layer = $legendaid;
break;
case "pai_idro_sa": // OBJ POINT
$title = 'Piano per l\'Assetto Idrogeologico';
$subtitle = 'Idrogeologia - Siti di attenzione';
$widthitem = 70;
$column = 1;
$layer = $legendaid;
break;
case "sic_zps": // OBJ POINT
$title = 'Aree Protette';
$subtitle = 'SIC - ZPS';
$widthitem = 120;
$column = 1;
$layer = $legendaid;
break;
case "regimi_normativi":
$title = 'Piano Paesaggistico Regionale';
$subtitle = 'Regimi Normativi';
$widthitem = 170;
$column = 1;
$layer = $_SESSION['COMUNE_PROV']."_regimi_normativi";
break;
case "art136":
$title = 'Piano Paesaggistico Regionale';
$subtitle = 'Aree tutelate';
$widthitem = 70;
$column = 1;
$layer = $_SESSION['COMUNE_PROV']."_v_1497";
break;
case "art142m":
$title = 'Piano Paesaggistico Regionale';
$subtitle = 'Aree di interesse archeologico ';
$widthitem = 70;
$column = 1;
$layer = $_SESSION['COMUNE_PROV']."_v_archeo";
break;
case "art142g":
$title = 'Piano Paesaggistico Regionale';
$subtitle = 'Aree boscate';
$widthitem = 70;
$column = 1;
$layer = $_SESSION['COMUNE_PROV']."_v_boschi";
break;
case "art142a":
$title = 'Piano Paesaggistico Regionale';
$subtitle = 'Aree costa 300m';
$widthitem = 70;
$column = 1;
$layer = $_SESSION['COMUNE_PROV']."_v_costa";
break;
case "art142c":
$title = 'Piano Paesaggistico Regionale';
$subtitle = 'Aree fiumi 150m';
$widthitem = 70;
$column = 1;
$layer = $_SESSION['COMUNE_PROV']."_v_fiumi";
break;
case "art10d":
$title = 'Piano Paesaggistico Regionale';
$subtitle = 'Vincoli Archeologici';
$widthitem = 70;
$column = 1;
$layer = $_SESSION['COMUNE_PROV']."_v_interesse_archeo";
break;
case "art142b":
$title = 'Piano Paesaggistico Regionale';
$subtitle = 'Aree laghi 300m';
$widthitem = 70;
$column = 1;
$layer = $_SESSION['COMUNE_PROV']."_v_laghi";
break;
case "art134c":
$title = 'Piano Paesaggistico Regionale';
$subtitle = 'Aree tutelate';
$widthitem = 70;
$column = 1;
$layer = $_SESSION['COMUNE_PROV']."_v_lettera_c";
break;
case "art142f":
$title = 'Piano Paesaggistico Regionale';
$subtitle = 'Aree riserve regionali';
$widthitem = 70;
$column = 1;
$layer = $_SESSION['COMUNE_PROV']."_v_riserve";
break;
case "art142f2":
$title = 'Piano Paesaggistico Regionale';
$subtitle = 'Parchi regionali';
$widthitem = 70;
$column = 1;
$layer = "CT_v_parchi";
break;
case "v1200":
$title = 'Piano Paesaggistico Regionale';
$subtitle = 'Aree al di sopra di 1200m';
$widthitem = 70;
$column = 1;
$layer = "ME_v_1200";
break;
case "vvulcano":
$title = 'Piano Paesaggistico Regionale';
$subtitle = 'Vincolo area vulcanica';
$widthitem = 70;
$column = 1;
$layer = "CT_v_vulcano";
break;
case "vidrog":
$title = 'Vincoli Regione Sicilia';
$subtitle = 'Vincolo Idrogeologico';
$widthitem = 70;
$column = 1;
$layer = "sif_vincolo_idrogeo";
break;
case "dl227":
$title = 'Vincoli Regione Sicilia';
$subtitle = 'Carta Forestale - def. DLgs 227-01';
$widthitem = 70;
$column = 1;
$layer = "cfsr_dl227";
break;
case "lr96":
$title = 'Vincoli Regione Sicilia';
$subtitle = 'Carta Forestale - def. LR 19-96';
$widthitem = 70;
$column = 1;
$layer = "cfrs_lr16";
break;
case "riserve":
$title = 'Vincoli Regione Sicilia';
$subtitle = 'Riserve Sicilia';
$widthitem = 70;
$column = 1;
$layer = "riserve";
break;
case "sin":
$title = 'Vincoli Regione Sicilia';
$subtitle = 'SIN';
$widthitem = 70;
$column = 1;
$layer = "sin";
break;
default:
$widthitem = 100;
$column = 1;
}
?>
<table class="table table-sm" style="font-size:12px; width:350px" >
<tr>
<td scope="col"><b>LIVELLO</b></td>
<td scope="col"><?php echo $title; ?></td>
</tr>
<tr>
<td scope="col"><b>DESCRIZIONE</b></td>
<td scope="col"><?php echo $subtitle; ?></td>
</tr>
<tr>
<td colspan="2"></td>
</tr>
<tr>
<td colspan="2">
<img src="https://test-paesaggistica.lavoripubblici.sicilia.it/geoserver/mappers/wms?REQUEST=GetLegendGraphic&VERSION=1.0.0&FORMAT=image/png&WIDTH=35&HEIGHT=25&LAYER=mappers:<?php echo $layer; ?>&legend_options=columns:<?php echo $column; ?>" width="<?php echo $widthitem; ?>px"></td>
</tr>
</table>

65
load.php

@ -0,0 +1,65 @@
<?php if (session_id() == "")session_start();ob_start(); ?>
<?php include_once "cfg.php" ?>
<?php
if (!isset($_SESSION['USER_ID'])) {
header("location: login");
}
?>
<!-- HEADER -->
<?php include_once "mc_header.php" ?>
<!-- MENU -->
<?php include_once "mc_menu.php" ?>
<?php // include_once "routine_map.php" ?>
<style>
.p2 {
padding: 4px!important;
}
.scheda {
background: #fff;
-webkit-box-shadow: 4px 4px 8px 0 rgba(0,0,0,0.1);
-moz-box-shadow: 4px 4px 8px 0 rgba(0,0,0,0.1);
box-shadow: 4px 4px 8px 0 rgba(0,0,0,0.1);
border: 1px solid #eceff1;
position: relative;
/*height: 100%;*/
display: flex;
flex-direction: column;
}
.scheda-round {
border-radius: 4px;
padding: 10px;
height: 230px;
}
</style>
<!-- BODY -->
<main class="col-12 col-md-9 col-xl-10 py-md-3 px-md-3 bd-content">
<div class="container">
<div style="width: 100%!important">
<div class="row">
<div class="col-md-12">
<div class="row row-eq-height">
<div class='container'>
<i class='layer'></i>
<i class='layer'></i>
<i class='layer'></i>
</div>
<iframe src="routine_map.php" style="width:0;height:0;border: 0px;border: none;background-color: #ADDBFF"></iframe>
</div>
</div>
</div>
</div>
</div>
<?php header( "refresh:1;url=intro" ); ?>
</main>
<!-- FOOTER -->
<?php include_once "mc_footer.php" ?>

50
load2.php

@ -0,0 +1,50 @@
<?php if (session_id() == "")session_start(); ob_start(); ?>
<!-- HEADER -->
<link rel="stylesheet" href="assets/css/loader.css" />
<style>
.p2 {
padding: 4px!important;
}
.scheda {
background: #fff;
-webkit-box-shadow: 4px 4px 8px 0 rgba(0,0,0,0.1);
-moz-box-shadow: 4px 4px 8px 0 rgba(0,0,0,0.1);
box-shadow: 4px 4px 8px 0 rgba(0,0,0,0.1);
border: 1px solid #eceff1;
position: relative;
/*height: 100%;*/
display: flex;
flex-direction: column;
}
.scheda-round {
border-radius: 4px;
padding: 10px;
height: 230px;
}
</style>
<!-- BODY -->
<main class="col-12 col-md-12 col-xl-12 py-md-3 px-md-3 bd-content">
<div class="container2">
<div style="width: 100%!important">
<div class="row">
<div class="col-md-12">
<div class="row row-eq-height">
<div class='container'>
<i class='layer'></i>
<i class='layer'></i>
<i class='layer'></i>
</div>
</div>
</div>
</div>
</div>
</div>
<?php header( "refresh:0;url=catavincoli" ); ?>
<?php //header( "url=catavincoli" ); ?>
</main>

458
map_info.php

@ -0,0 +1,458 @@
<?php if (session_id() == "")session_start();ob_start(); ?>
<?php include_once "cfg.php" ?>
<style type="text/css">
.destinaz { border-bottom: 1px solid #cccccc; font-style:italic; color: #333333; outline: none; font-size: 12px;}
.copertura { border-bottom: 1px solid #cccccc; font-style:italic; color: #333333; outline: none; font-size: 12px; text-align: center;}
.particella { border-bottom: 1px solid #cccccc; background: #f6f6f6; font-weight: bold; font-style:italic; color: #333333; font-size: 13px; outline: none; }
.titolo { font-weight: bold; font-style:italic; color: #333333; font-size: 12px; outline: none; }
</style>
<?php
$idparticella = $_POST['infoid'];
$layer = $_GET['lay'];
//echo " - ".$layer." - ";
if ($layer == 'zon') {
$zoning_detail = "SELECT *, ST_AREA(geom) AS area FROM ".strtolower($_SESSION['COMUNE_PROV']).".zoning WHERE comune = '".$_SESSION['COMUNE_BELF']."' AND id =".$idparticella."";
//$zoning_detail = "SELECT *, ST_AREA(the_geom) AS zon_area FROM i754.zoning WHERE gid =".$infoid."";
# Try query or error
$rs_zon = pg_query($conn, $zoning_detail) or die("Cannot execute query: $zoning_detail\n");;
$row_obj = pg_num_rows($rs_zon);
if (!$rs_zon) {
echo "ERR ZONING.\n";
} else {
//echo "QUERY OKKEY <br><br>";
}
while ($rec_zon = pg_fetch_assoc($rs_zon)) { ?>
<h6 class="modal-title">Dettaglio ZONIZZAZIONE</h6><br>
<table class="table table-sm" style="font-size:12px; width:350px" >
<tr>
<td style="width:130px"><b>COMUNE</b></td>
<td scope="col"><?php echo $rec_zon['zon_comu']; ?></td>
</tr>
<tr>
<td scope="col"><b>SIGLA</b></td>
<td scope="col"><?php echo $rec_zon['zon_sigla']; ?></td>
</tr>
<tr>
<td scope="col"><b>DESCRIZIONE BREVE</b></td>
<td scope="col"><?php echo $rec_zon['zon_desbrv']; ?></td>
</tr>
<tr>
<td scope="col"><b>DESCRIZIONE</b></td>
<td scope="col"><?php echo $rec_zon['zon_descr']; ?></td>
</tr>
<tr>
<td scope="col"><b>ASSOGGETTAMENTO</b></td>
<td scope="col"><?php echo $rec_zon['zon_assog']; ?></td>
</tr>
<tr>
<td scope="col"><b>ART. NTA</b></td>
<td scope="col"><?php echo $rec_zon['zon_art']; ?></td>
</tr>
<tr>
<td scope="col"><b>APPROVAZIONE</b></td>
<td scope="col"><?php echo $rec_zon['zon_approv']; ?></td>
</tr>
<tr>
<td scope="col"><b>AREA</b></td>
<td scope="col"><?php if ($rec_zon['area'] > 10000){
echo round (($rec_zon['area']/10000),2)." ha";
} else {
echo round ($rec_zon['area'],2)." m<sup>2</sup>";
}
?>
</td>
</tr>
</table>
<?php } ?>
<?php }
if ($layer == 'cata') {
$comunebelf = $_SESSION['COMUNE_PROV'];
$comu_cata = strtolower($_SESSION['COMUNE_PROV']).".particelle"; // COMPOSIZIONE TABELLA PARTICELLE-COMUNE
$comu_prg = strtolower($_SESSION['COMUNE_PROV']).".zoning"; // COMPOSIZIONE TABELLA ZONING-COMUNE
$comu_vincoprg = strtolower($_SESSION['COMUNE_PROV']).".vincoli"; // COMPOSIZIONE TABELLA ZONING-COMUNE
// AREA INTERESSATA DALLA PARTICELLA RISPETTO ALLA ZONIZZAZIONE
?> <h6 class="modal-title">REGIME VINCOLISTICO</h6><br>
<?php
if(!$query3 = @pg_query("SELECT id, foglio, numero, ST_AsText(geom) AS geometria, ST_Area(geom) as area FROM ".strtolower($_SESSION['COMUNE_PROV']).".particelle WHERE comune = '".$_SESSION['COMUNE_BELF']."' AND id = ".$idparticella.""))
die("ERROR CATA: " . pg_last_error($conn));
while($row3 = pg_fetch_assoc($query3)) {
$_SESSION['geom'] = $row3['geometria'];
$foglio = $row3['foglio'];
$area_sezione = $row3['area'];
$particella = $row3['numero'];
$idparticella = $row3['id'];
// PARTICELLE INTERESSATE
echo '<h6 class="modal-title" style="font-size:14px;">FOGLIO '.$foglio.'&nbsp;&nbsp; - &nbsp;&nbsp;PARTICELLA '.$particella.'</h6>';
?>
<br>
<table width="100%" border="0" cellspacing="4" cellpadding="2" align="center">
<tr>
<td width="35%" class="zoning_title" ><div align="center"><b>DESTINAZIONE</b></div></td>
<td width="75%" class="zoning_title" ><div align="center"><b>COPERTURA</b></div></td>
</tr>
<!-- ======================= DATI CDU START ======================== -->
<?php
// PARTICELLE INTERESSATE
// INIZIO DEFINIZIONE DELLA COPERTURA DELLA ZONAZIONE
$query_zoning = "SELECT a.zon_sigla, a.zon_descr FROM (SELECT zon_sigla, zon_descr, geom FROM ".strtolower($_SESSION['COMUNE_PROV']).".zoning) a, (SELECT ST_GeomFromEWKT('SRID=25833;".$_SESSION['geom']."') as geom) b WHERE ST_Intersects (a.geom,b.geom)";
$result_query_zoning = pg_query($conn, $query_zoning) or die('Query query_zoning failied');
if (pg_num_rows($result_query_zoning) > 0) {
while($row4 = pg_fetch_assoc($result_query_zoning)) {
echo "\n\t<tr>\n\t\t<td class='zoning'>Zona di PRG</td>\n\t\t<td class='zoning'>{$row4['zon_sigla']} - {$row4['zon_descr']}</td>\n\t</tr>";
}}
// FINE DEFINIZIONE DELLA COPERTURA DELLA ZONAZIONE
// INIZIO DEFINIZIONE DELLA COPERTURA DEI VINCOLI DI PRG
$query_prgvincoli = "SELECT a.zon_descr FROM (SELECT zon_descr, geom FROM ".strtolower($_SESSION['COMUNE_PROV']).".vincoli) a, (SELECT ST_GeomFromEWKT('SRID=25833;".$_SESSION['geom']."') as geom) b WHERE ST_Intersects (a.geom,b.geom)";
$result_query_prgvincoli = pg_query($conn, $query_prgvincoli) or die('Query query_prgvincoli failied');
if (pg_num_rows($result_query_prgvincoli) > 0) {
while($row5 = pg_fetch_assoc($result_query_prgvincoli)) {
echo "\n\t<tr>\n\t\t<td class='zoning'>Vincolo di PRG</td>\n\t\t<td class='zoning'>{$row5['zon_descr']}</td>\n\t</tr>";
}}
// FINE DEFINIZIONE DELLA COPERTURA DEI VINCOLI DI PRG
// INIZIO DEFINIZIONE DELLA COPERTURA DEI VINCOLI BBCCAA
$query_regimi = "SELECT a.pl, a.liv_tutela, a.contesto, ST_AREA(ST_intersection(a.geom, b.geom)) AS areabbccaa FROM (SELECT pl, liv_tutela, contesto, geom FROM ".strtolower($_SESSION['COMUNE_PROV']).".regimi_normativi) a, (SELECT ST_GeomFromEWKT('SRID=25833;".$_SESSION['geom']."') as geom) b WHERE ST_Intersects (a.geom,b.geom)";
$result_query_regimi = pg_query($conn, $query_regimi) or die('Query query_regimi failied');
if (pg_num_rows($result_query_regimi) > 0) {
//echo "####".$row_query6. "####";
while($row6 = pg_fetch_assoc($result_query_regimi)) {
switch ($row6['liv_tutela']) {
case 1:
$bbccaa = "Livello di tutela 1";
break;
case 2:
$bbccaa = "Livello di tutela 2";
break;
case 3:
$bbccaa = "Livello di tutela 3";
break;
case 4:
$bbccaa = "Livello di tutela 4";
break;
default:
$bbccaa = "";
}
echo "\n\t<tr>\n\t\t<td class='zoning'>Piano Paesaggistico Regionale<br>Regimi Normativi</td>\n\t\t<td class='zoning'>Paesaggio locale <b>{$row6['pl']}</b><br>{$bbccaa} - Contesto <b>{$row6['contesto']}</b><br>
<b>{$row6['contesto']}</b></td>\n\t</tr>";
}}
// FINE DEFINIZIONE DELLA COPERTURA DEI VINCOLI BBCCAA
// INIZIO DEFINIZIONE DELLA COPERTURA V_1497
$query_v_1497 = "SELECT ST_AREA(ST_intersection(a.geom, b.geom)) AS area_v_1497 FROM (SELECT geom FROM ".strtolower($_SESSION['COMUNE_PROV']).".v_1497) a, (SELECT ST_GeomFromEWKT('SRID=25833;".$_SESSION['geom']."') as geom) b WHERE ST_Intersects (a.geom,b.geom)";
$result_query_v_1497 = pg_query($conn, $query_v_1497) or die('Query query_v_1497 failied');
if (pg_num_rows($result_query_v_1497) > 0) {
while($row6a = pg_fetch_assoc($result_query_v_1497)) {
echo "\n\t<tr>\n\t\t<td class='zoning'>BENI PAESAGGISTICI</td>\n\t\t<td class='zoning'>Area tutelata (art.136, D.lgs.42/04)</td>\n\t</tr>";
}}
// FINE DEFINIZIONE DELLA COPERTURA V_1497
// INIZIO DEFINIZIONE DELLA COPERTURA V_ARCHEO
$query_v_archeo = "SELECT ST_AREA(ST_intersection(a.geom, b.geom)) AS area_v_archeo FROM (SELECT geom FROM ".strtolower($_SESSION['COMUNE_PROV']).".v_archeo) a, (SELECT ST_GeomFromEWKT('SRID=25833;".$_SESSION['geom']."') as geom) b WHERE ST_Intersects (a.geom,b.geom)";
$result_query_v_archeo = pg_query($conn, $query_v_archeo) or die('Query query_v_archeo failied');
if (pg_num_rows($result_query_v_archeo) > 0) {
while($row6b = pg_fetch_assoc($result_query_v_archeo)) {
echo "\n\t<tr>\n\t\t<td class='zoning'>BENI PAESAGGISTICI</td>\n\t\t<td class='zoning'>Vincolo Archeologico (art.10, D.lgs.42/04)</td>\n\t</tr>";
}}
// FINE DEFINIZIONE DELLA COPERTURA V_ARCHEO
// INIZIO DEFINIZIONE DELLA COPERTURA V_BOSCHI
$query_v_boschi = "SELECT ST_AREA(ST_intersection(a.geom, b.geom)) AS area_v_boschi FROM (SELECT geom FROM ".strtolower($_SESSION['COMUNE_PROV']).".v_boschi) a, (SELECT ST_GeomFromEWKT('SRID=25833;".$_SESSION['geom']."') as geom) b WHERE ST_Intersects (a.geom,b.geom)";
$result_query_v_boschi = pg_query($conn, $query_v_boschi) or die('Query query_v_boschi failied');
if (pg_num_rows($result_query_v_boschi) > 0) {
while($row6c = pg_fetch_assoc($result_query_v_boschi)) {
echo "\n\t<tr>\n\t\t<td class='zoning'>BENI PAESAGGISTICI</td>\n\t\t<td class='zoning'>Aree boscate (art.142, lett. g, D.lgs.42/04)</td>\n\t</tr>";
}}
// FINE DEFINIZIONE DELLA COPERTURA V_BOSCHI
// INIZIO DEFINIZIONE DELLA COPERTURA V_COSTA
$query_v_costa = "SELECT ST_AREA(ST_intersection(a.geom, b.geom)) AS area_v_costa FROM (SELECT geom FROM ".strtolower($_SESSION['COMUNE_PROV']).".v_costa) a, (SELECT ST_GeomFromEWKT('SRID=25833;".$_SESSION['geom']."') as geom) b WHERE ST_Intersects (a.geom,b.geom)";
//echo $query_v_costa."<br>";
$result_query_v_costa = pg_query($conn, $query_v_costa) or die('Query query_v_costa failied');
if (pg_num_rows($result_query_v_costa) > 0) {
while($row6d = pg_fetch_assoc($result_query_v_costa)) {
echo "\n\t<tr>\n\t\t<td class='zoning'>BENI PAESAGGISTICI</td>\n\t\t<td class='zoning'>Aree costa 300m (art.142, lett.a, D.lgs. 42/04)</td>\n\t</tr>";
}}
// FINE DEFINIZIONE DELLA COPERTURA V_COSTA
// INIZIO DEFINIZIONE DELLA COPERTURA V_FIUMI
$query_v_fiumi = "SELECT ST_AREA(ST_intersection(a.geom, b.geom)) AS area_v_fiumi FROM (SELECT geom FROM ".strtolower($_SESSION['COMUNE_PROV']).".v_fiumi) a, (SELECT ST_GeomFromEWKT('SRID=25833;".$_SESSION['geom']."') as geom) b WHERE ST_Intersects (a.geom,b.geom)";
$result_query_v_fiumi = pg_query($conn, $query_v_fiumi) or die('Query query_v_fiumi failied');
if (pg_num_rows($result_query_v_fiumi) > 0) {
while($row6e = pg_fetch_assoc($result_query_v_fiumi)) {
echo "\n\t<tr>\n\t\t<td class='zoning'>BENI PAESAGGISTICI</td>\n\t\t<td class='zoning'>Aree fiumi 150m (art.142, lett. c, D.lgs.42/04)</td>\n\t</tr>";
}}
// FINE DEFINIZIONE DELLA COPERTURA V_FIUMI
// INIZIO DEFINIZIONE DELLA COPERTURA V_INTERESSE_ARCHEO
$query_v_interesse_archeo = "SELECT ST_AREA(ST_intersection(a.geom, b.geom)) AS area_v_interesse_archeo FROM (SELECT geom FROM ".strtolower($_SESSION['COMUNE_PROV']).".v_interesse_archeo) a, (SELECT ST_GeomFromEWKT('SRID=25833;".$_SESSION['geom']."') as geom) b WHERE ST_Intersects (a.geom,b.geom)";
$result_query_v_interesse_archeo = pg_query($conn, $query_v_interesse_archeo) or die('Query query_v_interesse_archeo failied');
if (pg_num_rows($result_query_v_interesse_archeo) > 0) {
while($row6f = pg_fetch_assoc($result_query_v_interesse_archeo)) {
echo "\n\t<tr>\n\t\t<td class='zoning'>BENI PAESAGGISTICI</td>\n\t\t<td class='zoning'>Aree di interesse archeologico (art.142, lett. m, D.lgs.42/04)</td>\n\t</tr>";
}}
// FINE DEFINIZIONE DELLA COPERTURA V_INTERESSE_ARCHEO
// INIZIO DEFINIZIONE DELLA COPERTURA V_LAGHI
$query_v_laghi = "SELECT ST_AREA(ST_intersection(a.geom, b.geom)) AS area_v_laghi FROM (SELECT geom FROM ".strtolower($_SESSION['COMUNE_PROV']).".v_laghi) a, (SELECT ST_GeomFromEWKT('SRID=25833;".$_SESSION['geom']."') as geom) b WHERE ST_Intersects (a.geom,b.geom)";
$result_query_v_laghi = pg_query($conn, $query_v_laghi) or die('Query query_v_laghi failied');
if (pg_num_rows($result_query_v_laghi) > 0) {
while($row6g = pg_fetch_assoc($result_query_v_laghi)) {
echo "\n\t<tr>\n\t\t<td class='zoning'>BENI PAESAGGISTICI</td>\n\t\t<td class='zoning'>Aree laghi 300m (art.142, lett. b, D.lgs. 42/04)</td>\n\t</tr>";
}}
// FINE DEFINIZIONE DELLA COPERTURA V_LAGHI
// INIZIO DEFINIZIONE DELLA COPERTURA V_LETTERA_C
$query_v_lettera_c = "SELECT ST_AREA(ST_intersection(a.geom, b.geom)) AS area_v_lettera_c FROM (SELECT geom FROM ".strtolower($_SESSION['COMUNE_PROV']).".v_lettera_c) a, (SELECT ST_GeomFromEWKT('SRID=25833;".$_SESSION['geom']."') as geom) b WHERE ST_Intersects (a.geom,b.geom)";
$result_query_v_lettera_c = pg_query($conn, $query_v_lettera_c) or die('Query query_v_lettera_c failied');
if (pg_num_rows($result_query_v_lettera_c) > 0) {
while($row6h = pg_fetch_assoc($result_query_v_lettera_c)) {
echo "\n\t<tr>\n\t\t<td class='zoning'>BENI PAESAGGISTICI</td>\n\t\t<td class='zoning'>Aree tutelate (art.134, lett. c, D.lgs. 42/04)</td>\n\t</tr>";
}}
// FINE DEFINIZIONE DELLA COPERTURA V_LETTERA_C
// INIZIO DEFINIZIONE DELLA COPERTURA V_RISERVE
$query_v_riserve = "SELECT ST_AREA(ST_intersection(a.geom, b.geom)) AS area_v_riserve FROM (SELECT geom FROM ".strtolower($_SESSION['COMUNE_PROV']).".v_riserve) a, (SELECT ST_GeomFromEWKT('SRID=25833;".$_SESSION['geom']."') as geom) b WHERE ST_Intersects (a.geom,b.geom)";
$result_query_v_riserve = pg_query($conn, $query_v_riserve) or die('Query query_v_riserve failied');
if (pg_num_rows($result_query_v_riserve) > 0) {
while($row6i = pg_fetch_assoc($result_query_v_riserve)) {
echo "\n\t<tr>\n\t\t<td class='zoning'>BENI PAESAGGISTICI</td>\n\t\t<td class='zoning'>Aree riserve regionali (art.142, lett. f, D.lgs.42/04)</td>\n\t</tr>";
}}
// FINE DEFINIZIONE DELLA COPERTURA V_RISERVE
// INIZIO DEFINIZIONE DELLA COPERTURA V_PARCHI
$query_v_parchi = "SELECT ST_AREA(ST_intersection(a.geom, b.geom)) AS area_v_parchi FROM (SELECT geom FROM ".strtolower($_SESSION['COMUNE_PROV']).".v_parchi) a, (SELECT ST_GeomFromEWKT('SRID=25833;".$_SESSION['geom']."') as geom) b WHERE ST_Intersects (a.geom,b.geom)";
$result_query_v_parchi = pg_query($conn, $query_v_parchi) or die('Query query_v_parchi failied');
if (pg_num_rows($result_query_v_parchi) > 0) {
while($row6l = pg_fetch_assoc($result_query_v_parchi)) {
echo "\n\t<tr>\n\t\t<td class='zoning'>BENI PAESAGGISTICI</td>\n\t\t<td class='zoning'>Parchi regionali (art.142, lett. f, D.lgs.42/04)<br><b>{$row6l['denom']}</b></td>\n\t</tr>";
}}
// FINE DEFINIZIONE DELLA COPERTURA V_PARCHI
// INIZIO DEFINIZIONE DELLA COPERTURA V_1200
$query_v_1200 = "SELECT ST_AREA(ST_intersection(a.geom, b.geom)) AS area_v_1200 FROM (SELECT geom FROM ".strtolower($_SESSION['COMUNE_PROV']).".v_1200) a, (SELECT ST_GeomFromEWKT('SRID=25833;".$_SESSION['geom']."') as geom) b WHERE ST_Intersects (a.geom,b.geom)";
$result_query_v_1200 = pg_query($conn, $query_v_1200) or die('Query query_v_1200 failied');
if (pg_num_rows($result_query_v_1200) > 0) {
while($row6m = pg_fetch_assoc($result_query_v_1200)) {
echo "\n\t<tr>\n\t\t<td class='zoning'>BENI PAESAGGISTICI</td>\n\t\t<td class='zoning'>Aree al di sopra di 1200 (art.142, lett. d, D.lgs.42/04)</td>\n\t</tr>";
}}
// FINE DEFINIZIONE DELLA COPERTURA V_1200
// INIZIO DEFINIZIONE DELLA COPERTURA DEL VINCOLO IDROGEOLOGICO
$query_v_idrogeol = "SELECT ST_AREA(ST_intersection(a.geom, b.geom)) AS areaidro FROM (SELECT geom FROM rscarto.sif_vincolo_idrogeo_sicilia) a, (SELECT ST_GeomFromEWKT('SRID=25833;".$_SESSION['geom']."') as geom) b WHERE ST_Intersects (a.geom,b.geom)";
$result_query_v_idrogeol = pg_query($conn, $query_v_idrogeol) or die('Query query_v_idrogeol failied');
if (pg_num_rows($query72) > 0) {
while($row72 = pg_fetch_assoc($query72)) {
echo "\n\t<tr>\n\t\t<td class='zoning'>Vincolo Boschi</td>\n\t\t<td class='zoning'>&nbsp;&nbsp;Art.2 D.L. 18 maggio 2001, n. 227</td>\n\t\t</tr>";
}}
// FINE DEFINIZIONE DELLA COPERTURA VINCOLO IDROGEOLOGICO
// INIZIO DEFINIZIONE DELLA COPERTURA DEL VINCOLO BOSCHI DL227
$query_dl227 = "SELECT ST_AREA(ST_intersection(a.geom, b.geom)) AS areadl227 FROM (SELECT geom FROM ".strtolower($_SESSION['COMUNE_PROV']).".sif_dl227) a, (SELECT ST_GeomFromEWKT('SRID=25833;".$_SESSION['geom']."') as geom) b WHERE ST_Intersects (a.geom,b.geom)";
$result_query_dl227 = pg_query($conn, $query_dl227) or die('Query query_dl227 failied');
if (pg_num_rows($result_query_dl227) > 0) {
while($row72 = pg_fetch_assoc($result_query_dl227)) {
echo "\n\t<tr>\n\t\t<td class='zoning'>Vincolo Boschi</td>\n\t\t<td class='zoning'>&nbsp;&nbsp;Art.2 D.L. 18 maggio 2001, n. 227</td>\n\t\t</tr>";
}}
// FINE DEFINIZIONE DELLA COPERTURA DEL VINCOLO BOSCHI DL227
// INIZIO DEFINIZIONE DELLA COPERTURA DEL VINCOLO BOSCHI LR16
$query_lr16 = "SELECT ST_AREA(ST_intersection(a.geom, b.geom)) AS arealr16 FROM (SELECT geom FROM ".strtolower($_SESSION['COMUNE_PROV']).".sif_lr16) a, (SELECT ST_GeomFromEWKT('SRID=25833;".$_SESSION['geom']."') as geom) b WHERE ST_Intersects (a.geom,b.geom)";
$result_query_lr16 = pg_query($conn, $query_lr16) or die('Query query_lr16 failied');
if (pg_num_rows($result_query_lr16) > 0) {
//echo "#### - 7 ".$row_query7. "####";
while($row8 = pg_fetch_assoc($result_query_lr16)) {
echo "\n\t<tr>\n\t\t<td class='zoning'>Vincolo Boschi</td>\n\t\t<td class='zoning'>&nbsp;&nbsp;L.R. 16/96 art. 4</td>\n\t</tr>";
}}
// FINE DEFINIZIONE DELLA COPERTURA DEL VINCOLO BOSCHI LR16
// INIZIO DEFINIZIONE DELLA COPERTURA SIC-ZPS
$query_siczps = "SELECT a.denom, ST_AREA(ST_intersection(a.geom, b.geom)) AS areasiczps FROM (SELECT denom, geom FROM rscarto.sic_zps) a, (SELECT ST_GeomFromEWKT('SRID=25833;".$_SESSION['geom']."') as geom) b WHERE ST_Intersects (a.geom,b.geom)";
$result_query_siczps = pg_query($conn, $query_siczps) or die('Query query_siczps failied');
if (pg_num_rows($result_query_siczps) > 0) {
//echo "#### - 7 ".$row_query7. "####";
while($row81 = pg_fetch_assoc($result_query_siczps)) {
echo "\n\t<tr>\n\t\t<td class='zoning'>SIC - ZPS</td>\n\t\t<td class='zoning'>{$row81['codice']} - {$row81['denom']}</td>\n\t</tr>";
}}
// FINE DEFINIZIONE DELLA COPERTURA SIC-ZPS
// INIZIO DEFINIZIONE DELLA COPERTURA RISERVE
$query_riserve = "SELECT a.denom, ST_AREA(ST_intersection(a.geom, b.geom)) AS areariserve FROM (SELECT denom, geom FROM rscarto.riserve_sicilia) a, (SELECT ST_GeomFromEWKT('SRID=25833;".$_SESSION['geom']."') as geom) b WHERE ST_Intersects (a.geom,b.geom)";
$result_query_riserve = pg_query($conn, $query_riserve) or die('Query query_riserve failied');
if (pg_num_rows($query82) > 0) {
//echo "#### - 7 ".$row_query7. "####";
while($row82 = pg_fetch_assoc($query82)) {
echo "\n\t<tr>\n\t\t<td class='zoning'>RISERVE</td>\n\t\t<td class='zoning'>{$row82['codice']} - {$row82['denom']}</td>\n\t</tr>";
}}
// FINE DEFINIZIONE DELLA COPERTURA RISERVE
// INIZIO DEFINIZIONE DELLA COPERTURA PAI IDRO RISCHIO
$query_idro_rischio = "SELECT a.rischio, ST_AREA(ST_intersection(a.geom, b.geom)) AS area_idro_rischio FROM (SELECT rischio, geom FROM rscarto.pai_idr_r) a, (SELECT ST_GeomFromEWKT('SRID=25833;".$_SESSION['geom']."') as geom) b WHERE ST_Intersects (a.geom,b.geom)";
$result_query_idro_rischio = pg_query($conn, $query_idro_rischio) or die('Query query_idro_rischio failied');
if (pg_num_rows($result_query_idro_rischio) > 0) {
while($row9 = pg_fetch_assoc($result_query_idro_rischio)) {
echo "\n\t<tr>\n\t\t<td class='zoning'>P.A.I.</td>\n\t\t<td class='zoning'>Rischio Idraulico - {$row9['rischio']}</td>\n\t</tr>";
}}
// FINE DEFINIZIONE DELLA COPERTURA PAI IDRO RISCHIO
// INIZIO DEFINIZIONE DELLA COPERTURA PAI IDRO PERICOLOSITA'
$query_idro_pericolo = "SELECT a.pericolo, ST_AREA(ST_intersection(a.geom, b.geom)) AS area_idro_pericolo FROM (SELECT pericolo, geom FROM rscarto.pai_idr_p_sa) a, (SELECT ST_GeomFromEWKT('SRID=25833;".$_SESSION['geom']."') as geom) b WHERE ST_Intersects (a.geom,b.geom)";
$result_query_idro_pericolo = pg_query($conn, $query_idro_pericolo) or die('Query query_idro_pericolo failied');
if (pg_num_rows($result_query_idro_pericolo) > 0) {
while($row10 = pg_fetch_assoc($result_query_idro_pericolo)) {
echo "\n\t<tr>\n\t\t<td class='zoning'>P.A.I.</td>\n\t\t<td class='zoning'>Pericolosità Idraulica - {$row10['pericolo']}</td>\n\t</tr>";
}}
// FINE DEFINIZIONE DELLA COPERTURA PAI IDRO RISCHIO
// INIZIO DEFINIZIONE DELLA COPERTURA PAI GEOMORF RISCHIO
$query_geo_rischio = "SELECT a.rischio, ST_AREA(ST_intersection(a.geom, b.geom)) AS area_geo_rischio FROM (SELECT rischio, geom FROM rscarto.pai_geo_rischio) a, (SELECT ST_GeomFromEWKT('SRID=25833;".$_SESSION['geom']."') as geom) b WHERE ST_Intersects (a.geom,b.geom)";
$result_query_geo_rischio = pg_query($conn, $query_geo_rischio) or die('Query query_geo_rischio failied');
if (pg_num_rows($result_query_geo_rischio) > 0) {
while($row11 = pg_fetch_assoc($result_query_geo_rischio)) {
echo "\n\t<tr>\n\t\t<td class='zoning'>P.A.I.</td>\n\t\t<td class='zoning'>Rischio Geomorfologico - {$row11['rischio']}</td>\n\t</tr>";
}}
// FINE DEFINIZIONE DELLA COPERTURA PAI GEOMORF RISCHIO
// INIZIO DEFINIZIONE DELLA COPERTURA PAI GEOMORF PERICOLOSITA
$query_geo_pericolo = "SELECT a.pericolo, ST_AREA(ST_intersection(a.geom, b.geom)) AS area_geo_pericolo FROM (SELECT pericolo, geom FROM rscarto.pai_geo_peric) a, (SELECT ST_GeomFromEWKT('SRID=25833;".$_SESSION['geom']."') as geom) b WHERE ST_Intersects (a.geom,b.geom)";
$result_query_geo_pericolo = pg_query($conn, $query_geo_pericolo) or die('Query query_geo_pericolo failied');
if (pg_num_rows($result_query_geo_pericolo) > 0) {
//echo "#### - 7 ".$row_query7. "####";
while($row12 = pg_fetch_assoc($result_query_geo_pericolo)) {
echo "\n\t<tr>\n\t\t<td class='zoning'>P.A.I.</td>\n\t\t<td class='zoning'>Pericolosità Geomorfologica - {$row12['pericolo']}</td>\n\t</tr>";
}}
// FINE DEFINIZIONE DELLA COPERTURA PAI GEOMORF PERICOLOSITA
// INIZIO DEFINIZIONE DELLA COPERTURA SIN
$query_sin = "SELECT a.denominaz, ST_AREA(ST_intersection(a.geom, b.geom)) AS area_sin FROM (SELECT denominaz, geom FROM rscarto.sin) a, (SELECT ST_GeomFromEWKT('SRID=25833;".$_SESSION['geom']."') as geom) b WHERE ST_Intersects (a.geom,b.geom)";
$result_query_sin = pg_query($conn, $query_sin) or die('Query query_sin failied');
if (pg_num_rows($result_query_sin) > 0) {
//echo "#### - 7 ".$row_query7. "####";
while($rowsin = pg_fetch_assoc($result_query_sin)) {
echo "\n\t<tr>\n\t\t<td class='zoning'>SIN</td>\n\t\t<td class='zoning'>Sito di Interesse Nazionale</td>\n\t</tr>";
}}
// FINE DEFINIZIONE DELLA COPERTURA SIN
//}
//pg_close($conndb);
?>
<!-- ======================= DATI CDU STOP ======================== -->
<?php } ?>
</table>
<?php } ?>

BIN
marker-icon-2x.png

File binario non mostrato.

Dopo

Larghezza:  |  Altezza:  |  Dimensione: 2.4 KiB

BIN
marker-icon.png

File binario non mostrato.

Dopo

Larghezza:  |  Altezza:  |  Dimensione: 1.4 KiB

27
mc_footer2.php

@ -0,0 +1,27 @@
</div>
</div>
<style>
.modal-dialog,
.modal-content {
/* 80% of window height */
height: 85%;
}
.modal-body {
/* 100% = dialog height, 120px = header + footer */
max-height: calc(100% - 120px);
overflow-y: scroll;
}
</style>
<script src="assets/js/bootstrap-italia.bundle.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/anchor-js/4.1.0/anchor.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.1/clipboard.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/particles.js/2.0.0/particles.min.js"></script>
<script src="assets/js/docs.min.js"></script>
</body>
</html>

28
mc_header2.php

@ -0,0 +1,28 @@
<!doctype html>
<html lang="it">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="description" content="mapcloud è una piattaforma gis in cloud in grado di erogare servizi cartografici alla Pubblica Amministrazione ">
<meta name="author" content="mapcloud - mapping serviced">
<meta name="generator" content="Jekyll v3.8.5">
<meta http-equiv="cache-control" content="no-cache"/>
<meta name="referrer" content="no-referrer" />
<title>Paesaggistica Sicilia</title>
<!-- Bootstrap core CSS -->
<link href="assets/css/bootstrap-italia.min.css" rel="stylesheet">
<link href="https://cdn.jsdelivr.net/npm/docsearch.js@2/dist/cdn/docsearch.min.css" rel="stylesheet">
<link href="assets/fontawesome/css/all.css" rel="stylesheet" type="text/css" />
<link href="assets/css/docs.min.css" rel="stylesheet">
</head>
<body>
<div class="container-fluid">
<div class="row flex-xl-nowrap">

1341
mobile_detect.php

File diff suppressed because one or more lines are too long

54
routine.php

@ -0,0 +1,54 @@
<?php
function escapeJsonString($value) { # list from www.json.org: (\b backspace, \f formfeed)
$escapers = array("\\", "/", "\"", "\n", "\r", "\t", "\x08", "\x0c");
$replacements = array("\\\\", "\\/", "\\\"", "\\n", "\\r", "\\t", "\\f", "\\b");
$result = str_replace($escapers, $replacements, $value);
return $result;
}
if (strlen($_SESSION['cataparticella']) > 5 ) {
// ########## CALCOLA CENTROIDE PARTICELLA
if(!$strcoordinate = @pg_query("SELECT ST_X(ST_Transform(ST_Centroid(ST_Union(the_geom)),4326)) as long,
ST_Y(ST_Transform(ST_Centroid(ST_union(the_geom)),4326)) as lat
FROM ".$_SESSION['COMUNE_BELF'].".particelle WHERE gid=".$_SESSION['cataparticella_id'].";"))
die("Errore CENTRO COMUNE: " . pg_last_error($conn));
while($rowcoord = pg_fetch_assoc($strcoordinate)) {
// ########## CENTRO MAPPA
$_SESSION['CENTER'] = $rowcoord['lat'] .", ".$rowcoord['long'];
}
$zoom = 16;
} else {
// ########## CALCOLA CENTROIDE COMUNE
if ($levelid < 80) {
if(!$strcoordinate = @pg_query("SELECT ST_X(ST_Centroid(ST_Transform(ST_Union(the_geom),4326))) as long,
ST_Y(ST_Centroid(ST_Transform(ST_Union(the_geom),4326))) as lat FROM comuni_italia_3004 WHERE cod_belf ='".$_SESSION['COMUNE_BELF']."';"))
die("Errore nella query CENTER: " . pg_last_error($conn));
while($rowcoord = pg_fetch_assoc($strcoordinate)) {
// ########## CENTRO MAPPA
$_SESSION['CENTER'] = $rowcoord['lat'] .", ".$rowcoord['long'];
}
if(!$strbound = @pg_query("SELECT ST_YMax(ST_Buffer(ST_Transform(the_geom,4326),0.15)) as ymax, ST_XMax(ST_Buffer(ST_Transform(the_geom,4326),0.15)) as xmax, ST_YMin(ST_Buffer(ST_Transform(the_geom,4326),0.15)) as ymin, ST_XMin(ST_Buffer(ST_Transform(the_geom,4326),0.15)) as xmin
FROM comuni_italia_3004 WHERE cod_belf = '".$_SESSION['COMUNE_BELF']."';"))
die("ERROR BOUND: " . pg_last_error($conn));
while($rowbound = pg_fetch_assoc($strbound)) {
// ########## CALCOLO BOUND COMUNE
$_SESSION['BOUND'] = "[".$rowbound['ymin'].", ".$rowbound['xmin']."],[".$rowbound['ymax'].", ".$rowbound['xmax']."]";
}
//echo "### ".$_SESSION['BOUND']." ###<br>";
//echo "### ".$_SESSION['CENTER']." ###";
$zoom = 12;
}
// ########## CALCOLA CENTROIDE GRUPPO COMUNI
if ($levelid > 80) {
$_SESSION['CENTER'] = '37.068, 14.985';
$zoom = 8;
}
}
?>

359
routine_feature.php

@ -0,0 +1,359 @@
<?php
if (session_id() == "")session_start();ob_start();
if (!isset($_SESSION['USER_ID'])) {header("location: login");}
?>
<?php include_once "cfg.php" ?>
<?php //include "mc_header2" ?>
<?php
$feature = $_GET['id'];
$obj = $_SESSION['OBJ'];
$risk = $_SESSION['RISK'];
echo "FEATURE ID = ".$feature."<br>";
echo "OBJ = ".$obj."<br>";
echo "RISK ID = ".$risk."<br>";
if(!$conn) { ?>
<script type="text/javascript"> top.location.href = "500.php";</script>
<?php
} else {
//echo 'Connessione riuscita !<br />';
}
switch ($obj) {
case 'point':
$objtable = "objpoint";
$schema = strtolower($_SESSION['COMUNE_BELF']);
$idgeom = "id_obj";
break;
case 'gate':
$objtable = "objgate";
$schema = strtolower($_SESSION['COMUNE_BELF']);
$idgeom = "id_obj";
break;
case 'area':
$objtable = "objarea";
$schema = strtolower($_SESSION['COMUNE_BELF']);
$idgeom = "id_obj";
break;
case 'fire':
$objtable = "incendi";
$schema = "public";
$idgeom = "id_aib";
break;
case 'sce':
$objtable = "objscenari";
$schema = strtolower($_SESSION['COMUNE_BELF']);
$idgeom = "id_obj";
break;
case 'line':
$objtable = "objline";
$schema = strtolower($_SESSION['COMUNE_BELF']);
$idgeom = "id_obj";
break;
case 'sog':
$objtable = "objsoggetti";
$schema = strtolower($_SESSION['COMUNE_BELF']);
$idgeom = "id_obj";
break;
case 'trash':
$objtable = "discarica";
$schema = strtolower($_SESSION['COMUNE_BELF']);
$idgeom = "id";
break;
case 'int':
$objtable = "interventi";
$schema = strtolower($_SESSION['COMUNE_BELF']);
$idgeom = "id_inter";
break;
case 'suolo_pub':
$objtable = "objsoggetti";
$schema = strtolower($_SESSION['COMUNE_BELF']);
$idgeom = "suolo_id";
break;
case 'passi':
$objtable = "objsoggetti";
$schema = strtolower($_SESSION['COMUNE_BELF']);
$idgeom = "passi_id";
break;
case 'pubblicita':
$objtable = "objsoggetti";
$schema = strtolower($_SESSION['COMUNE_BELF']);
$idgeom = "pubbli_id";
break;
case 'civici':
$objtable = "topo_civici";
$schema = strtolower($_SESSION['COMUNE_BELF']);
$idgeom = "civico_id";
break;
case 'sign':
$objtable = "segnalazioni";
$schema = strtolower($_SESSION['COMUNE_BELF']);
$idgeom = "segnalazione_id";
break;
case 'zoning_compare':
$schema = strtolower($_SESSION['COMUNE_BELF']);
$idgeom = "compare_id";
break;
case 'zpoi':
$objtable = "zoning_poi";
$schema = strtolower($_SESSION['COMUNE_BELF']);
$idgeom = "poi_id";
break;
default:
$schema = "public";
}
/**/
//RECUPERA L'ULTIMO ID DALLA TABELLA GEOMETRY_TEST
if(!$last_idtable = @pg_query("SELECT ".$idgeom." AS idgeometria FROM ".$schema.".".$objtable." ORDER BY ".$objtable.".".$idgeom." DESC LIMIT 1"))
die("Errore nella query RECUPERA ID: " . pg_last_error($conn));
echo "SELECT = ".$last_idtable."<br>";
while($last_idtable_result = pg_fetch_assoc($last_idtable)) {
$id_new_geometry = $last_idtable_result['idgeometria'];
}
//echo "1 FEATURE: ".$feature."<br>2 MODE: ".$mode."<br>3 OBJ: ".$obj."<br>";
//$featuredati = explode(".", $feature);
//echo "3 TABELLA: ".$featuredati[0]."<br>4 ID: ".$featuredati[1]."<br>5 SCHEMA: ".$schema."<br>6 ID: ".$idgeom."<br>";
//$id_new_geometry = $featuredati[1];
$tabella = $_SESSION['TAB'];
//echo "5 TABELLA: ".$tabella."<br>";
//######################### FIRE
if ($obj == "fire") {
//RECUPERA AREA
if(!$last_gid = @pg_query("SELECT ST_AREA(the_geom) AS area FROM public.incendi WHERE id_aib = ".$id_new_geometry.""))
die("ERROR FIRE AREA: " . pg_last_error($conn));
while($last_result = pg_fetch_assoc($last_gid)) {
$areaincendio = round($last_result['area']/10000,2);
}
//echo "AREA INCENDIO ".$areaincendio ."<br>";
//CERCA I COMUNI INTERESSATI DALL'INCENDIO
if(!$query8 = @pg_query("SELECT comune FROM ".
" (SELECT ST_Intersection(e.the_geom, f.the_geom) as the_geom, e.comune FROM ".
" (SELECT a.the_geom, a.comune FROM public.comuni_italia_3004 a inner join ".
" (SELECT ST_UNION(the_geom) as the_geom FROM ".$schema.".".$objtable." WHERE ".$idgeom." = ".$id_new_geometry.") b on ST_Intersects(a.the_geom, b.the_geom)) e inner join ".
" (SELECT * FROM public.incendi WHERE id_aib = ".$id_new_geometry.") f on ST_Intersects(e.the_geom, f.the_geom)) a;"))
die("ERROR STR3: " . pg_last_error($conn));
while($row8 = pg_fetch_assoc($query8)) {
$comuni[] = $row8['comune'];
}
$lista_comuni = implode(', ', $comuni);
//CERCA I TOPONIMI INTERESSATI DALL'INCENDIO
if(!$query_toponimi = @pg_query("SELECT toponimo, secondo_no FROM ".
" (SELECT ST_Intersection(e.the_geom, f.the_geom) as the_geom, e.toponimo, e.secondo_no FROM ".
" (SELECT a.the_geom, a.toponimo, a.secondo_no FROM public.toponimi a inner join ".
" (SELECT ST_UNION(the_geom) AS the_geom FROM public.incendi WHERE id_aib = ".$id_new_geometry.") b on ST_Intersects(a.the_geom, b.the_geom)) e inner join ".
" (SELECT * FROM public.incendi WHERE id_aib = ".$id_new_geometry.") f on ST_Intersects(e.the_geom, f.the_geom)) a;"))
die("Errore nella query STR2: " . pg_last_error($conn));
while($row_toponimi = pg_fetch_assoc($query_toponimi)) {
$topo[] = str_replace("'", "&rsquo;" ,$row_toponimi['toponimo'])." ".str_replace("'", "&rsquo;" ,$row_toponimi['secondo_no']);
}
$lista_toponimi = implode(', ', $topo);
//echo "TOPONIMI ".$lista_toponimi."<br>";
//CERCA I CATASTALI CHE INTERESSA IL PUNTO
if(!$query4 = @pg_query("SELECT mappale FROM ".
" (SELECT ST_Intersection(e.the_geom, f.the_geom) as the_geom, e.mappale FROM ".
" (SELECT a.the_geom, a.mappale FROM ".strtolower($_SESSION['COMUNE_BELF']).".particelle a inner join ".
" (SELECT ST_UNION(the_geom) AS the_geom FROM public.incendi WHERE id_aib = $id_new_geometry) b on ST_Intersects(a.the_geom, b.the_geom)) e inner join ".
" (SELECT * FROM public.incendi WHERE id_aib = $id_new_geometry) f on ST_Intersects(e.the_geom, f.the_geom)) a;"))
die("ERROR STR3: " . pg_last_error($conn));
while($row4 = pg_fetch_assoc($query4)) {
$mappale[] = $row4['mappale'];
}
$cataincendio = implode(', ', $mappale);
if(!$rs_update = @pg_query("UPDATE public.incendi SET comune_app = '".$_SESSION['COMUNE_NAME']."', localita = '".$lista_toponimi."', altri_com='".$lista_comuni."', catasto ='".$cataincendio."', totsup = ".$areaincendio.", archiviato = 0, attivo=1, comune = '".$_SESSION['COMUNE_BELF']."', operatore = '".$_SESSION['USER_NAME']."', data_agg = '".date("Y-m-d h:i:sa", time())."' WHERE id_aib = ".$id_new_geometry.""))
die("ERROR 1: " . pg_last_error($conn));
}
//######################### AREA
if ($obj == "area") {
//RECUPERA AREA
if(!$last_gid = @pg_query("SELECT ST_AREA(the_geom) AS area FROM ".strtolower($_SESSION['COMUNE_BELF']).".objarea WHERE id_obj = ".$id_new_geometry.""))
die("ERROR AREA PROTEZIONE CIVILE: " . pg_last_error($conn));
while($last_result = pg_fetch_assoc($last_gid)) {
$areaincendio = round($last_result['area'],0);
}
//echo "AREA INCENDIO ".$areaincendio ."<br>";
//CERCA I TOPONIMI INTERESSATI DALL'INCENDIO
if(!$query_toponimi = @pg_query("SELECT toponimo, secondo_no FROM ".
" (SELECT ST_Intersection(e.the_geom, f.the_geom) as the_geom, e.toponimo, e.secondo_no FROM ".
" (SELECT a.the_geom, a.toponimo, a.secondo_no FROM public.toponimi a inner join ".
" (SELECT ST_UNION(the_geom) AS the_geom FROM ".strtolower($_SESSION['COMUNE_BELF']).".objarea WHERE id_obj = ".$id_new_geometry.") b on ST_Intersects(a.the_geom, b.the_geom)) e inner join ".
" (SELECT * FROM ".strtolower($_SESSION['COMUNE_BELF']).".objarea WHERE id_obj = ".$id_new_geometry.") f on ST_Intersects(e.the_geom, f.the_geom)) a;"))
die("Errore nella query STR2: " . pg_last_error($conn));
while($row_toponimi = pg_fetch_assoc($query_toponimi)) {
$topo[] = str_replace("'", "&rsquo;" ,$row_toponimi['toponimo'])." ".str_replace("'", "&rsquo;" ,$row_toponimi['secondo_no']);
}
$lista_toponimi = implode(', ', $topo);
//echo "TOPONIMI ".$lista_toponimi."<br>";
//CERCA I CATASTALI CHE INTERESSA IL PUNTO
if(!$query4 = @pg_query("SELECT mappale FROM ".
" (SELECT ST_Intersection(e.the_geom, f.the_geom) as the_geom, e.mappale FROM ".
" (SELECT a.the_geom, a.mappale FROM ".strtolower($_SESSION['COMUNE_BELF']).".particelle a inner join ".
" (SELECT ST_UNION(the_geom) AS the_geom FROM ".strtolower($_SESSION['COMUNE_BELF']).".objarea WHERE id_obj = $id_new_geometry) b on ST_Intersects(a.the_geom, b.the_geom)) e inner join ".
" (SELECT * FROM ".strtolower($_SESSION['COMUNE_BELF']).".objarea WHERE id_obj = $id_new_geometry) f on ST_Intersects(e.the_geom, f.the_geom)) a;"))
die("ERROR STR3: " . pg_last_error($conn));
while($row4 = pg_fetch_assoc($query4)) {
$mappale[] = $row4['mappale'];
}
$cataincendio = implode(', ', $mappale);
if(!$rs_update = @pg_query("UPDATE ".strtolower($_SESSION['COMUNE_BELF']).".objarea SET comune_app='".$_SESSION['COMUNE_NAME']."', localita='".$lista_toponimi."', catasto='".$cataincendio."', area_totale='".$areaincendio."', archiviato = false, attivo=1, comune = '".$_SESSION['COMUNE_BELF']."', operatore = '".$_SESSION['USER_NAME']."', data_agg = '".date("Y-m-d h:i:sa", time())."' WHERE id_obj = ".$id_new_geometry.""))
die("ERROR 8: " . pg_last_error($conn));
}
//######################### SCE
if ($obj == "sce") {
switch ($risk) {
case 'ind': // AREA
$tipo = "Rischio industriale";
break;
case 'tsu': // AREA
$tipo = "Rischio tsunami";
break;
case 'inc': // AREA
$tipo = "Rischio incendi";
break;
case 'idr': // AREA
$tipo = "Rischio idrogeologico";
break;
default:
$tipo = "";
}
// INSERISCE AREA E GEOMETRIA IN TABELLA
if(!$testpoint = @pg_query("INSERT INTO ".strtolower($_SESSION['COMUNE_BELF']).".objscenari (tipo,attivo,comune,the_geom) VALUES ('".$tipo."',3,'".$_SESSION['COMUNE_BELF']."',
(SELECT ST_MULTI(the_geom) FROM public.polygon_support3004 WHERE gid=".$featuredati[1]."))"))
die("ERROR INSER GEOM: " . pg_last_error($conn));
//RECUPERA L'ULTIMO ID DALLA TABELLA GEOMETRY_TEST
if(!$last_gid = @pg_query("SELECT id_obj, ST_AREA(the_geom) AS area FROM ".strtolower($_SESSION['COMUNE_BELF']).".objscenari ORDER BY id_obj DESC LIMIT 1"))
die("Errore nella query RECUPERA ID: " . pg_last_error($conn));
while($last_result = pg_fetch_assoc($last_gid)) {
$id_new = $last_result['id_obj'];
$areascenario = round($last_result['area'],2);
}
//CERCA I TOPONIMI INTERESSATI DALL'INCENDIO
if(!$query_toponimi = @pg_query("SELECT toponimo, secondo_no FROM ".
" (SELECT ST_Intersection(e.the_geom, f.the_geom) as the_geom, e.toponimo, e.secondo_no FROM ".
" (SELECT a.the_geom, a.toponimo, a.secondo_no FROM public.toponimi a inner join ".
" (SELECT ST_UNION(the_geom) AS the_geom FROM ".strtolower($_SESSION['COMUNE_BELF']).".objscenari WHERE id_obj = ".$id_new.") b on ST_Intersects(a.the_geom, b.the_geom)) e inner join ".
" (SELECT * FROM ".strtolower($_SESSION['COMUNE_BELF']).".objscenari WHERE id_obj = ".$id_new.") f on ST_Intersects(e.the_geom, f.the_geom)) a;"))
die("Errore nella query STR2: " . pg_last_error($conn));
while($row_toponimi = pg_fetch_assoc($query_toponimi)) {
$topo[] = str_replace("'", "&rsquo;" ,$row_toponimi['toponimo'])." ".str_replace("'", "&rsquo;" ,$row_toponimi['secondo_no']);
}
$lista_toponimi = implode(', ', $topo);
//echo "TOPONIMI ".$lista_toponimi."<br>";
//CERCA I CATASTALI CHE INTERESSA IL PUNTO
if(!$query4 = @pg_query("SELECT mappale FROM ".
" (SELECT ST_Intersection(e.the_geom, f.the_geom) as the_geom, e.mappale FROM ".
" (SELECT a.the_geom, a.mappale FROM ".strtolower($_SESSION['COMUNE_BELF']).".particelle a inner join ".
" (SELECT ST_UNION(the_geom) AS the_geom FROM ".strtolower($_SESSION['COMUNE_BELF']).".objscenari WHERE id_obj = $id_new) b on ST_Intersects(a.the_geom, b.the_geom)) e inner join ".
" (SELECT * FROM ".strtolower($_SESSION['COMUNE_BELF']).".objscenari WHERE id_obj = $id_new) f on ST_Intersects(e.the_geom, f.the_geom)) a;"))
die("ERROR STR3: " . pg_last_error($conn));
while($row4 = pg_fetch_assoc($query4)) {
$mappale[] = $row4['mappale'];
}
$cataincendio = implode(', ', $mappale);
if(!$rs_update = @pg_query("UPDATE ".strtolower($_SESSION['COMUNE_BELF']).".objscenari SET comune_app = '".$_SESSION['COMUNE_NAME']."', localita = '".$lista_toponimi."', catasto ='".$cataincendio."', area = ".$areascenario.", archiviato = 0, attivo=1, comune = '".$_SESSION['COMUNE_BELF']."', operatore = '".$_SESSION['USER_NAME']."', data_agg = '".date("Y-m-d h:i:sa", time())."' WHERE id_obj = ".$id_new.""))
die("ERROR 1: " . pg_last_error($conn));
}
//######################### SCE
if ($obj == "line") {
//RECUPERA L'ULTIMO ID DALLA TABELLA GEOMETRY_TEST
if(!$last_gid = @pg_query("SELECT id_obj FROM ".strtolower($_SESSION['COMUNE_BELF']).".objline ORDER BY id_obj DESC LIMIT 1"))
die("Errore nella query RECUPERA ID: " . pg_last_error($conn));
while($last_result = pg_fetch_assoc($last_gid)) {
$id_new = $last_result['id_obj'];
}
}
if ($obj == "point" OR $obj == "trash" OR $obj == "gate" OR $obj == "sign" OR $obj == "int" OR $obj == "sog" OR $obj == "civ" OR $obj == "pas" OR $obj == "pub" OR $obj == "zoning_compare" OR $obj == "zpoi") {
//INIZIO ALTRI PUNTI
//------------------------------------------------------------------------------
// CERCA LE COORDINATE DEL PUNTO
/*
if(!$query_xy = @pg_query("SELECT ST_Y(ST_Transform(the_geom,3004)) as lat, ST_X(ST_Transform(the_geom,3004)) as long FROM ".$schema.".".$featuredati[0]." WHERE ".$idgeom."=".$featuredati[1].""))
die("Errore nella query LAT-LONG : " . pg_last_error($conn));
$row_obj = pg_num_rows($query_xy);
echo "ROW = ".$row_obj."<br>";
while($row_xy = pg_fetch_assoc($query_xy)) {
$long = $row_xy['long'];
$lat = $row_xy['lat'];
echo "LAT2: ".$lat." - LONG2: ".$long."<br>";
}
//CERCA I TOPONIMI ENTRO UN RAGGIO DI 750 M INTERESSATI DAL PUNTO
if(!$query_toponimi = @pg_query("SELECT toponimo, secondo_no FROM toponimi WHERE
ST_DWithin(Geography(the_geom)),
Geography(ST_MakePoint($long, $lat)),750);"))
die("Errore nella query STR21: " . pg_last_error($conn));
while($row_toponimi = pg_fetch_assoc($query_toponimi)) {
$topo[] = $row_toponimi['toponimo']." ".$row_toponimi['secondo_no'];
}
$toponimi = implode(', ', $topo);
//CERCA I CATASTALI CHE INTERESSA IL PUNTO
if(!$query_cata = @pg_query("SELECT mappale FROM ".strtolower($_SESSION['COMUNE_BELF']).".particelle WHERE
ST_DWithin(Geography(the_geom),
Geography(ST_MakePoint($long, $lat)),0.1);"))
die("Errore nella query STR22: " . pg_last_error($conn));
while($row_cata = pg_fetch_assoc($query_cata)) {
//$cata = substr($row_cata['mappale'],5,10);
$cata = $row_cata['mappale'];
}
*/
// if(!$rs_update = @pg_query("UPDATE ".$schema.".".$featuredati[0]." SET comune_app='".$_SESSION['COMUNE_NAME']."', localita='".$toponimi."', catasto='".$cata."', archiviato = 0, attivo=1, comune = '".$_SESSION['COMUNE_BELF']."', operatore = '".$_SESSION['USER_NAME']."', data_agg = '".date("Y-m-d h:i:sa", time())."' WHERE ".$idgeom." = ".$id_new_geometry.""))
if(!$rs_update = @pg_query("UPDATE ".$schema.".".$objtable." SET comune_app='".$_SESSION['COMUNE_NAME']."', archiviato = 0, attivo=1, comune = '".$_SESSION['COMUNE_BELF']."', operatore = '".$_SESSION['USER_NAME']."', data_agg = '".date("Y-m-d h:i:sa", time())."' WHERE ".$idgeom." = ".$id_new_geometry.""))
die("ERROR 111: " . pg_last_error($conn));
}
if ($obj == "sce") { ?>
<script type="text/javascript">
top.location.href = "dataview?obj=<?php echo $obj; ?>&risk=<?php echo $risk; ?>&id=<?php echo $id_new; ?>";
</script>
<?php } else { ?>
<script type="text/javascript">
top.location.href = "dataview?obj=<?php echo $obj; ?>&id=<?php echo $id_new_geometry; ?>";
</script>
<?php } ?>

80
routine_map.php

@ -0,0 +1,80 @@
<?php if (session_id() == "")session_start();ob_start(); ?>
<?php include_once "cfg_srv.php" ?>
<?php
function escapeJsonString($value) { # list from www.json.org: (\b backspace, \f formfeed)
$escapers = array("\\", "/", "\"", "\n", "\r", "\t", "\x08", "\x0c");
$replacements = array("\\\\", "\\/", "\\\"", "\\n", "\\r", "\\t", "\\f", "\\b");
$result = str_replace($escapers, $replacements, $value);
return $result;
}
echo "CATAPARTICELLA = ".$_SESSION['cataparticella']."<br>";
/**/
if (strlen($_SESSION['cataparticella']) > 2 ) {
// ########## CALCOLA CENTROIDE PARTICELLA
if(!$strcoordinate = @pg_query("SELECT ST_X(ST_Transform(ST_Centroid(ST_Union(geom)),4326)) as long,
ST_Y(ST_Transform(ST_Centroid(ST_union(geom)),4326)) as lat
FROM ".$_SESSION['COMUNE_PROV'].".particelle WHERE comune = '".$_SESSION['COMUNE_BELF']."' AND id=".$_SESSION['QUERY_CDU'].";"))
die("Errore CENTRO COMUNE: " . pg_last_error($conn));
while($rowcoord = pg_fetch_assoc($strcoordinate)) { $_SESSION['CENTER'] = $rowcoord['lat'] .", ".$rowcoord['long']; }
$_SESSION['ZOOM'] = 18;
// ########## CALCOLO BOUND PARTICELLE
if(!$strbound = @pg_query("SELECT ST_YMax(ST_Buffer(ST_Transform(ST_Union(geom),4326),0.15)) as ymax, ST_XMax(ST_Buffer(ST_Transform(ST_Union(geom),4326),0.15)) as xmax, ST_YMin(ST_Buffer(ST_Transform(ST_Union(geom),4326),0.15)) as ymin, ST_XMin(ST_Buffer(ST_Transform(ST_Union(geom),4326),0.15)) as xmin
FROM ".$_SESSION['COMUNE_PROV'].".particelle WHERE comune = '".$_SESSION['COMUNE_BELF']."' AND id=".$_SESSION['QUERY_CDU'].";"))
die("ERROR BOUND: " . pg_last_error($conn));
while($rowbound = pg_fetch_assoc($strbound)) {
// ---------- ESTENSIONE MAPPA
$_SESSION['BOUND'] = "[".$rowbound['ymin'].", ".$rowbound['xmin']."],[".$rowbound['ymax'].", ".$rowbound['xmax']."]";
}
// CALCOLA GEOMETRIA PARTICELLA
$sql_catasto = "SELECT ST_AsGeoJSON(ST_Transform(geom,4326)) AS cata_geojson, round(ST_Area(geom)::numeric,2) as area
FROM ".strtolower($_SESSION['COMUNE_PROV']).".particelle WHERE comune = '".$_SESSION['COMUNE_BELF']."' AND id=".$_SESSION['QUERY_CDU'].";";
# Try query or error
$rs = pg_query($conn, $sql_catasto);
if (!$rs) {
echo "ERROR GEOM PARTICELLE.\n";
} else {
// echo "QUERY OKKEY <br><br>";
}
# Build GeoJSON
$output = '';
$rowOutput = '';
while ($row = pg_fetch_assoc($rs)) {
// $rowOutput = (strlen($rowOutput) > 0 ? ',' : '') . '{"type": "Feature", "geometry": ' . $row['geojson'] . ', "properties": {';
$rowOutput = (strlen($rowOutput) > 0 ? ',' : '') . '{"type": "Feature", "properties": {';
$props = '';
$id = '';
foreach ($row as $key => $val) {
if ($key != "cata_geojson") {
$props .= (strlen($props) > 0 ? ',' : '') . '"' . $key . '":"' . escapeJsonString($val) . '"';
}
if ($key == "id") {
$id .= ',"id":"' . escapeJsonString($val) . '"';
}
}
// $rowOutput .= $props . '}';
$rowOutput .= $props . '}, "geometry": ' . $row['cata_geojson'] . '';
$rowOutput .= $id;
$rowOutput .= '}';
$output .= $rowOutput;
}
$particella = '{ "type": "FeatureCollection", "crs": { "type": "name", "properties": { "name": "urn:ogc:def:crs:EPSG::4326" } }, "features": [ ' . $output . ' ] }';
$_SESSION['SELECT_PARTICELLA'] = $particella;
} else {
$_SESSION['ZOOM'] = 12;
}
?>

109
routine_map_bckoffice.php

@ -0,0 +1,109 @@
<?php if (session_id() == "")session_start();ob_start(); ?>
<?php include_once "cfg_srv.php" ?>
<?php
function escapeJsonString($value) { # list from www.json.org: (\b backspace, \f formfeed)
$escapers = array("\\", "/", "\"", "\n", "\r", "\t", "\x08", "\x0c");
$replacements = array("\\\\", "\\/", "\\\"", "\\n", "\\r", "\\t", "\\f", "\\b");
$result = str_replace($escapers, $replacements, $value);
return $result;
}
//$_SESSION['cataparticella'] = str_replace(' ', '',$_GET['estremiCatastali']);
//echo "CATA PARTICELLA = ".$_SESSION['cataparticella']."<br>";
$arraymappale = explode(';', $_SESSION['cataparticella']);
if (count($arraymappale) > 0) {
foreach( $arraymappale as $index => $mappale ) {
if(!$query = @pg_query("SELECT id FROM ".$_SESSION['COMUNE_PROV'].".particelle WHERE comune = '".$_SESSION['COMUNE_BELF']."' AND mappale ='".$mappale."';"))
die("Error query CERCA PARTICELLA: " . pg_last_error($conn));
if (pg_numrows($query) > 0){
while($rowparticelle = pg_fetch_assoc($query)) {
$gidquery[] = $rowparticelle['id'];
}
}
}
$valorearray = count($gidquery);
//echo "VALORE ARRAY = ".$valorearray."<br>";
$stringa = implode(' OR id=', $gidquery);
$_SESSION['QUERY_CDU'] = $stringa;
//echo '<br>STRINGA: '.$_SESSION['QUERY_CDU']."<br>";
$_SESSION['GET_CDU'] = 1;
} else {
unset($_SESSION['cataparticella']);
unset($_SESSION['QUERY_CDU']);
$_SESSION['GET_CDU'] = 0;
}
// CALCOLA GEOMETRIA PARTICELLA
$sql_catasto = "SELECT ST_AsGeoJSON(ST_Transform(geom,4326)) AS cata_geojson, round(ST_Area(geom)::numeric,2) as area
FROM ".strtolower($_SESSION['COMUNE_PROV']).".particelle WHERE comune = '".$_SESSION['COMUNE_BELF']."' AND id=".$_SESSION['QUERY_CDU'].";";
$rs = pg_query($conn, $sql_catasto);
if (!$rs) {echo "ERROR GEOM PARTICELLE.\n"; } else { /*echo "QUERY OKKEY <br><br>";*/ }
$output = '';
$rowOutput = '';
while ($row = pg_fetch_assoc($rs)) {
$_SESSION['CENTER'] = $row['lat'] .", ".$row['long'];
$rowOutput = (strlen($rowOutput) > 0 ? ',' : '') . '{"type": "Feature", "properties": {';
$props = '';
$id = '';
foreach ($row as $key => $val) {
if ($key != "cata_geojson") { $props .= (strlen($props) > 0 ? ',' : '') . '"' . $key . '":"' . escapeJsonString($val) . '"'; }
if ($key == "id") { $id .= ',"id":"' . escapeJsonString($val) . '"'; }
}
$rowOutput .= $props . '}, "geometry": ' . $row['cata_geojson'] . '';
$rowOutput .= $id;
$rowOutput .= '}';
$output .= $rowOutput;
}
$particella = '{ "type": "FeatureCollection", "crs": { "type": "name", "properties": { "name": "urn:ogc:def:crs:EPSG::4326" } }, "features": [ ' . $output . ' ] }';
//$var=fopen("data/comune".$comuneuser.".json","w");
$_SESSION['SELECT_PARTICELLA'] = $particella;
if ($valorearray >= 1){
// ########## CALCOLA CENTROIDE PARTICELLA
if(!$strcoordinate = @pg_query("SELECT ST_X(ST_Transform(ST_Centroid(ST_Union(geom)),4326)) as long,
ST_Y(ST_Transform(ST_Centroid(ST_union(geom)),4326)) as lat
FROM ".$_SESSION['COMUNE_PROV'].".particelle WHERE comune = '".$_SESSION['COMUNE_BELF']."' AND id=".$_SESSION['QUERY_CDU'].";"))
die("Errore CENTRO COMUNE: " . pg_last_error($conn));
while($rowcoord = pg_fetch_assoc($strcoordinate)) { $_SESSION['CENTER'] = $rowcoord['lat'] .", ".$rowcoord['long']; }
//$_SESSION['CENTER'] = $lat .", ".$lng;
$_SESSION['ZOOM'] = 18;
// ########## CALCOLO BOUND PARTICELLA
if (!$strbound = @pg_query("SELECT ST_YMax(ST_Buffer(ST_Transform(geom,4326),0.15)) as ymax, ST_XMax(ST_Buffer(ST_Transform(geom,4326),0.15)) as xmax, ST_YMin(ST_Buffer(ST_Transform(geom,4326),0.15)) as ymin, ST_XMin(ST_Buffer(ST_Transform(geom,4326),0.15)) as xmin
FROM ".$_SESSION['COMUNE_PROV'].".particelle WHERE comune = '".$_SESSION['COMUNE_BELF']."' AND id=".$_SESSION['QUERY_CDU'].";"))
die("ERROR BOUND: " . pg_last_error($conn));
while ($rowbound = pg_fetch_assoc($strbound)) {
$_SESSION['BOUND'] = "[" . $rowbound['ymin'] . ", " . $rowbound['xmin'] . "],[" . $rowbound['ymax'] . ", " . $rowbound['xmax'] . "]";
}
} else {
$rs_comune = "SELECT bound FROM public.comuni WHERE cod_belf = '" . $_SESSION['COMUNE_BELF'] . "'";
$result = pg_query($conn, $rs_comune) or die('Query failed4');
$row_comune = pg_num_rows($result);
if ($row_comune > 0) {
while ($comunesession = pg_fetch_assoc($result)) {
$_SESSION['BOUND'] = $comunesession['bound'];
}
}
$_SESSION['CENTER'] = $_SESSION['LAT'] .", ".$_SESSION['LONG'];
$_SESSION['ZOOM'] = 17; }
?>

90
routine_map_interventi.php

@ -0,0 +1,90 @@
<?php if (session_id() == "")session_start();ob_start(); ?>
<?php include_once "cfg_srv.php" ?>
<?php
function escapeJsonString($value) { # list from www.json.org: (\b backspace, \f formfeed)
$escapers = array("\\", "/", "\"", "\n", "\r", "\t", "\x08", "\x0c");
$replacements = array("\\\\", "\\/", "\\\"", "\\n", "\\r", "\\t", "\\f", "\\b");
$result = str_replace($escapers, $replacements, $value);
return $result;
}
// ####### POLYGON ####### //
$sql_polygon = "SELECT id, notes, ST_AsGeoJSON(geom, 4326, 1) AS geojson FROM interventi_polygon WHERE idpratica = ".$_SESSION['IDPRATICA']."";
$rs_polygon = pg_query($conn, $sql_polygon);
if (!$rs_polygon) {echo "ERROR - POLYGON.\n"; } else { /*echo "QUERY OKKEY <br><br>";*/ }
$output = ''; $rowOutput = '';
while ($row = pg_fetch_assoc($rs_polygon)) {
$rowOutput = (strlen($rowOutput) > 0 ? ',' : '') . '{"type": "Feature", "properties": {';
$props = '';
$id = '';
foreach ($row as $key => $val) {
if ($key != "geojson") {
$props .= (strlen($props) > 0 ? ',' : '') . '"' . $key . '":"' . escapeJsonString($val) . '"';
}
if ($key == "id") { $id .= ',"id":"' . escapeJsonString($val) . '"'; }
}
$rowOutput .= $props . '}, "geometry": ' . $row['geojson'] . '';
$rowOutput .= $id;
$rowOutput .= '}';
$output .= $rowOutput;
}
$_SESSION['INT_POLYGON'] = '{ "type": "FeatureCollection", "crs": { "type": "name", "properties": { "name": "urn:ogc:def:crs:EPSG::4326" } }, "features": [ ' . $output . ' ] }';
// ####### LINE ####### //
$sql_line = "SELECT id, notes, ST_AsGeoJSON(geom, 4326, 1) AS geojson FROM interventi_line WHERE idpratica = ".$_SESSION['IDPRATICA']."";
$rs_line = pg_query($conn, $sql_line);
if (!$rs_line) {echo "ERROR - LINE.\n"; } else { /*echo "QUERY OKKEY <br><br>";*/ }
$output = ''; $rowOutput = '';
while ($row = pg_fetch_assoc($rs_line)) {
$rowOutput = (strlen($rowOutput) > 0 ? ',' : '') . '{"type": "Feature", "properties": {';
$props = '';
$id = '';
foreach ($row as $key => $val) {
if ($key != "geojson") {
$props .= (strlen($props) > 0 ? ',' : '') . '"' . $key . '":"' . escapeJsonString($val) . '"';
}
if ($key == "id") { $id .= ',"id":"' . escapeJsonString($val) . '"'; }
}
$rowOutput .= $props . '}, "geometry": ' . $row['geojson'] . '';
$rowOutput .= $id;
$rowOutput .= '}';
$output .= $rowOutput;
}
$_SESSION['INT_LINE'] = '{ "type": "FeatureCollection", "crs": { "type": "name", "properties": { "name": "urn:ogc:def:crs:EPSG::4326" } }, "features": [ ' . $output . ' ] }';
// ####### POINT ####### //
$sql_point = "SELECT id, notes, ST_AsGeoJSON(geom, 4326, 1) AS geojson FROM interventi_point WHERE idpratica = ".$_SESSION['IDPRATICA']."";
$rs_point = pg_query($conn, $sql_point);
if (!$rs_point) {echo "ERROR - POINT.\n"; } else { /*echo "QUERY OKKEY <br><br>";*/ }
$output = ''; $rowOutput = '';
while ($row = pg_fetch_assoc($rs_point)) {
$rowOutput = (strlen($rowOutput) > 0 ? ',' : '') . '{"type": "Feature", "properties": {';
$props = '';
$id = '';
foreach ($row as $key => $val) {
if ($key != "geojson") {
$props .= (strlen($props) > 0 ? ',' : '') . '"' . $key . '":"' . escapeJsonString($val) . '"';
}
if ($key == "id") { $id .= ',"id":"' . escapeJsonString($val) . '"'; }
}
$rowOutput .= $props . '}, "geometry": ' . $row['geojson'] . '';
$rowOutput .= $id;
$rowOutput .= '}';
$output .= $rowOutput;
}
$_SESSION['INT_POINT'] = '{ "type": "FeatureCollection", "crs": { "type": "name", "properties": { "name": "urn:ogc:def:crs:EPSG::4326" } }, "features": [ ' . $output . ' ] }';
?>

42
routine_map_ricercageo.php

@ -0,0 +1,42 @@
<?php if (session_id() == "") session_start();
ob_start(); ?>
<?php include_once "cfg_srv.php" ?>
<?php
if ($_SESSION['DATA_PROV'] == "prov") {
// ########## CALCOLA CENTROIDE & BOUND PROVINCIA
$rs_prov = "SELECT lat, long, bound FROM public.provincie WHERE provincia = '" . $_SESSION['COMUNE_PROV'] . "'";
$result = pg_query($conn, $rs_prov) or die('Query failed4');
$row_prov = pg_num_rows($result);
if ($row_prov > 0) {
while ($provsession = pg_fetch_assoc($result)) {
$_SESSION['CENTER'] = $provsession['lat'] . ", " . $provsession['long'];
$_SESSION['BOUND'] = $provsession['bound'];
$_SESSION['LIMITE_AMMINISTRATIVO'] = $_SESSION['COMUNE_PROV']."_limite_provincia.json";
}
}
$_SESSION['ZOOM'] = 10;
}
//
if ($_SESSION['DATA_PROV'] == "comu") {
$rs_comune = "SELECT lat, long, bound FROM public.comuni WHERE cod_belf = '" . $_SESSION['COMUNE_BELF'] . "'";
$result = pg_query($conn, $rs_comune) or die('Query failed4');
$row_comune = pg_num_rows($result);
if ($row_comune > 0) {
while ($comunesession = pg_fetch_assoc($result)) {
$_SESSION['CENTER'] = $comunesession['lat'] .", ".$comunesession['long'];
$_SESSION['BOUND'] = $comunesession['bound'];
$_SESSION['LIMITE_AMMINISTRATIVO'] = $_SESSION['COMUNE_BELF']."_limite_comune.json";
}
}
$_SESSION['ZOOM'] = 12;
}

1671
routine_rec.php

File diff soppresso perché troppo grande Load Diff
Caricamento…
Annulla
Salva