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