mappe per georeferenziazione
Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.

200 righe
8.5 KiB

2 anni fa
<?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);
2 anni fa
// INIZIO PROCEDURA DI RICERCA PROVENIENTE DA FORM QUESTA PAGINA
2 anni fa
//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>";
}
}
?>
2 anni fa
<?php if(strlen($stringa)==0) { // tutte le variabili di ricerca a 0
2 anni fa
?>
<!-- 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" style="margin-bottom: 0.5rem;"> <input type="text" name="mappale[]" style="width: 75%; font-size:14px" 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:9px"></i></a></p>
2 anni fa
<input type="submit" class="btn btn-primary" style="margin-top: 0.5rem;width: 84%" value=" Conferma Dati" /><br><br>
2 anni fa
</form>
<p>
<?php } // end all variable ?>
</div>
</body>
</html>