Commit a00fad965ca93ce4ab39f9a6981788483f7627b3
1 parent
7e00ed44
Exists in
master
and in
7 other branches
Implementação da nomenclatura do padrão TMS para o cache de imagens
Showing
8 changed files
with
185 additions
and
134 deletions
Show diff stats
admin/admin.db
No preview for this file type
aplicmap/ogcwsv6.map
| ... | ... | @@ -93,7 +93,8 @@ MAP |
| 93 | 93 | "ows_city" "Brasilia" |
| 94 | 94 | "ows_contactperson" "Web Master" |
| 95 | 95 | "ows_addresstype" "uri" |
| 96 | - "ows_context_version" "1.0.0" | |
| 96 | + "ows_context_version" "1.1.0" | |
| 97 | + "wms_getcapabilities_version" "1.1.0" | |
| 97 | 98 | "ows_abstract" "Web services gerados da base de dados do i3Geo. Para chamar um tema especificamente, veja o sistema de ajuda, digitando no navegador web ogc.php?ajuda=, para uma lista compacta de todos os servicos, digite ogc.php?lista=temas" |
| 98 | 99 | "ows_contactposition" "Administrador do sitio web" |
| 99 | 100 | "ows_stateorprovince" "DF" | ... | ... |
classesjs/classe_interface.js
| ... | ... | @@ -987,13 +987,10 @@ i3GEO.Interface = { |
| 987 | 987 | temp = camada.type === 0 ? opcoes.gutter = 20 : opcoes.gutter = 0; |
| 988 | 988 | temp = camada.transitioneffect === "nao" ? opcoes.transitionEffect = "null" : opcoes.transitionEffect = "resize"; |
| 989 | 989 | // |
| 990 | - //layers marcados com o metadata wms_tile com valor 1 sao inseridos com Layer.TileCache | |
| 990 | + //layers marcados com o metadata wmstile com valor 1 sao inseridos com Layer.TileCache | |
| 991 | 991 | // |
| 992 | 992 | if(camada.connectiontype === 7 && camada.wmsurl !== "" && camada.usasld.toLowerCase() != "sim"){ |
| 993 | 993 | urllayer = camada.wmsurl+"&r="+Math.random(); |
| 994 | - /** | |
| 995 | - * TODO não funciona | |
| 996 | - */ | |
| 997 | 994 | if(camada.wmstile == 1){ |
| 998 | 995 | layer = new OpenLayers.Layer.TMS(camada.name, camada.wmsurl,{isBaseLayer:false,layername:camada.wmsname,type:'png'}); |
| 999 | 996 | } |
| ... | ... | @@ -1009,17 +1006,40 @@ i3GEO.Interface = { |
| 1009 | 1006 | else{ |
| 1010 | 1007 | temp = camada.type === 3 ? opcoes.singleTile = false : opcoes.singleTile = !(i3GEO.Interface.openlayers.TILES); |
| 1011 | 1008 | } |
| 1012 | - if(camada.wmstile == 1){ | |
| 1013 | - layer = new OpenLayers.Layer.TileCache(camada.name, urllayer,{LAYERS:camada.name,map_imagetype:i3GEO.Interface.OUTPUTFORMAT},opcoes); | |
| 1009 | + if(opcoes.singleTile === true){ | |
| 1010 | + layer = new OpenLayers.Layer.WMS( | |
| 1011 | + camada.name, | |
| 1012 | + urllayer, | |
| 1013 | + { | |
| 1014 | + LAYERS:camada.name, | |
| 1015 | + format:camada.wmsformat, | |
| 1016 | + transparent:true | |
| 1017 | + }, | |
| 1018 | + opcoes | |
| 1019 | + ); | |
| 1020 | + //layer = new OpenLayers.Layer.TileCache(camada.name, urllayer,{LAYERS:camada.name,map_imagetype:i3GEO.Interface.OUTPUTFORMAT},opcoes); | |
| 1014 | 1021 | } |
| 1015 | 1022 | else{ |
| 1016 | - layer = new OpenLayers.Layer.WMS(camada.name, urllayer,{LAYERS:camada.name,map_imagetype:i3GEO.Interface.OUTPUTFORMAT},opcoes); | |
| 1023 | + layer = new OpenLayers.Layer.TMS( | |
| 1024 | + camada.name, | |
| 1025 | + urllayer, | |
| 1026 | + { | |
| 1027 | + isBaseLayer:false, | |
| 1028 | + serviceVersion:"&tms=", | |
| 1029 | + type:"png", | |
| 1030 | + layername:camada.name, | |
| 1031 | + map_imagetype:i3GEO.Interface.OUTPUTFORMAT, | |
| 1032 | + tileOrigin: new OpenLayers.LonLat(-180, -90) | |
| 1033 | + }, | |
| 1034 | + opcoes | |
| 1035 | + ); | |
| 1017 | 1036 | } |
| 1018 | 1037 | } |
| 1019 | 1038 | } |
| 1020 | 1039 | catch(e){} |
| 1021 | - if(camada.escondido.toLowerCase() === "sim") | |
| 1022 | - {layer.transitionEffect = "null";} | |
| 1040 | + if(camada.escondido.toLowerCase() === "sim"){ | |
| 1041 | + layer.transitionEffect = "null"; | |
| 1042 | + } | |
| 1023 | 1043 | i3geoOL.addLayer(layer); |
| 1024 | 1044 | } |
| 1025 | 1045 | else | ... | ... |
classesphp/mapa_googlemaps.php
| ... | ... | @@ -102,6 +102,8 @@ $x++; |
| 102 | 102 | $y++; |
| 103 | 103 | $lon2 = $x / $n * 360.0 - 180.0; |
| 104 | 104 | $lat1 = rad2deg(atan(sinh(pi() * (1 - 2 * $y / $n)))); |
| 105 | +$x--; | |
| 106 | +$y--; | |
| 105 | 107 | |
| 106 | 108 | $projInObj = ms_newprojectionobj("proj=latlong,a=6378137,b=6378137"); |
| 107 | 109 | $projOutObj = ms_newprojectionobj("proj=merc,a=6378137,b=6378137,lat_ts=0.0,lon_0=0.0,x_0=0.0,y_0=0,k=1.0,units=m"); |
| ... | ... | @@ -156,10 +158,6 @@ if(!isset($_GET["telaR"])){ |
| 156 | 158 | if($layerName == $_GET["layer"]){ |
| 157 | 159 | if(strtolower($l->getmetadata("cache")) == "sim"){ |
| 158 | 160 | $cache = true; |
| 159 | - $nomecache = $l->getmetadata("nomeoriginal"); | |
| 160 | - if($nomecache == ""){ | |
| 161 | - $nomecache = $layerName; | |
| 162 | - } | |
| 163 | 161 | } |
| 164 | 162 | } |
| 165 | 163 | } |
| ... | ... | @@ -312,6 +310,7 @@ function salvaCacheImagem(){ |
| 312 | 310 | if(!file_exists($c."/$y.png")){ |
| 313 | 311 | mkdir($cachedir."/googlemaps/$layer/$z/$x",0777,true); |
| 314 | 312 | $img->saveImage($c."/$y.png"); |
| 313 | + chmod($c."/$y.png",0777); | |
| 315 | 314 | } |
| 316 | 315 | return $nome; |
| 317 | 316 | } | ... | ... |
classesphp/mapa_openlayers.php
| ... | ... | @@ -62,16 +62,39 @@ error_reporting(0); |
| 62 | 62 | //carrega dados da seção, verifica segurança |
| 63 | 63 | inicializa(); |
| 64 | 64 | // |
| 65 | -//map_fileX é necessário caso register_globals = On no PHP.INI | |
| 65 | +//calcula a extensao geografica com base no x,y,z | |
| 66 | +//nos casos do modo notile, a requisicao e feita como se fosse um wms | |
| 67 | +//quando for do tipo tms $_GET["tms"] contem os parametros do tile | |
| 68 | +if(isset($_GET["tms"])){ | |
| 69 | + $_GET["WIDTH"] = 256; | |
| 70 | + $_GET["HEIGHT"] = 256; | |
| 71 | + $temp = explode("/",$_GET["tms"]); | |
| 72 | + $z = $temp[2]; | |
| 73 | + $x = $temp[3]; | |
| 74 | + $y = str_replace(".png","",$temp[4]); | |
| 75 | + | |
| 76 | + $n = pow(2,$z+1); | |
| 77 | + $lon1 = $x / $n * 360.0 - 180.0; | |
| 78 | + $lon2 = ($x+1) / $n * 360.0 - 180.0; | |
| 79 | + $n = pow(2,$z); | |
| 80 | + $lat1 = $y / $n * 180.0 - 90.0; | |
| 81 | + $lat2 = ($y+1) / $n * 180.0 - 90.0; | |
| 82 | + $_GET["BBOX"] = $lon1." ".$lat1." ".$lon2." ".$lat2; | |
| 83 | +} | |
| 84 | + | |
| 85 | +// | |
| 86 | +//map_fileX e para o caso register_globals = On no PHP.INI | |
| 66 | 87 | $map_fileX = $_SESSION["map_file"]; |
| 67 | -if(isset($_GET["tipolayer"]) && $_GET["tipolayer"] == "fundo") | |
| 68 | -{$map_fileX = str_replace(".map","fundo.map",$map_fileX);} | |
| 88 | +if(isset($_GET["tipolayer"]) && $_GET["tipolayer"] == "fundo"){ | |
| 89 | + $map_fileX = str_replace(".map","fundo.map",$map_fileX); | |
| 90 | +} | |
| 69 | 91 | $postgis_mapa = $_SESSION["postgis_mapa"]; |
| 70 | 92 | $cachedir = $_SESSION["cachedir"]; |
| 71 | 93 | if(isset($_GET["BBOX"])){ |
| 72 | 94 | $_GET["mapext"] = str_replace(","," ",$_GET["BBOX"]); |
| 73 | 95 | $_GET["map_size"] = $_GET["WIDTH"]." ".$_GET["HEIGHT"]; |
| 74 | 96 | } |
| 97 | +$_GET["TIPOIMAGEM"] = trim($_GET["TIPOIMAGEM"]); | |
| 75 | 98 | $mapa = ms_newMapObj($map_fileX); |
| 76 | 99 | // |
| 77 | 100 | //resolve o problema da seleção na versão nova do mapserver |
| ... | ... | @@ -84,28 +107,24 @@ $qy = file_exists($qyfile); |
| 84 | 107 | if(!isset($_GET["telaR"])){//no caso de projecoes remotas, o mapfile nao e alterado |
| 85 | 108 | $numlayers = $mapa->numlayers; |
| 86 | 109 | $cache = false; |
| 87 | - for($i = 0;$i < $numlayers;++$i) | |
| 88 | - { | |
| 110 | + for($i = 0;$i < $numlayers;++$i){ | |
| 89 | 111 | $l = $mapa->getLayer($i); |
| 90 | - if ($l->getmetadata("classesnome") != "") | |
| 91 | - { | |
| 92 | - if(!function_exists("autoClasses")) | |
| 93 | - {include_once("funcoes_gerais.php");} | |
| 94 | - autoClasses($l,$mapa); | |
| 95 | - } | |
| 96 | 112 | $layerName = $l->name; |
| 97 | - if($layerName != $_GET["layer"]) | |
| 98 | - {$l->set("status",MS_OFF);} | |
| 99 | - if($layerName == $_GET["layer"] || $l->group == $_GET["layer"] && $l->group != "") | |
| 100 | - { | |
| 113 | + if($layerName != $_GET["layer"]){ | |
| 114 | + $l->set("status",MS_OFF); | |
| 115 | + } | |
| 116 | + if($layerName == $_GET["layer"] || $l->group == $_GET["layer"] && $l->group != ""){ | |
| 117 | + if ($l->getmetadata("classesnome") != ""){ | |
| 118 | + if(!function_exists("autoClasses")) | |
| 119 | + {include_once("funcoes_gerais.php");} | |
| 120 | + autoClasses($l,$mapa); | |
| 121 | + } | |
| 101 | 122 | $l->set("status",MS_DEFAULT); |
| 102 | - if (!empty($postgis_mapa)) | |
| 103 | - { | |
| 104 | - if ($l->connectiontype == MS_POSTGIS) | |
| 105 | - { | |
| 123 | + $l->set("template","none.htm"); | |
| 124 | + if (!empty($postgis_mapa)){ | |
| 125 | + if ($l->connectiontype == MS_POSTGIS){ | |
| 106 | 126 | $lcon = $l->connection; |
| 107 | - if (($lcon == " ") || ($lcon == "") || (in_array($lcon,array_keys($postgis_mapa)))) | |
| 108 | - { | |
| 127 | + if (($lcon == " ") || ($lcon == "") || (in_array($lcon,array_keys($postgis_mapa)))){ | |
| 109 | 128 | if(($lcon == " ") || ($lcon == "")) |
| 110 | 129 | {$l->set("connection",$postgis_mapa);} |
| 111 | 130 | else |
| ... | ... | @@ -114,17 +133,15 @@ if(!isset($_GET["telaR"])){//no caso de projecoes remotas, o mapfile nao e alter |
| 114 | 133 | } |
| 115 | 134 | } |
| 116 | 135 | } |
| 117 | - if($layerName == $_GET["layer"]) | |
| 118 | - { | |
| 119 | - if(strtolower($l->getmetadata("cache")) == "sim") | |
| 120 | - { | |
| 136 | + if($layerName == $_GET["layer"]){ | |
| 137 | + if(strtolower($l->getmetadata("cache")) == "sim"){ | |
| 121 | 138 | $cache = true; |
| 122 | 139 | $nomecache = $l->getmetadata("nomeoriginal"); |
| 123 | - if($nomecache == "") | |
| 124 | - {$nomecache = $layerName;} | |
| 140 | + if($nomecache == ""){ | |
| 141 | + $nomecache = $layerName; | |
| 142 | + } | |
| 125 | 143 | } |
| 126 | 144 | } |
| 127 | - $l->set("template","none.htm"); | |
| 128 | 145 | if($_GET["REQUEST"] == "GetFeatureInfo" || $_GET["REQUEST"] == "getfeature"){ |
| 129 | 146 | $l->setmetadata("gml_include_items","all"); |
| 130 | 147 | $l->setmetadata("WMS_INCLUDE_ITEMS","all"); |
| ... | ... | @@ -135,21 +152,22 @@ if(!isset($_GET["telaR"])){//no caso de projecoes remotas, o mapfile nao e alter |
| 135 | 152 | } |
| 136 | 153 | } |
| 137 | 154 | } |
| 155 | +if (!function_exists('imagepng')) | |
| 156 | +{$_GET["TIPOIMAGEM"] = "";} | |
| 157 | + | |
| 138 | 158 | if($_GET["layer"] == "") |
| 139 | 159 | {$cache = true;} |
| 140 | -if($_GET == false) | |
| 141 | -{$cache = false;} | |
| 142 | -if(!empty($_GET["DESLIGACACHE"])){ | |
| 143 | - if(strtolower($_GET["DESLIGACACHE"]) == "sim") | |
| 144 | - {$cache = false;} | |
| 160 | + | |
| 161 | +if(($_GET == false) || ($qy) || (strtolower($_GET["DESLIGACACHE"]) == "sim")){ | |
| 162 | + $cache = false; | |
| 145 | 163 | } |
| 146 | -if(trim($_GET["TIPOIMAGEM"]) != "" && trim($_GET["TIPOIMAGEM"]) != "nenhum") | |
| 164 | +elseif($_GET["TIPOIMAGEM"] != "" && $_GET["TIPOIMAGEM"] != "nenhum") | |
| 147 | 165 | {$cache = false;} |
| 148 | -if($qy) | |
| 149 | -{$cache = false;} | |
| 150 | -if($cache == true) | |
| 151 | -{carregaCacheImagem($cachedir,$_GET["BBOX"],$nomecache,$map_fileX,$_GET["WIDTH"],$_GET["HEIGHT"]);} | |
| 152 | 166 | |
| 167 | +if($cache == true){ | |
| 168 | + //carregaCacheImagem($cachedir,$_GET["BBOX"],$nomecache,$map_fileX,$_GET["WIDTH"],$_GET["HEIGHT"]); | |
| 169 | + carregaCacheImagem($cachedir,$map,$tms); | |
| 170 | +} | |
| 153 | 171 | $map_size = explode(" ",$_GET["map_size"]); |
| 154 | 172 | $mapa->setsize($map_size[0],$map_size[1]); |
| 155 | 173 | if(isset($_GET["mapext"])){ |
| ... | ... | @@ -191,11 +209,9 @@ if(!isset($_GET["telaR"])){ |
| 191 | 209 | // |
| 192 | 210 | if($_GET["tipolayer"] != "fundo") |
| 193 | 211 | {$o->set("transparent",MS_TRUE);} |
| 194 | - | |
| 195 | 212 | if($qy != true) |
| 196 | 213 | {$img = $mapa->draw();} |
| 197 | -else | |
| 198 | -{ | |
| 214 | +else{ | |
| 199 | 215 | $handle = fopen ($qyfile, "r"); |
| 200 | 216 | $conteudo = fread ($handle, filesize ($qyfile)); |
| 201 | 217 | fclose ($handle); |
| ... | ... | @@ -240,17 +256,8 @@ else |
| 240 | 256 | } |
| 241 | 257 | $cache = false; |
| 242 | 258 | } |
| 243 | -if (!function_exists('imagepng')) | |
| 244 | -{ | |
| 245 | - $s = PHP_SHLIB_SUFFIX; | |
| 246 | - @dl( 'php_gd.'.$s ); | |
| 247 | - if (!function_exists('imagepng')) | |
| 248 | - {@dl( 'php_gd2.'.$s );} | |
| 249 | - if (!function_exists('imagepng')) | |
| 250 | - {$_GET["TIPOIMAGEM"] = "";} | |
| 251 | -} | |
| 252 | -if(trim($_GET["TIPOIMAGEM"]) != "" && trim($_GET["TIPOIMAGEM"]) != "nenhum") | |
| 253 | -{ | |
| 259 | + | |
| 260 | +if($_GET["TIPOIMAGEM"] != "" && $_GET["TIPOIMAGEM"] != "nenhum"){ | |
| 254 | 261 | if($img->imagepath == "") |
| 255 | 262 | {echo "Erro IMAGEPATH vazio";exit;} |
| 256 | 263 | $nomer = ($img->imagepath)."filtroimgtemp".nomeRand().".png"; |
| ... | ... | @@ -266,53 +273,58 @@ if(trim($_GET["TIPOIMAGEM"]) != "" && trim($_GET["TIPOIMAGEM"]) != "nenhum") |
| 266 | 273 | } |
| 267 | 274 | else{ |
| 268 | 275 | if($cache == true){ |
| 269 | - $nomer = salvaCacheImagem($cachedir,$_GET["BBOX"],$nomecache,$map_fileX,$_GET["WIDTH"],$_GET["HEIGHT"]); | |
| 276 | + //$nomer = salvaCacheImagem($cachedir,$_GET["BBOX"],$nomecache,$map_fileX,$_GET["WIDTH"],$_GET["HEIGHT"]); | |
| 277 | + $nomer = salvaCacheImagem($cachedir,$map_fileX,$_GET["tms"]); | |
| 270 | 278 | header('Content-Length: '.filesize($nomer)); |
| 271 | 279 | header('Content-Type: image/png'); |
| 272 | 280 | header('Cache-Control: max-age=3600, must-revalidate'); |
| 273 | 281 | header('Expires: ' . gmdate('D, d M Y H:i:s', time()+24*60*60) . ' GMT'); |
| 274 | 282 | header('Last-Modified: '.gmdate('D, d M Y H:i:s', filemtime($nomer)).' GMT', true, 200); |
| 275 | - //$etag = md5_file($nomer); | |
| 276 | - //header('Etag: '.$etag); | |
| 277 | 283 | fpassthru(fopen($nomer, 'rb')); |
| 278 | 284 | } |
| 279 | 285 | else{ |
| 280 | 286 | if($img->imagepath == "") |
| 281 | 287 | {echo "Erro IMAGEPATH vazio";exit;} |
| 282 | - /* | |
| 283 | - $nomer = ($img->imagepath)."imgtemp".nomeRand().".png"; | |
| 284 | - $img->saveImage($nomer); | |
| 285 | - header('Content-Length: '.filesize($nomer)); | |
| 286 | - header('Content-Type: image/png'); | |
| 287 | - fpassthru(fopen($nomer, 'rb')); | |
| 288 | - */ | |
| 289 | 288 | header('Content-Type: image/png'); |
| 290 | 289 | $img->saveImage(); |
| 291 | 290 | } |
| 292 | 291 | exit; |
| 293 | 292 | } |
| 294 | -function salvaCacheImagem($cachedir,$bbox,$layer,$map,$w,$h){ | |
| 295 | - global $img,$map_size; | |
| 296 | - //echo "oi".$cachedir;exit; | |
| 297 | - //layers que são sempre iguais | |
| 298 | - if($layer == "copyright" || $layer == "") | |
| 299 | - {$bbox = "";} | |
| 300 | - if($layer == "") | |
| 301 | - {$layer = "fundo";} | |
| 302 | - if($cachedir == "") | |
| 303 | - {$cachedir = dirname(dirname($map))."/cache/".$layer;} | |
| 304 | - else | |
| 305 | - {$cachedir = $cachedir."/".$layer;} | |
| 306 | - $nome = $cachedir."/".$w.$h.$bbox.".png"; | |
| 307 | - if(!file_exists($nome)) | |
| 308 | - { | |
| 309 | - @mkdir($cachedir,0777); | |
| 310 | - $img->saveImage($nome); | |
| 311 | - chmod($nome,0777); | |
| 293 | +function salvaCacheImagem($cachedir,$map,$tms){ | |
| 294 | + global $img; | |
| 295 | + if($cachedir == ""){ | |
| 296 | + $nome = dirname(dirname($map))."/cache".$tms; | |
| 297 | + } | |
| 298 | + else{ | |
| 299 | + $nome = $cachedir.$tms; | |
| 312 | 300 | } |
| 313 | - return $nome; | |
| 301 | + if(!file_exists($nome)){ | |
| 302 | + @mkdir(dirname($nome),0777,true); | |
| 303 | + $img->saveImage($nome); | |
| 304 | + chmod($nome,0777); | |
| 305 | + } | |
| 306 | + return $nome; | |
| 307 | +} | |
| 308 | +function carregaCacheImagem($cachedir,$map,$tms){ | |
| 309 | + if($cachedir == ""){ | |
| 310 | + $nome = dirname(dirname($map))."/cache".$tms; | |
| 311 | + } | |
| 312 | + else{ | |
| 313 | + $nome = $cachedir.$tms; | |
| 314 | + } | |
| 315 | + if(file_exists($nome)){ | |
| 316 | + header('Content-Length: '.filesize($nome)); | |
| 317 | + header('Content-Type: image/png'); | |
| 318 | + header('Cache-Control: max-age=3600, must-revalidate'); | |
| 319 | + header('Expires: ' . gmdate('D, d M Y H:i:s', time()+24*60*60) . ' GMT'); | |
| 320 | + header('Last-Modified: '.gmdate('D, d M Y H:i:s', filemtime($nome)).' GMT', true, 200); | |
| 321 | + $etag = md5_file($nome); | |
| 322 | + header('Etag: '.$etag); | |
| 323 | + fpassthru(fopen($nome, 'rb')); | |
| 324 | + exit; | |
| 325 | + } | |
| 314 | 326 | } |
| 315 | -function carregaCacheImagem($cachedir,$bbox,$layer,$map,$w,$h){ | |
| 327 | +function XcarregaCacheImagem($cachedir,$bbox,$layer,$map,$w,$h){ | |
| 316 | 328 | if($layer == "copyright" || $layer == "") |
| 317 | 329 | {$bbox = "";} |
| 318 | 330 | if($layer == "") |
| ... | ... | @@ -322,28 +334,7 @@ function carregaCacheImagem($cachedir,$bbox,$layer,$map,$w,$h){ |
| 322 | 334 | {$nome = dirname(dirname($map))."/cache/".$layer."/".$nome;} |
| 323 | 335 | else |
| 324 | 336 | {$nome = $cachedir."/".$layer."/".$nome;} |
| 325 | - if(file_exists($nome)) | |
| 326 | - { | |
| 327 | -/* | |
| 328 | - header('Accept-Ranges: bytes'); | |
| 329 | - header('Content-Length: '.filesize($nome)); | |
| 330 | - header('Content-Type: image/png'); | |
| 331 | - ob_start; | |
| 332 | - ob_flush(); | |
| 333 | - readfile($nome); | |
| 334 | - exit; | |
| 335 | - | |
| 336 | - ob_start(); | |
| 337 | - // assuming you have image data in $imagedata | |
| 338 | - $img = file_get_contents($nome); | |
| 339 | - $length = strlen($img); | |
| 340 | - header('Accept-Ranges: bytes'); | |
| 341 | - header('Content-Length: '.$length); | |
| 342 | - header('Content-Type: image/png'); | |
| 343 | - print($img); | |
| 344 | - ob_end_flush(); | |
| 345 | - exit; | |
| 346 | -*/ | |
| 337 | + if(file_exists($nome)){ | |
| 347 | 338 | header('Content-Length: '.filesize($nome)); |
| 348 | 339 | header('Content-Type: image/png'); |
| 349 | 340 | header('Cache-Control: max-age=3600, must-revalidate'); |
| ... | ... | @@ -393,23 +384,15 @@ function filtraImg($nomer,$tipoimagem){ |
| 393 | 384 | } |
| 394 | 385 | function inicializa(){ |
| 395 | 386 | clearstatcache(); |
| 396 | - //$_COOKIE = array(); | |
| 397 | - if (!function_exists('ms_GetVersion')){ | |
| 398 | - $s = PHP_SHLIB_SUFFIX; | |
| 399 | - @dl( 'php_mapscript.'.$s ); | |
| 400 | - $ler_extensoes[] = 'php_mapscript'; | |
| 401 | - } | |
| 402 | - //verificação de segurança | |
| 403 | - //$_SESSION = array(); | |
| 404 | 387 | session_name("i3GeoPHP"); |
| 405 | - if(@$_GET["g_sid"]) | |
| 406 | - {session_id($_GET["g_sid"]);} | |
| 407 | - else | |
| 408 | - {ilegal();} | |
| 388 | + if(@$_GET["g_sid"]){ | |
| 389 | + session_id($_GET["g_sid"]); | |
| 390 | + } | |
| 391 | + else{ | |
| 392 | + ilegal(); | |
| 393 | + } | |
| 409 | 394 | session_start(); |
| 410 | - //var_dump($_SESSION);exit; | |
| 411 | - if(@$_SESSION["fingerprint"]) | |
| 412 | - { | |
| 395 | + if(@$_SESSION["fingerprint"]){ | |
| 413 | 396 | $f = explode(",",$_SESSION["fingerprint"]); |
| 414 | 397 | if (md5('I3GEOSEC' . $_SERVER['HTTP_USER_AGENT'] . session_id()) != $f[0] && !in_array($_GET["telaR"],$f) ) |
| 415 | 398 | {ilegal();} | ... | ... |
temas/_llocali.map
| ... | ... | @@ -0,0 +1,47 @@ |
| 1 | +MAP | |
| 2 | + FONTSET "../symbols/fontes.txt" | |
| 3 | + SYMBOLSET "../symbols/simbolos.sym" | |
| 4 | + LAYER | |
| 5 | + #CONNECTION "user=postgres password=postgres dbname=geosaude host=localhost port=5432" | |
| 6 | + INCLUDE "include.map" | |
| 7 | + CONNECTIONTYPE POSTGIS | |
| 8 | + DATA "the_geom from (select * from i3geo_metaestat.bairros) as foo using unique gid using srid=4326" | |
| 9 | + METADATA | |
| 10 | + "METAESTAT_ID_MEDIDA_VARIAVEL" "" | |
| 11 | + "ID_MEDIDA_VARIAVEL" "" | |
| 12 | + "cache" "" | |
| 13 | + "CLASSE" "SIM" | |
| 14 | + "permitekmz" "nao" | |
| 15 | + "METAESTAT_CODIGO_TIPO_REGIAO" "" | |
| 16 | + "permitedownload" "sim" | |
| 17 | + "metaestat" "" | |
| 18 | + "permiteogc" "sim" | |
| 19 | + "permitekml" "sim" | |
| 20 | + "TEMA" "Bairros IBGE" | |
| 21 | + "convcaracter" "" | |
| 22 | + END # METADATA | |
| 23 | + NAME "w_bairros" | |
| 24 | + STATUS DEFAULT | |
| 25 | + TEMPLATE "none.htm" | |
| 26 | + TILEITEM "location" | |
| 27 | + TYPE POLYGON | |
| 28 | + UNITS METERS | |
| 29 | + CLASS | |
| 30 | + NAME "" | |
| 31 | + STYLE | |
| 32 | + ANGLE 0 | |
| 33 | + OFFSET 0 0 | |
| 34 | + OUTLINECOLOR 255 0 0 | |
| 35 | + SYMBOL "p0" | |
| 36 | + END # STYLE | |
| 37 | + STYLE | |
| 38 | + ANGLE 0 | |
| 39 | + COLOR 255 255 255 | |
| 40 | + OFFSET 0 0 | |
| 41 | + OPACITY 20 | |
| 42 | + END # STYLE | |
| 43 | + END # CLASS | |
| 44 | + END # LAYER | |
| 45 | + | |
| 46 | +END # MAP | |
| 47 | + | ... | ... |