Commit ebc48f39993efcd1fc2c3f331a15c3d7e5687ba9
1 parent
cf109475
Exists in
master
and in
7 other branches
atualizacao de ogc.php
Showing
1 changed file
with
21 additions
and
7 deletions
Show diff stats
ogc.php
... | ... | @@ -103,7 +103,7 @@ if(isset($_GET["TileMatrix"])){ |
103 | 103 | $_GET["REQUEST"] = "getMap"; |
104 | 104 | } |
105 | 105 | $_GET = array_merge($_GET,$_POST); |
106 | - | |
106 | +$tema = $_GET["tema"]; | |
107 | 107 | if($_GET["id_medida_variavel"] != ""){ |
108 | 108 | $_GET["id_medida_variavel"] = filter_var ( $_GET["id_medida_variavel"], FILTER_SANITIZE_NUMBER_INT); |
109 | 109 | } |
... | ... | @@ -129,6 +129,7 @@ $cache = true; |
129 | 129 | //require_once(dirname(__FILE__)."/classesphp/carrega_ext.php"); |
130 | 130 | include(dirname(__FILE__)."/ms_configura.php"); |
131 | 131 | include(dirname(__FILE__)."/classesphp/funcoes_gerais.php"); |
132 | + | |
132 | 133 | // |
133 | 134 | //ajusta o default |
134 | 135 | // |
... | ... | @@ -156,13 +157,15 @@ $protocolo = strtolower($protocolo) . '://'.$_SERVER['SERVER_NAME'] .":". $_SERV |
156 | 157 | $urli3geo = str_replace("/ogc.php","",$protocolo.$_SERVER["PHP_SELF"]); |
157 | 158 | // |
158 | 159 | //define um nome para o mapfile caso a origem seja o sistema de metadados estatisticos |
159 | -// | |
160 | +// | |
161 | + | |
160 | 162 | if(isset($_GET["id_medida_variavel"]) && $_GET["id_medida_variavel"] != ""){ |
161 | 163 | $tema = "ogcmetaestat".$_GET["id_medida_variavel"]; |
162 | 164 | } |
163 | 165 | // |
164 | 166 | //compatibiliza variaveis |
165 | 167 | // |
168 | + | |
166 | 169 | if(!isset($tema) && isset($_GET["layers"])){ |
167 | 170 | $tema = $_GET["layers"]; |
168 | 171 | } |
... | ... | @@ -184,6 +187,7 @@ if(isset($_GET["typeName"])){ |
184 | 187 | if(!isset($tema) && isset($_GET["typename"])){ |
185 | 188 | $tema = $_GET["typename"]; |
186 | 189 | } |
190 | + | |
187 | 191 | // |
188 | 192 | //garante que layers possam ser especificados de diferentes maneiras |
189 | 193 | //mas evita definir o layer como o nome do mapfile |
... | ... | @@ -260,6 +264,7 @@ if(!isset($_GET["srs"]) && !isset($_GET["SRS"])){ |
260 | 264 | $_GET["srs"] = "EPSG:4326"; |
261 | 265 | $_GET["SRS"] = "EPSG:4326"; |
262 | 266 | } |
267 | + | |
263 | 268 | // |
264 | 269 | //trata geojson da mesma forma que json |
265 | 270 | // |
... | ... | @@ -323,6 +328,7 @@ if(isset($_GET["version"]) && !isset($_GET["VERSION"])){ |
323 | 328 | if(!isset($VERSION) || $VERSION == ""){ |
324 | 329 | $req->setParameter("VeRsIoN","1.1.1"); |
325 | 330 | } |
331 | + | |
326 | 332 | // |
327 | 333 | //nome do mapfile que ficara em cache |
328 | 334 | // |
... | ... | @@ -363,6 +369,7 @@ $nomeMapfileTmp = $dir_tmp."/ogc_".md5(implode("",$arrayget))."_".$agora.".map"; |
363 | 369 | //essa variavel e usada para definir se a imagem final gerada devera ser cortada ou nao |
364 | 370 | $cortePixels = 0; |
365 | 371 | $ogcwsmap = $_GET["ogcwsmap"]; |
372 | + | |
366 | 373 | if(file_exists($nomeMapfileTmp) && $tipo == ""){ |
367 | 374 | $oMap = ms_newMapobj($nomeMapfileTmp); |
368 | 375 | } |
... | ... | @@ -400,7 +407,6 @@ else{ |
400 | 407 | } |
401 | 408 | $e = $oMap->extent; |
402 | 409 | $extensaoMap = ($e->minx)." ".($e->miny)." ".($e->maxx)." ".($e->maxy); |
403 | - | |
404 | 410 | //gera o mapa |
405 | 411 | if ($tema != ""){ |
406 | 412 | $listatema = explode(" ",$tema); |
... | ... | @@ -502,8 +508,9 @@ else{ |
502 | 508 | $extensao = $extensaoMap; |
503 | 509 | } |
504 | 510 | $l->setmetadata("wms_extent",$extensao); |
505 | - if (!empty($postgis_mapa)){ | |
511 | + if (!empty($postgis_mapa)){ | |
506 | 512 | if ($l->connectiontype == MS_POSTGIS){ |
513 | + | |
507 | 514 | $lcon = $l->connection; |
508 | 515 | if (($lcon == " ") || ($lcon == "") || (in_array($lcon,array_keys($postgis_mapa)))){ |
509 | 516 | // |
... | ... | @@ -793,10 +800,12 @@ if(isset($_GET["tms"])){ |
793 | 800 | $lon2 = $top_left_minx + ($_GET["TileCol"] * $x_size) + $x_size; |
794 | 801 | $lat2 = $top_left_maxy - ($_GET["TileRow"] * $y_size); |
795 | 802 | } |
803 | + | |
796 | 804 | //essa funcao termina o processo se a imagem existir |
797 | 805 | if($cache == true){ |
798 | 806 | carregaCacheImagem($cachedir,$nomeMapfileTmp,$_GET["tms"]); |
799 | 807 | } |
808 | + | |
800 | 809 | $layer0 = $oMap->getlayer(0); |
801 | 810 | // |
802 | 811 | //numero de pixels que serao considerados para corte da imagem no caso de cache ativo e tema de pontos |
... | ... | @@ -824,7 +833,9 @@ if(isset($_GET["tms"])){ |
824 | 833 | $ponto->setxy(($wh/2),($wh/2)); |
825 | 834 | $oMap->zoomScale($escalaInicial, $ponto, $wh, $wh, $extensaoInicial); |
826 | 835 | } |
836 | + | |
827 | 837 | $img = $oMap->draw(); |
838 | + | |
828 | 839 | if($img->imagepath == ""){ |
829 | 840 | exit; |
830 | 841 | } |
... | ... | @@ -833,6 +844,7 @@ if(isset($_GET["tms"])){ |
833 | 844 | } |
834 | 845 | renderNocacheTms(); |
835 | 846 | } |
847 | + | |
836 | 848 | // |
837 | 849 | //verifica se a chamada do servico e do tipo TILE no padrao do Google |
838 | 850 | // |
... | ... | @@ -1133,11 +1145,12 @@ function ogc_imprimeListaDeTemasWfs(){ |
1133 | 1145 | function carregaCacheImagem($cachedir,$map,$tms){ |
1134 | 1146 | global $dir_tmp; |
1135 | 1147 | if($cachedir == ""){ |
1136 | - $nome = $dir_tmp."/cache".$tms.".png"; | |
1148 | + $nome = $dir_tmp."/cache".$tms; | |
1137 | 1149 | } |
1138 | 1150 | else{ |
1139 | - $nome = $cachedir.$tms.".png"; | |
1151 | + $nome = $cachedir.$tms; | |
1140 | 1152 | } |
1153 | + $nome = str_replace(".png","",$nome).".png"; | |
1141 | 1154 | if(file_exists($nome)){ |
1142 | 1155 | header('Content-Length: '.filesize($nome)); |
1143 | 1156 | header('Content-Type: image/png'); |
... | ... | @@ -1159,10 +1172,11 @@ function salvaCacheImagem($cachedir,$map,$tms){ |
1159 | 1172 | else{ |
1160 | 1173 | $nome = $cachedir.$tms; |
1161 | 1174 | } |
1175 | + $nome = str_replace(".png","",$nome).".png"; | |
1162 | 1176 | @mkdir(dirname($nome),0774,true); |
1163 | 1177 | chmod(dirname($nome),0774); |
1164 | 1178 | |
1165 | - $img->saveImage($nome.".png"); | |
1179 | + $img->saveImage($nome); | |
1166 | 1180 | // |
1167 | 1181 | //corta a imagem gerada para voltar ao tamanho normal |
1168 | 1182 | // | ... | ... |