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.
54 righe
2.6 KiB
54 righe
2.6 KiB
<?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; |
|
} |
|
} |
|
|
|
?>
|