Commit 808d9f762d77230794902d70dea79a182315e64d
1 parent
69e9763f
Exists in
master
and in
7 other branches
--no commit message
Showing
15 changed files
with
388 additions
and
299 deletions
Show diff stats
admin/admin.db
No preview for this file type
admin/php/preview.php
| ... | ... | @@ -141,13 +141,14 @@ if(ob_get_contents ()){ |
| 141 | 141 | ob_end_clean(); |
| 142 | 142 | } |
| 143 | 143 | |
| 144 | - $l = $oMap->getlayer(0); | |
| 145 | - $req->setParameter("LAYERS",$l->name); | |
| 144 | +$l = $oMap->getlayer(0); | |
| 145 | +$req->setParameter("LAYERS",$l->name); | |
| 146 | 146 | |
| 147 | 147 | ms_ioinstallstdouttobuffer(); |
| 148 | 148 | $req->setParameter("format","image/png"); |
| 149 | 149 | $oMap->owsdispatch($req); |
| 150 | 150 | $contenttype = ms_iostripstdoutbuffercontenttype(); |
| 151 | + | |
| 151 | 152 | if(!isset($OUTPUTFORMAT)){ |
| 152 | 153 | header("Content-type: $contenttype"); |
| 153 | 154 | } | ... | ... |
No preview for this file type
classesphp/classe_mapa.php
| ... | ... | @@ -1366,8 +1366,14 @@ class Mapa |
| 1366 | 1366 | for ($i = $numlayers-1;$i > 0;$i--){ |
| 1367 | 1367 | $layerAbaixo = $this->mapa->getlayer($i); |
| 1368 | 1368 | $tipo = $layerAbaixo->type; |
| 1369 | - if($tipo == 2 && ($layerAbaixo->getclass(0)->getstyle(0)->color->red == -1) && ($l->getclass(0)->getstyle(0)->color->red != -1)) { | |
| 1370 | - $tipo = 0;//vai subir | |
| 1369 | + if($layerAbaixo->numclasses > 0 && $l->numclasses > 0){ | |
| 1370 | + $c = $layerAbaixo->getclass(0); | |
| 1371 | + $c1 = $l->getclass(0); | |
| 1372 | + if($c->numstyles > 0 && $c1->numstyles > 0){ | |
| 1373 | + if($tipo == 2 && ($c->getstyle(0)->color->red == -1) && ($c1->getstyle(0)->color->red != -1)) { | |
| 1374 | + $tipo = 0;//vai subir | |
| 1375 | + } | |
| 1376 | + } | |
| 1371 | 1377 | } |
| 1372 | 1378 | if (($tipo != 2) && ($tipo != 3)){ |
| 1373 | 1379 | $nummove++; | ... | ... |
classesphp/funcoes_gerais.php
| ... | ... | @@ -443,7 +443,8 @@ Envia para o navegador uma imagem. Utilizado na tag IMG em arquivos HTML |
| 443 | 443 | function echoimg($arquivo,$tipo){ |
| 444 | 444 | echo header("Content-type: image/png \n\n"); |
| 445 | 445 | header('Content-Length: '.filesize($arquivo)); |
| 446 | - fpassthru(fopen($arquivo, 'rb')); | |
| 446 | + //fpassthru(fopen($arquivo, 'rb')); | |
| 447 | + readfile($arquivo); | |
| 447 | 448 | exit; |
| 448 | 449 | } |
| 449 | 450 | /* | ... | ... |
classesphp/mapa_googlemaps.php
| ... | ... | @@ -511,7 +511,8 @@ function carregaCacheImagem(){ |
| 511 | 511 | header('Content-Type: image/png'); |
| 512 | 512 | header('Cache-Control: public, max-age=22222222'); |
| 513 | 513 | header('Expires: ' . gmdate('D, d M Y H:i:s', time()+48*60*60) . ' GMT'); |
| 514 | - fpassthru(fopen($nome, 'rb')); | |
| 514 | + //fpassthru(fopen($nome, 'rb')); | |
| 515 | + readfile($nome); | |
| 515 | 516 | } |
| 516 | 517 | else{ |
| 517 | 518 | header('Cache-Control: public, max-age=22222222'); | ... | ... |
classesphp/mapa_openlayers.php
| ... | ... | @@ -92,7 +92,7 @@ if(isset($_GET["X"])){ |
| 92 | 92 | $z = intval((0.703125 / $res) / 4) + 1; |
| 93 | 93 | $x = floor((($box[0] + 180) / 360) * pow(2, $z)); |
| 94 | 94 | $y = floor((1 - log(tan(deg2rad($box[3])) + 1 / cos(deg2rad($box[3]))) / pi()) /2 * pow(2, $z)); |
| 95 | - | |
| 95 | + | |
| 96 | 96 | $_GET["WIDTH"] = 256; |
| 97 | 97 | $_GET["HEIGHT"] = 256; |
| 98 | 98 | $_GET["tms"] = "/".$_GET["layer"]."/".$z."/".$x."/".$y.".png"; |
| ... | ... | @@ -413,7 +413,8 @@ else{ |
| 413 | 413 | //header('Expires: ' . gmdate('D, d M Y H:i:s', time()+24*60*60) . ' GMT'); |
| 414 | 414 | header('Cache-Control: public, max-age=22222222'); |
| 415 | 415 | header('Expires: ' . gmdate('D, d M Y H:i:s', time()+48*60*60) . ' GMT'); |
| 416 | - fpassthru(fopen($nomer, 'rb')); | |
| 416 | + //fpassthru(fopen($nomer, 'rb')); | |
| 417 | + readfile($nomer); | |
| 417 | 418 | } |
| 418 | 419 | } |
| 419 | 420 | else{ |
| ... | ... | @@ -501,7 +502,8 @@ function carregaCacheImagem($cachedir,$map,$tms,$i3georendermode=0){ |
| 501 | 502 | header('Cache-Control: public, max-age=22222222'); |
| 502 | 503 | header('Expires: ' . gmdate('D, d M Y H:i:s', time()+48*60*60) . ' GMT'); |
| 503 | 504 | //header('Last-Modified: '.gmdate('D, d M Y H:i:s', filemtime($nome)).' GMT', true, 200); |
| 504 | - fpassthru(fopen($nome, 'rb')); | |
| 505 | + //fpassthru(fopen($nome, 'rb')); | |
| 506 | + readfile($nome); | |
| 505 | 507 | } |
| 506 | 508 | else{ |
| 507 | 509 | header('Cache-Control: public, max-age=22222222'); | ... | ... |
ferramentas/parametrossql/ogc.php
| ... | ... | @@ -459,7 +459,8 @@ function renderNocacheTms(){ |
| 459 | 459 | header('Cache-Control: max-age=3600, must-revalidate'); |
| 460 | 460 | header('Expires: ' . gmdate('D, d M Y H:i:s', time()+24*60*60) . ' GMT'); |
| 461 | 461 | header('Last-Modified: '.gmdate('D, d M Y H:i:s', filemtime($nomer)).' GMT', true, 200); |
| 462 | - fpassthru(fopen($nomer, 'rb')); | |
| 462 | + //fpassthru(fopen($nomer, 'rb')); | |
| 463 | + readfile($nomer); | |
| 463 | 464 | } |
| 464 | 465 | if($i3georendermode == 2){ |
| 465 | 466 | ob_clean(); |
| ... | ... | @@ -488,7 +489,8 @@ function carregaCacheImagem($cachedir,$map,$tms, $plugin, $tema){ |
| 488 | 489 | header('Last-Modified: '.gmdate('D, d M Y H:i:s', filemtime($nome)).' GMT', true, 200); |
| 489 | 490 | $etag = md5_file($nome); |
| 490 | 491 | header('Etag: '.$etag); |
| 491 | - fpassthru(fopen($nome, 'rb')); | |
| 492 | + //fpassthru(fopen($nome, 'rb')); | |
| 493 | + readfile($nome); | |
| 492 | 494 | exit; |
| 493 | 495 | } |
| 494 | 496 | } |
| ... | ... | @@ -527,7 +529,8 @@ function salvaCacheImagem($cachedir,$map,$tms, $plugin, $tema){ |
| 527 | 529 | header('Cache-Control: max-age=3600, must-revalidate'); |
| 528 | 530 | header('Expires: ' . gmdate('D, d M Y H:i:s', time()+24*60*60) . ' GMT'); |
| 529 | 531 | header('Last-Modified: '.gmdate('D, d M Y H:i:s', filemtime($nome)).' GMT', true, 200); |
| 530 | - fpassthru(fopen($nome, 'rb')); | |
| 532 | + //fpassthru(fopen($nome, 'rb')); | |
| 533 | + readfile($nome); | |
| 531 | 534 | exit; |
| 532 | 535 | } |
| 533 | 536 | ... | ... |
ferramentas/salvamapa/geraminiatura.php
| ... | ... | @@ -2,7 +2,7 @@ |
| 2 | 2 | /* |
| 3 | 3 | * Gera uma miniatura de um mapfile salvo no banco de dados |
| 4 | 4 | * Verifica se a imagem existe, caso contrario cria uma no diretorio temporario |
| 5 | - * | |
| 5 | + * | |
| 6 | 6 | * @param restauramapa - id do mapa a ser restaurado |
| 7 | 7 | * @param w |
| 8 | 8 | * @param h |
| ... | ... | @@ -47,5 +47,6 @@ header('Content-Length: '.filesize($nomeImagem)); |
| 47 | 47 | header('Content-Type: image/png'); |
| 48 | 48 | header('Cache-Control: public, max-age=22222222'); |
| 49 | 49 | header('Expires: ' . gmdate('D, d M Y H:i:s', time()+48*60*60) . ' GMT'); |
| 50 | -fpassthru(fopen($nomeImagem, 'rb')); | |
| 50 | +//fpassthru(fopen($nomeImagem, 'rb')); | |
| 51 | +readfile($nomeImagem); | |
| 51 | 52 | ?> |
| 52 | 53 | \ No newline at end of file | ... | ... |
mashups/openlayers.php
| ... | ... | @@ -277,7 +277,7 @@ if($temas != ""){ |
| 277 | 277 | if(in_array($tema,$visiveis)){ |
| 278 | 278 | $visivel = "true"; |
| 279 | 279 | } |
| 280 | - if($nlayers == 1 && strtoupper($layern->getmetadata("cache")) == "SIM" && $layern->getmetadata("PLUGINI3GEO") == ""){ | |
| 280 | + if(strtolower($DESLIGACACHE) != "sim" && $nlayers == 1 && strtoupper($layern->getmetadata("cache")) == "SIM" && $layern->getmetadata("PLUGINI3GEO") == ""){ | |
| 281 | 281 | if($layern->type != 2 && $layern->type != 3){ |
| 282 | 282 | $opacidade = 1; |
| 283 | 283 | } |
| ... | ... | @@ -646,7 +646,7 @@ if(!i3GEO.configura){ |
| 646 | 646 | } |
| 647 | 647 | ?> |
| 648 | 648 | i3GEO.editorOL.inicia(); |
| 649 | - | |
| 649 | + | |
| 650 | 650 | function adicionaPluginI3geo(camada,visivel){ |
| 651 | 651 | if(!camada.cache){ |
| 652 | 652 | camada["cache"] = "NAO"; | ... | ... |
mashups/osm.php
ogc.php
| ... | ... | @@ -77,9 +77,16 @@ ogc.php?tema=/var/www/i3geo/aplicmap/geral1debianv6.map&layers=mundo |
| 77 | 77 | |
| 78 | 78 | ogc.php?intervalo=0,50 |
| 79 | 79 | */ |
| 80 | +$_GET = array_merge($_GET,$_POST); | |
| 80 | 81 | // |
| 81 | -//validações e includes | |
| 82 | -// | |
| 82 | +//caso nenhum parametros tenha sido enviado | |
| 83 | +// | |
| 84 | +if(count($_GET) == 0){ | |
| 85 | + $tipo="metadados"; | |
| 86 | + $_GET["REQUEST"] = "getCapabilities"; | |
| 87 | + $_GET["request"] = "getCapabilities"; | |
| 88 | + $_GET["SERVICE"] = "WMS"; | |
| 89 | +} | |
| 83 | 90 | // |
| 84 | 91 | //compatibiliza chamadas fora do padrao |
| 85 | 92 | // |
| ... | ... | @@ -90,7 +97,7 @@ if(isset($_GET["outputformat"]) && $_GET["outputformat"] != ""){ |
| 90 | 97 | $_GET["OUTPUTFORMAT"] = $_GET["outputformat"]; |
| 91 | 98 | } |
| 92 | 99 | $cache = true; |
| 93 | -require_once(dirname(__FILE__)."/classesphp/carrega_ext.php"); | |
| 100 | +//require_once(dirname(__FILE__)."/classesphp/carrega_ext.php"); | |
| 94 | 101 | include(dirname(__FILE__)."/ms_configura.php"); |
| 95 | 102 | include(dirname(__FILE__)."/classesphp/pega_variaveis.php"); |
| 96 | 103 | include(dirname(__FILE__)."/classesphp/funcoes_gerais.php"); |
| ... | ... | @@ -112,154 +119,132 @@ $urli3geo = str_replace("/ogc.php","",$protocolo.$_SERVER["PHP_SELF"]); |
| 112 | 119 | // |
| 113 | 120 | //imprime na tela a lista de temas disponiveis |
| 114 | 121 | // |
| 115 | -if(isset($lista) && $lista == "temas"){ | |
| 122 | +if(isset($lista) && $lista != ""){ | |
| 116 | 123 | include_once(dirname(__FILE__)."/classesphp/classe_menutemas.php"); |
| 117 | - ogc_imprimeListaDeTemas(); | |
| 124 | + if($lista == "temas"){ | |
| 125 | + ogc_imprimeListaDeTemas(); | |
| 126 | + } | |
| 127 | + if($lista == "temaswfs"){ | |
| 128 | + ogc_imprimeListaDeTemasWfs(); | |
| 129 | + } | |
| 118 | 130 | exit; |
| 131 | +} | |
| 132 | +// | |
| 133 | +//define um nome para o mapfile caso a origem seja o sistema de metadados estatisticos | |
| 134 | +// | |
| 135 | +if(isset($id_medida_variavel) && $id_medida_variavel != ""){ | |
| 136 | + $tema = "ogcmetaestat".$id_medida_variavel; | |
| 137 | +} | |
| 138 | +// | |
| 139 | +//compatibiliza variaveis | |
| 140 | +// | |
| 141 | +if(!isset($tema) && isset($layers)){ | |
| 142 | + $tema = $layers; | |
| 143 | +} | |
| 144 | +if(!isset($tema) && isset($LAYERS)){ | |
| 145 | + $tema = $LAYERS; | |
| 146 | +} | |
| 147 | +if(!isset($tema) && isset($temas)){ | |
| 148 | + $tema = $temas; | |
| 119 | 149 | } |
| 120 | -if(isset($lista) && $lista == "temaswfs"){ | |
| 121 | - include_once(dirname(__FILE__)."/classesphp/classe_menutemas.php"); | |
| 122 | - ogc_imprimeListaDeTemasWfs(); | |
| 123 | - exit; | |
| 150 | +if(isset($typeName)){ | |
| 151 | + $typename = $typeName; | |
| 152 | +} | |
| 153 | +if(!isset($tema) && isset($typename)){ | |
| 154 | + $tema = $typename; | |
| 155 | +} | |
| 156 | +// | |
| 157 | +//garante que layers possam ser especificados de diferentes maneiras | |
| 158 | +// | |
| 159 | +$_GET["layers"] = $tema; | |
| 160 | +$_GET["LAYERS"] = $tema; | |
| 161 | +$layers = $tema; | |
| 162 | +// | |
| 163 | +//verifica o OUTPUTFORMAT e o cache de arquivo | |
| 164 | +// | |
| 165 | +if(!empty($OUTPUTFORMAT)){ | |
| 166 | + carregaCacheArquivo(); | |
| 124 | 167 | } |
| 125 | 168 | // |
| 126 | 169 | //para o caso da requisicao kml |
| 127 | 170 | // |
| 128 | 171 | if(strtolower($OUTPUTFORMAT) == "kml" || strtolower($OUTPUTFORMAT) == "kmz"){ |
| 129 | - //http://localhost/i3geo/pacotes/kmlmapserver/kmlservice.php?request=kmz&map=_lbiomashp&typename=_lbiomashp | |
| 130 | - if(!isset($tema) && isset($layers)){ | |
| 131 | - $tema = $layers; | |
| 132 | - } | |
| 133 | 172 | $urln = "pacotes/kmlmapserver/kmlservice.php?request=kmz&map=".$tema."&typename=".$tema; |
| 134 | 173 | header("Location:".$urln); |
| 135 | 174 | exit; |
| 136 | 175 | } |
| 176 | +// | |
| 177 | +//usa o epsg correto ao inves do apelido inventado pelo Google | |
| 178 | +// | |
| 179 | +if($_GET["SRS"] == "EPSG:900913" || $_GET["srs"] == "EPSG:900913"){ | |
| 180 | + $_GET["SRS"] = "EPSG:3857"; | |
| 181 | + $_GET["srs"] = "EPSG:3857"; | |
| 182 | +} | |
| 183 | +if(!isset($_GET["srs"]) && !isset($_GET["SRS"])){ | |
| 184 | + $_GET["srs"] = "EPSG:4326"; | |
| 185 | + $_GET["SRS"] = "EPSG:4326"; | |
| 186 | +} | |
| 137 | 187 | // |
| 138 | 188 | //trata geojson da mesma forma que json |
| 139 | 189 | // |
| 140 | 190 | if(strtolower($OUTPUTFORMAT) == "geojson"){ |
| 141 | 191 | $OUTPUTFORMAT = "json"; |
| 142 | 192 | } |
| 143 | -// | |
| 144 | -//define um nome para o mapfile caso a origem seja o sistema de metadados estatisticos | |
| 145 | -// | |
| 146 | -if(isset($id_medida_variavel)){ | |
| 147 | - $tema = "ogcmetaestat".$id_medida_variavel; | |
| 148 | - $_GET["layers"] = $tema; | |
| 149 | - $_GET["LAYERS"] = $tema; | |
| 150 | -} | |
| 151 | -if(!isset($tema) && isset($temas)){ | |
| 152 | - $tema = $temas; | |
| 153 | -} | |
| 154 | -if(isset($typeName)){ | |
| 155 | - $typename = $typeName; | |
| 156 | -} | |
| 157 | -if(!isset($tema) && isset($typename)){ | |
| 158 | - $tema = $typename; | |
| 159 | -} | |
| 160 | 193 | // |
| 161 | 194 | //recupera um mapa salvo no banco de administracao |
| 162 | 195 | // |
| 163 | 196 | if(!empty($restauramapa)){ |
| 164 | - $xbase = restauraMapaAdmin($restauramapa,$dir_tmp); | |
| 165 | - $m = ms_newMapObj($xbase); | |
| 166 | - $w = $m->web; | |
| 167 | - $w->set("imagepath",dirname($w->imagepath)."/"); | |
| 168 | - $w->set("imageurl",dirname($w->imageurl)."/"); | |
| 169 | - //apaga algumas camadas | |
| 170 | - $l = $m->getlayerbyname("rosadosventos"); | |
| 171 | - if($l != ""){ | |
| 172 | - $l->set("status",MS_DELETE); | |
| 173 | - } | |
| 174 | - $l = $m->getlayerbyname("copyright"); | |
| 175 | - if($l != ""){ | |
| 176 | - $l->set("status",MS_DELETE); | |
| 177 | - } | |
| 178 | - $m->save($xbase); | |
| 179 | - //$fundo = $xbase; | |
| 180 | - $tema = $xbase; | |
| 181 | - $_GET["tema"] = $xbase; | |
| 182 | - $_GET["layers"] = ""; | |
| 183 | - $l = $m->getlayer(0); | |
| 184 | - $_GET["LAYERS"] = $l->name; | |
| 197 | + restauraMapaSalvo(); | |
| 185 | 198 | } |
| 186 | 199 | // |
| 187 | -//para operar como o Geoserver | |
| 200 | +//para operar como o Geoserver, abre o openlayers | |
| 188 | 201 | // |
| 189 | 202 | if(isset($format) && strtolower($format) == "application/openlayers"){ |
| 190 | - if(!isset($layers)){ | |
| 191 | - $layers = $tema; | |
| 192 | - } | |
| 193 | - $urln = diogc_imprimeAjudarname($_SERVER["PHP_SELF"])."/mashups/openlayers.php?temas=".$layers."&layers=".$layers."&mapext=".$bbox."&botoes=pan,zoombox,zoomtot,identifica"; | |
| 203 | + $urln = dirname($_SERVER["PHP_SELF"])."/mashups/openlayers.php?layers=".$layers."&mapext=".$bbox."&botoes=pan,zoombox,zoomtot,identifica"; | |
| 194 | 204 | //echo $urln;exit; |
| 195 | 205 | if(!headers_sent()){ |
| 196 | 206 | header("Location:".$urln); |
| 197 | 207 | } |
| 198 | 208 | else{ |
| 199 | 209 | echo "<meta http-equiv='refresh' content='0;url=$urln'>"; |
| 200 | - } | |
| 210 | + } | |
| 211 | + //exit.... | |
| 201 | 212 | } |
| 202 | 213 | // |
| 203 | -//cria o web service | |
| 214 | +//pega a versao do Mapserver | |
| 204 | 215 | // |
| 205 | 216 | error_reporting(0); |
| 206 | 217 | $versao = versao(); |
| 207 | 218 | $versao = $versao["principal"]; |
| 208 | -if($_GET["SRS"] == "EPSG:900913"){ | |
| 209 | - $_GET["SRS"] = "EPSG:3857"; | |
| 210 | -} | |
| 219 | + | |
| 211 | 220 | $req = ms_newowsrequestobj(); |
| 212 | 221 | $tipo = ""; |
| 213 | -$_GET = array_merge($_GET,$_POST); | |
| 222 | + | |
| 214 | 223 | if(isset($_GET["sld"]) || isset($_GET["filter"])){ |
| 215 | 224 | $cache = false; |
| 216 | 225 | } |
| 217 | -if(!isset($_GET["srs"]) && !isset($_GET["SRS"])){ | |
| 218 | - $_GET["srs"] = "EPSG:4326"; | |
| 219 | -} | |
| 226 | +// | |
| 227 | +//inclui todos os parametros na requisicao e aproveita para verificar getcapabilities | |
| 228 | +// | |
| 220 | 229 | foreach ($_GET as $k=>$v){ |
| 221 | 230 | $req->setParameter(strtoupper($k), $v); |
| 222 | 231 | if(strtolower($v) == "getcapabilities"){ |
| 223 | 232 | $tipo = "metadados"; |
| 224 | 233 | $cache = false; |
| 225 | 234 | } |
| 226 | - if(strtolower($k) == "layers" && empty($_GET["tema"])){ | |
| 227 | - $tema = $v; | |
| 228 | - } | |
| 229 | - if(strtolower($k) == "layer" && empty($_GET["tema"])){ | |
| 230 | - $tema = $v; | |
| 231 | - } | |
| 232 | 235 | } |
| 236 | +// | |
| 237 | +//cria uma lista de epsgs para o getcapabilities | |
| 238 | +// | |
| 233 | 239 | $req->setParameter("srsName",$req->getValueByName("SRS")); |
| 234 | 240 | $listaepsg = $req->getValueByName("SRS")." EPSG:4618 EPSG:4291 EPSG:4326 EPSG:22521 EPSG:22522 EPSG:22523 EPSG:22524 EPSG:22525 EPSG:29101 EPSG:29119 EPSG:29120 EPSG:29121 EPSG:29122 EPSG:29177 EPSG:29178 EPSG:29179 EPSG:29180 EPSG:29181 EPSG:29182 EPSG:29183 EPSG:29184 EPSG:29185"; |
| 235 | -//echo $listaepsg;exit; | |
| 236 | -if(count($_GET) == 0){ | |
| 237 | - $tipo="intervalo"; | |
| 238 | - $req->setParameter("REQUEST", "getCapabilities"); | |
| 239 | - $req->setParameter("SERVICE", "WMS"); | |
| 240 | - $cache = false; | |
| 241 | -} | |
| 242 | -if(isset($tema) && $tipo != "metadados"){ | |
| 243 | - $tipo = ""; | |
| 244 | -} | |
| 241 | + | |
| 245 | 242 | if(isset($version) && !isset($VERSION)){ |
| 246 | 243 | $VERSION = $version; |
| 247 | 244 | } |
| 248 | 245 | if(!isset($VERSION)){ |
| 249 | 246 | $req->setParameter("VeRsIoN","1.1.1"); |
| 250 | 247 | } |
| 251 | -if (!isset($intervalo)){ | |
| 252 | - $intervalo = "0,5000"; | |
| 253 | -} | |
| 254 | -else{ | |
| 255 | - $tipo = "intervalo"; | |
| 256 | -} | |
| 257 | -if(!isset($tema)){ | |
| 258 | - if(!isset($intervalo)){ | |
| 259 | - $intervalo = "0,5000"; | |
| 260 | - } | |
| 261 | - $tipo = "intervalo"; | |
| 262 | -} | |
| 263 | 248 | // |
| 264 | 249 | //nome do mapfile que ficara em cache |
| 265 | 250 | // |
| ... | ... | @@ -282,9 +267,7 @@ if(isset($_GET["DESLIGACACHE"]) && $_GET["DESLIGACACHE"] == "sim"){ |
| 282 | 267 | $agora = time(); |
| 283 | 268 | $cache = false; |
| 284 | 269 | } |
| 285 | -$nomeMapfileTmp = $dir_tmp."/ogc_".md5($tema.($req->getValueByName("SRS")))."_".$agora.".map"; | |
| 286 | -$nomeMapfileTmp = str_replace(",","",$nomeMapfileTmp); | |
| 287 | -$nomeMapfileTmp = str_replace(" ","",$nomeMapfileTmp); | |
| 270 | +$nomeMapfileTmp = $dir_tmp."/ogc_".md5(implode("",$_GET))."_".$agora.".map"; | |
| 288 | 271 | //essa variavel e usada para definir se a imagem final gerada devera ser cortada ou nao |
| 289 | 272 | $cortePixels = 0; |
| 290 | 273 | if(file_exists($nomeMapfileTmp) && $tipo == ""){ |
| ... | ... | @@ -299,7 +282,7 @@ else{ |
| 299 | 282 | } |
| 300 | 283 | $proto = "http" . ((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == "on") ? "s" : "") . "://"; |
| 301 | 284 | $server = isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : $_SERVER['SERVER_NAME']; |
| 302 | - $or = $proto.$server.$_SERVER['PHP_SELF']; | |
| 285 | + $or = $urli3geo."/ogc.php"; | |
| 303 | 286 | if((isset($tema)) && ($tema != "") && ($tipo=="metadados")){ |
| 304 | 287 | $or = $or."?tema=".$tema."&"; |
| 305 | 288 | } |
| ... | ... | @@ -313,8 +296,8 @@ else{ |
| 313 | 296 | $oMap->setmetadata("wms_attribution_logourl_format","image/png"); |
| 314 | 297 | $oMap->setmetadata("wms_attribution_logourl_height","56"); |
| 315 | 298 | $oMap->setmetadata("wms_attribution_logourl_width","85"); |
| 316 | - $oMap->setmetadata("wms_attribution_logourl_href",$proto.$server.dirname($_SERVER['PHP_SELF'])."/imagens/i3geo.png"); | |
| 317 | - $oMap->setmetadata("wms_attribution_onlineresource",$proto.$server.dirname($_SERVER['PHP_SELF'])); | |
| 299 | + $oMap->setmetadata("wms_attribution_logourl_href",$urli3geo."/imagens/i3geo.png"); | |
| 300 | + $oMap->setmetadata("wms_attribution_onlineresource",$urli3geo); | |
| 318 | 301 | $oMap->setmetadata("wms_attribution_title",$tituloInstituicao); |
| 319 | 302 | $oMap->setmetadata("ows_enable_request","*"); |
| 320 | 303 | //parametro mandatario |
| ... | ... | @@ -324,8 +307,8 @@ else{ |
| 324 | 307 | $e = $oMap->extent; |
| 325 | 308 | $extensaoMap = ($e->minx)." ".($e->miny)." ".($e->maxx)." ".($e->maxy); |
| 326 | 309 | //gera o mapa |
| 327 | - if ($tipo == "" || $tipo == "metadados"){ | |
| 328 | - $tema = explode(" ",$tema); | |
| 310 | + if ($tema != ""){ | |
| 311 | + $listatema = explode(" ",$tema); | |
| 329 | 312 | //para o caso do tema ser um arquivo mapfile existente em uma pasta qualquer |
| 330 | 313 | //$temai3geo = true indica que o layer será buscado na pasta i3geo/temas |
| 331 | 314 | $temai3geo = true; |
| ... | ... | @@ -335,7 +318,7 @@ else{ |
| 335 | 318 | $temai3geo = false; |
| 336 | 319 | $nmap->setmetadata("ows_enable_request","*"); |
| 337 | 320 | } |
| 338 | - foreach ($tema as $tx){ | |
| 321 | + foreach ($listatema as $tx){ | |
| 339 | 322 | $extensao = ".map"; |
| 340 | 323 | if($temai3geo == true && file_exists($locaplic."/temas/".$tx.".php")){ |
| 341 | 324 | $extensao = ".php"; |
| ... | ... | @@ -368,8 +351,7 @@ else{ |
| 368 | 351 | $nmap = ms_newMapobj($locaplic."/temas/".$tx.".map"); |
| 369 | 352 | $nmap->setmetadata("ows_enable_request","*"); |
| 370 | 353 | } |
| 371 | - if($temai3geo == false || empty($layers)) | |
| 372 | - { | |
| 354 | + if($temai3geo == false || empty($layers)){ | |
| 373 | 355 | $ts = $nmap->getalllayernames(); |
| 374 | 356 | $nmap->setmetadata("ows_enable_request","*"); |
| 375 | 357 | } |
| ... | ... | @@ -520,7 +502,8 @@ else{ |
| 520 | 502 | } |
| 521 | 503 | } |
| 522 | 504 | } |
| 523 | - else{ | |
| 505 | + else{ | |
| 506 | + $intervalo = "0,5000"; | |
| 524 | 507 | $conta = 0; |
| 525 | 508 | $int = explode(",",$intervalo); |
| 526 | 509 | $codigosTema = array(); |
| ... | ... | @@ -554,48 +537,41 @@ else{ |
| 554 | 537 | $nmap = ms_newMapobj($locaplic."/temas/".$codigoTema.".map"); |
| 555 | 538 | $nmap->setmetadata("ows_enable_request","*"); |
| 556 | 539 | $ts = $nmap->getalllayernames(); |
| 557 | - if (count($ts) == 1){ | |
| 558 | - foreach ($ts as $t){ | |
| 559 | - if ($oMap->getlayerbyname($t) == ""){ | |
| 560 | - $conta++; | |
| 561 | - if (($conta >= $int[0]) && ($conta <= $int[1])){ | |
| 562 | - $l = $nmap->getlayerbyname($t); | |
| 563 | - $extensao = $l->getmetadata("EXTENSAO"); | |
| 564 | - if($extensao == ""){ | |
| 565 | - $extensao = $extensaoMap; | |
| 566 | - } | |
| 567 | - $l->setmetadata("wms_extent",$extensao); | |
| 568 | - | |
| 569 | - $l->setmetadata("ows_title",pegaNome($l)); | |
| 570 | - $l->setmetadata("ows_srs",$listaepsg); | |
| 571 | - $l->set("status",MS_OFF); | |
| 572 | - $l->setmetadata("gml_include_items","all"); | |
| 573 | - $l->set("dump",MS_TRUE); | |
| 574 | - $l->setmetadata("WMS_INCLUDE_ITEMS","all"); | |
| 575 | - $l->setmetadata("WFS_INCLUDE_ITEMS","all"); | |
| 576 | - if($l->getmetadata("ows_metadataurl_href") == ""){ | |
| 577 | - $l->setmetadata("ows_metadataurl_href",$c["fonte"]); | |
| 578 | - $l->setmetadata("ows_metadataurl_type","TC211"); | |
| 579 | - $l->setmetadata("ows_metadataurl_format","text/html"); | |
| 580 | - } | |
| 581 | - if(file_exists($locaplic."/temas/miniaturas/".$t.".map.mini.png")){ | |
| 582 | - $mini = $proto.$server.dirname($_SERVER['PHP_SELF'])."/temas/miniaturas/".$t.".map.mini.png"; | |
| 583 | - $l->setmetadata("wms_attribution_logourl_format","image/png"); | |
| 584 | - $l->setmetadata("wms_attribution_logourl_height","50"); | |
| 585 | - $l->setmetadata("wms_attribution_logourl_width","50"); | |
| 586 | - $l->setmetadata("wms_attribution_logourl_href",$mini); | |
| 587 | - } | |
| 588 | - // | |
| 589 | - //numero de pixels que serao considerados para corte da imagem no caso de cache ativo e tema de pontos | |
| 590 | - // | |
| 591 | - if ($l->getmetadata("cortepixels") != ""){ | |
| 592 | - $cortePixels = $l->getmetadata("cortepixels"); | |
| 593 | - } | |
| 594 | - cloneInlineSymbol($l,$nmap,$oMap); | |
| 595 | - ms_newLayerObj($oMap, $l); | |
| 596 | - | |
| 597 | - } | |
| 540 | + foreach ($ts as $t){ | |
| 541 | + if ($oMap->getlayerbyname($t) == ""){ | |
| 542 | + $l = $nmap->getlayerbyname($t); | |
| 543 | + $extensao = $l->getmetadata("EXTENSAO"); | |
| 544 | + if($extensao == ""){ | |
| 545 | + $extensao = $extensaoMap; | |
| 598 | 546 | } |
| 547 | + $l->setmetadata("wms_extent",$extensao); | |
| 548 | + $l->setmetadata("ows_title",pegaNome($l)); | |
| 549 | + $l->setmetadata("ows_srs",$listaepsg); | |
| 550 | + $l->set("status",MS_OFF); | |
| 551 | + $l->setmetadata("gml_include_items","all"); | |
| 552 | + $l->set("dump",MS_TRUE); | |
| 553 | + $l->setmetadata("WMS_INCLUDE_ITEMS","all"); | |
| 554 | + $l->setmetadata("WFS_INCLUDE_ITEMS","all"); | |
| 555 | + if($l->getmetadata("ows_metadataurl_href") == ""){ | |
| 556 | + $l->setmetadata("ows_metadataurl_href",$c["fonte"]); | |
| 557 | + $l->setmetadata("ows_metadataurl_type","TC211"); | |
| 558 | + $l->setmetadata("ows_metadataurl_format","text/html"); | |
| 559 | + } | |
| 560 | + if(file_exists($locaplic."/temas/miniaturas/".$t.".map.mini.png")){ | |
| 561 | + $mini = $proto.$server.dirname($_SERVER['PHP_SELF'])."/temas/miniaturas/".$t.".map.mini.png"; | |
| 562 | + $l->setmetadata("wms_attribution_logourl_format","image/png"); | |
| 563 | + $l->setmetadata("wms_attribution_logourl_height","50"); | |
| 564 | + $l->setmetadata("wms_attribution_logourl_width","50"); | |
| 565 | + $l->setmetadata("wms_attribution_logourl_href",$mini); | |
| 566 | + } | |
| 567 | + // | |
| 568 | + //numero de pixels que serao considerados para corte da imagem no caso de cache ativo e tema de pontos | |
| 569 | + // | |
| 570 | + if ($l->getmetadata("cortepixels") != ""){ | |
| 571 | + $cortePixels = $l->getmetadata("cortepixels"); | |
| 572 | + } | |
| 573 | + cloneInlineSymbol($l,$nmap,$oMap); | |
| 574 | + ms_newLayerObj($oMap, $l); | |
| 599 | 575 | } |
| 600 | 576 | } |
| 601 | 577 | } |
| ... | ... | @@ -619,6 +595,11 @@ else{ |
| 619 | 595 | } |
| 620 | 596 | $oMap->setSymbolSet($locaplic."/symbols/".basename($oMap->symbolsetfilename)); |
| 621 | 597 | $oMap->setFontSet($locaplic."/symbols/".basename($oMap->fontsetfilename)); |
| 598 | + // | |
| 599 | + //caso seja download ou json ou csv | |
| 600 | + // | |
| 601 | + processaOutputformatMapfile(); | |
| 602 | + | |
| 622 | 603 | $oMap->save($nomeMapfileTmp); |
| 623 | 604 | $oMap = ms_newMapobj($nomeMapfileTmp); |
| 624 | 605 | } |
| ... | ... | @@ -820,12 +801,7 @@ if(strtolower($req->getValueByName("REQUEST")) == "getfeatureinfo"){ |
| 820 | 801 | $_GET["SRS"] = "EPSG:3857"; |
| 821 | 802 | } |
| 822 | 803 | } |
| 823 | -// | |
| 824 | -//altera o outputformat | |
| 825 | -// | |
| 826 | -if(isset($OUTPUTFORMAT)){ | |
| 827 | - processaOutputformatMapfile(); | |
| 828 | -} | |
| 804 | + | |
| 829 | 805 | ms_ioinstallstdouttobuffer(); |
| 830 | 806 | // |
| 831 | 807 | //verifica parametro outputformat e ajusta a requisicao |
| ... | ... | @@ -841,11 +817,10 @@ if(strtolower($req->getValueByName("REQUEST")) == "getfeatureinfo" && $_GET["inf |
| 841 | 817 | getfeatureinfoJson(); |
| 842 | 818 | exit; |
| 843 | 819 | } |
| 844 | - | |
| 845 | 820 | $oMap->owsdispatch($req); |
| 846 | 821 | |
| 847 | 822 | $contenttype = ms_iostripstdoutbuffercontenttype(); |
| 848 | - | |
| 823 | + | |
| 849 | 824 | if(strtolower($request) == "getcapabilities"){ |
| 850 | 825 | header('Content-Disposition: attachment; filename=getcapabilities.xml'); |
| 851 | 826 | } |
| ... | ... | @@ -853,12 +828,45 @@ if(strtolower($request) == "getcapabilities"){ |
| 853 | 828 | if(!isset($OUTPUTFORMAT)){ |
| 854 | 829 | header("Content-type: $contenttype"); |
| 855 | 830 | } |
| 856 | -if(strtolower($OUTPUTFORMAT) == "geojson"){ | |
| 857 | - ms_iostripstdoutbuffercontentheaders(); | |
| 858 | - header("Content-type: application/json; subtype=geojson"); | |
| 831 | + | |
| 832 | +//precisa limpar o cabecalho | |
| 833 | +if(strtolower($OUTPUTFORMAT) == "geojson" || strtolower($OUTPUTFORMAT) == "json"){ | |
| 834 | + ms_iostripstdoutbuffercontentheaders(); | |
| 835 | + //grava em disco | |
| 836 | + $arq = $dir_tmp."/".$tema.".json"; | |
| 837 | + $contents = ms_iogetstdoutbufferstring(); | |
| 838 | + file_put_contents($arq,$contents); | |
| 839 | + //envia para download | |
| 840 | + header("Content-type: application/json; subtype=geojson"); | |
| 841 | + ms_iogetStdoutBufferBytes(); | |
| 842 | + ms_ioresethandlers(); | |
| 843 | + exit; | |
| 859 | 844 | } |
| 845 | +if(strtolower($OUTPUTFORMAT) == "shape-zip"){ | |
| 846 | + //grava em disco | |
| 847 | + $arq = $dir_tmp."/".$tema."_shapefile.zip"; | |
| 848 | + $contents = ms_iogetstdoutbufferstring(); | |
| 849 | + file_put_contents($arq,$contents); | |
| 850 | + //envia para download | |
| 851 | + header('Content-Disposition: attachment; filename='.$tema.'_shapefile.zip'); | |
| 852 | + ms_iogetStdoutBufferBytes(); | |
| 853 | + ms_ioresethandlers(); | |
| 854 | + exit; | |
| 855 | +} | |
| 856 | +if(strtolower($OUTPUTFORMAT) == "csv"){ | |
| 857 | + //grava em disco | |
| 858 | + $arq = $dir_tmp."/".$tema.".csv"; | |
| 859 | + $contents = ms_iogetstdoutbufferstring(); | |
| 860 | + file_put_contents($arq,$contents); | |
| 861 | + //envia para download | |
| 862 | + header('Content-Disposition: attachment; filename='.$tema.'.csv'); | |
| 863 | + header("Content-type: text/csv"); | |
| 864 | + ms_iogetStdoutBufferBytes(); | |
| 865 | + ms_ioresethandlers(); | |
| 866 | + exit; | |
| 867 | +} | |
| 868 | +$buffer = ms_iogetStdoutBufferBytes(); | |
| 860 | 869 | |
| 861 | -$buffer = ms_iogetStdoutBufferBytes(); | |
| 862 | 870 | ms_ioresethandlers(); |
| 863 | 871 | // |
| 864 | 872 | //funções |
| ... | ... | @@ -877,16 +885,17 @@ function ogc_pegaListaDeMenus(){ |
| 877 | 885 | } |
| 878 | 886 | function ogc_imprimeAjuda(){ |
| 879 | 887 | echo "<pre><b>Construtor de web services do I3Geo.</b><br><br>"; |
| 880 | - echo "Esse utilitário usa os arquivos mapfiles existentes em <br>"; | |
| 881 | - echo "i3geo/temas para gerar web services no padrão OGC.<br>"; | |
| 888 | + echo "Esse programa usa os arquivos mapfiles existentes em <br>"; | |
| 889 | + echo "i3geo/temas para gerar web services OGC.<br>"; | |
| 882 | 890 | echo "Para escolher um tema, utilize:<br>"; |
| 883 | 891 | echo "ogc.php?lista=temas - para listar os temas disponíveis<br>"; |
| 884 | - echo "Para usar esse web service, além dos parâmetros normais, vc deverá incluir o parâmetro &tema=,<br>"; | |
| 885 | - echo "ou seja,http://[host]/i3geo/ogc.php?tema=[código do tema]<br>"; | |
| 886 | - echo "no lugar do c&ocaute;digo pode ser especificado também um arquivo mapfile qualquer. Nesse caso, deve ser digitado o caminho completo no servidor<br><br>"; | |
| 887 | - echo "Utilize o sistema de administração do i3Geo para configurar quais os temas da pasta i3geo/temas podem ser utilizados."; | |
| 888 | - echo "Utilize o parametro &intervalo=0,20 para definir o número de temas desejado na função getcapabilities."; | |
| 889 | - echo "Utilize o parametro restauramapa para indicar o ID de um mapa salvo no banco de dados de administração para utilizá-lo como um WMS"; | |
| 892 | + echo "Para usar esse web service voce pode usar o parametro &tema=,<br>"; | |
| 893 | + echo "ou seja,http://[host]/i3geo/ogc.php?tema=[codigo do tema]<br>"; | |
| 894 | + echo "no lugar do codigo pode ser especificado um arquivo mapfile qualquer. "; | |
| 895 | + echo "Nesse caso, deve ser digitado o caminho completo no servidor<br><br>"; | |
| 896 | + echo "Utilize o sistema de administracao do i3Geo para configurar quais os temas da pasta i3geo/temas podem ser utilizados.<br><br>"; | |
| 897 | + echo "Utilize o parametro restauramapa para indicar o ID de um mapa salvo no banco <br>"; | |
| 898 | + echo "de dados de administracao para utiliza-lo como um WMS"; | |
| 890 | 899 | } |
| 891 | 900 | function ogc_imprimeListaDeTemas(){ |
| 892 | 901 | global $urli3geo,$perfil,$locaplic; |
| ... | ... | @@ -976,7 +985,7 @@ function carregaCacheImagem($cachedir,$map,$tms){ |
| 976 | 985 | header('Last-Modified: '.gmdate('D, d M Y H:i:s', filemtime($nome)).' GMT', true, 200); |
| 977 | 986 | $etag = md5_file($nome); |
| 978 | 987 | header('Etag: '.$etag); |
| 979 | - fpassthru(fopen($nome, 'rb')); | |
| 988 | + readfile($nome); | |
| 980 | 989 | exit; |
| 981 | 990 | } |
| 982 | 991 | } |
| ... | ... | @@ -1012,7 +1021,7 @@ function salvaCacheImagem($cachedir,$map,$tms){ |
| 1012 | 1021 | header('Cache-Control: max-age=3600, must-revalidate'); |
| 1013 | 1022 | header('Expires: ' . gmdate('D, d M Y H:i:s', time()+24*60*60) . ' GMT'); |
| 1014 | 1023 | header('Last-Modified: '.gmdate('D, d M Y H:i:s', filemtime($nome)).' GMT', true, 200); |
| 1015 | - fpassthru(fopen($nome, 'rb')); | |
| 1024 | + readfile($nome); | |
| 1016 | 1025 | exit; |
| 1017 | 1026 | } |
| 1018 | 1027 | function texto2iso($texto){ |
| ... | ... | @@ -1063,7 +1072,7 @@ function renderNocacheTms(){ |
| 1063 | 1072 | header('Cache-Control: max-age=3600, must-revalidate'); |
| 1064 | 1073 | header('Expires: ' . gmdate('D, d M Y H:i:s', time()+24*60*60) . ' GMT'); |
| 1065 | 1074 | header('Last-Modified: '.gmdate('D, d M Y H:i:s', filemtime($nomer)).' GMT', true, 200); |
| 1066 | - fpassthru(fopen($nomer, 'rb')); | |
| 1075 | + readfile($nomer); | |
| 1067 | 1076 | } |
| 1068 | 1077 | if($i3georendermode == 2){ |
| 1069 | 1078 | ob_clean(); |
| ... | ... | @@ -1119,41 +1128,83 @@ function getfeatureinfoJson(){ |
| 1119 | 1128 | echo $json; |
| 1120 | 1129 | } |
| 1121 | 1130 | function processaOutputformatMapfile(){ |
| 1122 | - global $OUTPUTFORMAT, $oMap; | |
| 1131 | + global $OUTPUTFORMAT, $oMap, $tema; | |
| 1123 | 1132 | if(strtolower($OUTPUTFORMAT) == "shape-zip"){ |
| 1124 | 1133 | $l = $oMap->getlayer(0); |
| 1125 | 1134 | $n = $l->name; |
| 1126 | 1135 | $oMap->selectOutputFormat("shape-zip"); |
| 1127 | - $oMap->outputformat->setOption("STORAGE", "memory"); | |
| 1136 | + $oMap->outputformat->setOption("STORAGE", "filesystem"); | |
| 1128 | 1137 | $oMap->outputformat->setOption("FORM", "zip"); |
| 1129 | - $oMap->outputformat->setOption("FILENAME", $n.".zip"); | |
| 1138 | + $oMap->outputformat->setOption("FILENAME", $tema."_shapefile.zip"); | |
| 1130 | 1139 | $l->setmetadata("wfs_getfeature_formatlist","shape-zip"); |
| 1131 | - $oMap->save($nomeMapfileTmp); | |
| 1132 | - if(strtolower($request) != "getcapabilities"){ | |
| 1133 | - header('Content-Disposition: attachment; filename='.$n.'.zip'); | |
| 1134 | - } | |
| 1135 | 1140 | } |
| 1136 | 1141 | if(strtolower($OUTPUTFORMAT) == "csv"){ |
| 1137 | 1142 | $l = $oMap->getlayer(0); |
| 1138 | 1143 | $n = $l->name."-csv"; |
| 1139 | 1144 | $oMap->selectOutputFormat("csv"); |
| 1140 | - $oMap->outputformat->setOption("STORAGE", "memory"); | |
| 1141 | - $oMap->outputformat->setOption("FILENAME", $n.".zip"); | |
| 1142 | - $oMap->outputformat->setOption("FORM", "zip"); | |
| 1145 | + $oMap->outputformat->setOption("STORAGE", "filesystem"); | |
| 1146 | + $oMap->outputformat->setOption("FILENAME", $tema.".csv"); | |
| 1147 | + $oMap->outputformat->setOption("FORM", "simple"); | |
| 1143 | 1148 | $l->setmetadata("wfs_getfeature_formatlist","csv"); |
| 1144 | - $oMap->save($nomeMapfileTmp); | |
| 1145 | - if(strtolower($request) != "getcapabilities"){ | |
| 1146 | - header('Content-Disposition: attachment; filename='.$n.'.zip'); | |
| 1147 | - } | |
| 1148 | 1149 | } |
| 1149 | - if(strtolower($OUTPUTFORMAT) == "geojson"){ | |
| 1150 | + if(strtolower($OUTPUTFORMAT) == "geojson" || strtolower($OUTPUTFORMAT) == "json"){ | |
| 1150 | 1151 | $l = $oMap->getlayer(0); |
| 1151 | 1152 | $oMap->selectOutputFormat("geojson"); |
| 1152 | 1153 | $l->setmetadata("wfs_getfeature_formatlist","geojson"); |
| 1153 | - $oMap->save($nomeMapfileTmp); | |
| 1154 | - header("Content-type: application/json; subtype=geojson"); | |
| 1155 | 1154 | } |
| 1156 | 1155 | } |
| 1156 | +function carregaCacheArquivo(){ | |
| 1157 | + global $dir_tmp, $tema, $OUTPUTFORMAT; | |
| 1158 | + if(strtolower($OUTPUTFORMAT) == "shape-zip"){ | |
| 1159 | + $arq = $dir_tmp."/".$tema."_shapefile.zip"; | |
| 1160 | + if(file_exists($arq)){ | |
| 1161 | + header('Content-Disposition: attachment; filename='.$tema.'_shapefile.zip'); | |
| 1162 | + readfile($arq); | |
| 1163 | + exit; | |
| 1164 | + } | |
| 1165 | + } | |
| 1166 | + if(strtolower($OUTPUTFORMAT) == "csv"){ | |
| 1167 | + $arq = $dir_tmp."/".$tema.".csv"; | |
| 1168 | + if(file_exists($arq)){ | |
| 1169 | + header('Content-Disposition: attachment; filename='.$tema.'.csv'); | |
| 1170 | + header("Content-type: text/csv"); | |
| 1171 | + readfile($arq); | |
| 1172 | + exit; | |
| 1173 | + } | |
| 1174 | + } | |
| 1175 | + if(strtolower($OUTPUTFORMAT) == "geojson" || strtolower($OUTPUTFORMAT) == "json"){ | |
| 1176 | + $arq = $dir_tmp."/".$tema.".json"; | |
| 1177 | + if(file_exists($arq)){ | |
| 1178 | + header("Content-type: application/json; subtype=geojson"); | |
| 1179 | + readfile($arq); | |
| 1180 | + exit; | |
| 1181 | + } | |
| 1182 | + } | |
| 1183 | +} | |
| 1184 | +function restauraMapaSalvo(){ | |
| 1185 | + global $restauramapa, $dir_tmp, $tema; | |
| 1186 | + $xbase = restauraMapaAdmin($restauramapa,$dir_tmp); | |
| 1187 | + $m = ms_newMapObj($xbase); | |
| 1188 | + $w = $m->web; | |
| 1189 | + $w->set("imagepath",dirname($w->imagepath)."/"); | |
| 1190 | + $w->set("imageurl",dirname($w->imageurl)."/"); | |
| 1191 | + //apaga algumas camadas | |
| 1192 | + $l = $m->getlayerbyname("rosadosventos"); | |
| 1193 | + if($l != ""){ | |
| 1194 | + $l->set("status",MS_DELETE); | |
| 1195 | + } | |
| 1196 | + $l = $m->getlayerbyname("copyright"); | |
| 1197 | + if($l != ""){ | |
| 1198 | + $l->set("status",MS_DELETE); | |
| 1199 | + } | |
| 1200 | + $m->save($xbase); | |
| 1201 | + //$fundo = $xbase; | |
| 1202 | + $tema = $xbase; | |
| 1203 | + $_GET["tema"] = $xbase; | |
| 1204 | + $_GET["layers"] = ""; | |
| 1205 | + $l = $m->getlayer(0); | |
| 1206 | + $_GET["LAYERS"] = $l->name; | |
| 1207 | +} | |
| 1157 | 1208 | function converteenc($texto){ |
| 1158 | 1209 | if (!mb_detect_encoding($texto,"UTF-8",true)){ |
| 1159 | 1210 | $texto = mb_convert_encoding($texto,"UTF-8","ISO-8859-1"); | ... | ... |
temas/_lbairros.map
| ... | ... | @@ -7,7 +7,7 @@ MAP |
| 7 | 7 | DATA "the_geom from (select gid, st_setsrid(the_geom,4326) as the_geom,co_bairro,no_bairro,no_distr,no_municip from i3geo_metaestat.bairros /*FW*//*FW*/) as foo using unique co_bairro using srid=4326" |
| 8 | 8 | METADATA |
| 9 | 9 | "TIP" "no_bairro" |
| 10 | - "cache" "" | |
| 10 | + "cache" "SIM" | |
| 11 | 11 | "CLASSE" "SIM" |
| 12 | 12 | "ITENSDESC" "id,Código bairro,Nome,Distrito,Município" |
| 13 | 13 | "EDITAVEL" "SIM" | ... | ... |
temas/_lbiomashp.map
| 1 | -MAP | |
| 2 | - FONTSET "../symbols/fontes.txt" | |
| 3 | - SYMBOLSET "../symbols/simbolosv6.sym" | |
| 4 | - LAYER | |
| 5 | - CONNECTION "" | |
| 6 | - DATA "/var/www/i3geo/aplicmap/dados/biomas.shp" | |
| 7 | - METADATA | |
| 8 | - "METAESTAT_ID_MEDIDA_VARIAVEL" "" | |
| 9 | - "TIP" "CD_LEGENDA" | |
| 10 | - "CLASSE" "SIM" | |
| 11 | - "permitekmz" "SIM" | |
| 12 | - "ITENSDESC" "Bioma Teste de acentuação" | |
| 13 | - "ESCALA" "1000000" | |
| 14 | - "TILES" "SIM" | |
| 15 | - "METAESTAT_CODIGO_TIPO_REGIAO" "" | |
| 16 | - "permitedownload" "SIM" | |
| 17 | - "metaestat" "" | |
| 18 | - "download" "SIM" | |
| 19 | - "itembuscarapida" "CD_LEGENDA" | |
| 20 | - "ITENS" "CD_LEGENDA" | |
| 21 | - "arquivodownload" "" | |
| 22 | - "arquivokmz" "" | |
| 23 | - "transitioneffect" "SIM" | |
| 24 | - "permiteogc" "SIM" | |
| 25 | - "permitekml" "SIM" | |
| 26 | - "TEMA" "Biomas shapefile (acentuação)" | |
| 27 | - END # METADATA | |
| 28 | - NAME "_lbiomashp" | |
| 29 | - PROCESSING "ITEMS=CD_LEGENDA" | |
| 30 | - PROCESSING "LABEL_NO_CLIP=True" | |
| 31 | - PROCESSING "POLYLINE_NO_CLIP=True" | |
| 32 | - STATUS OFF | |
| 33 | - TEMPLATE "none.htm" | |
| 34 | - TILEITEM "location" | |
| 35 | - OPACITY 40 | |
| 36 | - TYPE POLYGON | |
| 37 | - UNITS METERS | |
| 38 | - CLASS | |
| 39 | - NAME "CAATINGA" | |
| 40 | - EXPRESSION ('[CD_LEGENDA]'eq'CAATINGA') | |
| 41 | - STYLE | |
| 42 | - COLOR 183 247 169 | |
| 43 | - OUTLINECOLOR 255 255 255 | |
| 44 | - END # STYLE | |
| 45 | - TITLE "" | |
| 46 | - END # CLASS | |
| 47 | - CLASS | |
| 48 | - NAME "PAMPA area > 5" | |
| 49 | - EXPRESSION ('[CD_LEGENDA]'eq'PAMPA area > 5') | |
| 50 | - STYLE | |
| 51 | - COLOR 239 22 152 | |
| 52 | - OUTLINECOLOR 255 255 255 | |
| 53 | - END # STYLE | |
| 54 | - TITLE "" | |
| 55 | - END # CLASS | |
| 56 | - CLASS | |
| 57 | - NAME "CERRADO" | |
| 58 | - EXPRESSION ('[CD_LEGENDA]'eq'CERRADO') | |
| 59 | - STYLE | |
| 60 | - COLOR 57 32 234 | |
| 61 | - OUTLINECOLOR 255 255 255 | |
| 62 | - END # STYLE | |
| 63 | - TITLE "" | |
| 64 | - END # CLASS | |
| 65 | - CLASS | |
| 66 | - NAME "PANTANAL" | |
| 67 | - EXPRESSION ('[CD_LEGENDA]'eq'PANTANAL') | |
| 68 | - STYLE | |
| 69 | - COLOR 214 107 232 | |
| 70 | - OUTLINECOLOR 255 255 255 | |
| 71 | - END # STYLE | |
| 72 | - TITLE "" | |
| 73 | - END # CLASS | |
| 74 | - CLASS | |
| 75 | - NAME "AMAZÔNIA" | |
| 76 | - EXPRESSION ('[CD_LEGENDA]'eq'AMAZÔNIA') | |
| 77 | - STYLE | |
| 78 | - COLOR 102 177 195 | |
| 79 | - OUTLINECOLOR 255 255 255 | |
| 80 | - END # STYLE | |
| 81 | - TITLE "" | |
| 82 | - END # CLASS | |
| 83 | - CLASS | |
| 84 | - NAME "MATA ATLÂNTICA" | |
| 85 | - EXPRESSION ('[CD_LEGENDA]'eq'MATA ATLÂNTICA') | |
| 86 | - STYLE | |
| 87 | - COLOR 44 215 49 | |
| 88 | - OUTLINECOLOR 255 255 255 | |
| 89 | - END # STYLE | |
| 90 | - TITLE "" | |
| 91 | - END # CLASS | |
| 92 | - END # LAYER | |
| 93 | - | |
| 94 | -END # MAP | |
| 95 | - | |
| 1 | +MAP | |
| 2 | + FONTSET "../symbols/fontes.txt" | |
| 3 | + SYMBOLSET "../symbols/simbolosv6.sym" | |
| 4 | + LAYER | |
| 5 | + CONNECTION "" | |
| 6 | + DATA "/var/www/i3geo/aplicmap/dados/biomas.shp" | |
| 7 | + METADATA | |
| 8 | + "TIP" "CD_LEGENDA" | |
| 9 | + "CACHE" "SIM" | |
| 10 | + "CLASSE" "SIM" | |
| 11 | + "permitekmz" "SIM" | |
| 12 | + "ITENSDESC" "Bioma Teste de acentuação" | |
| 13 | + "ESCALA" "1000000" | |
| 14 | + "TILES" "SIM" | |
| 15 | + "permitedownload" "SIM" | |
| 16 | + "download" "SIM" | |
| 17 | + "itembuscarapida" "CD_LEGENDA" | |
| 18 | + "ITENS" "CD_LEGENDA" | |
| 19 | + "transitioneffect" "SIM" | |
| 20 | + "permiteogc" "SIM" | |
| 21 | + "permitekml" "SIM" | |
| 22 | + "TEMA" "Biomas shapefile (acentuação)" | |
| 23 | + END # METADATA | |
| 24 | + NAME "_lbiomashp" | |
| 25 | + PROCESSING "ITEMS=CD_LEGENDA" | |
| 26 | + PROCESSING "LABEL_NO_CLIP=True" | |
| 27 | + PROCESSING "POLYLINE_NO_CLIP=True" | |
| 28 | + STATUS OFF | |
| 29 | + TEMPLATE "none.htm" | |
| 30 | + TILEITEM "location" | |
| 31 | + OPACITY 40 | |
| 32 | + TYPE POLYGON | |
| 33 | + UNITS METERS | |
| 34 | + CLASS | |
| 35 | + NAME "CAATINGA" | |
| 36 | + EXPRESSION ('[CD_LEGENDA]'eq'CAATINGA') | |
| 37 | + STYLE | |
| 38 | + COLOR 183 247 169 | |
| 39 | + OUTLINECOLOR 255 255 255 | |
| 40 | + END # STYLE | |
| 41 | + TITLE "" | |
| 42 | + END # CLASS | |
| 43 | + CLASS | |
| 44 | + NAME "PAMPA area > 5" | |
| 45 | + EXPRESSION ('[CD_LEGENDA]'eq'PAMPA area > 5') | |
| 46 | + STYLE | |
| 47 | + COLOR 239 22 152 | |
| 48 | + OUTLINECOLOR 255 255 255 | |
| 49 | + END # STYLE | |
| 50 | + TITLE "" | |
| 51 | + END # CLASS | |
| 52 | + CLASS | |
| 53 | + NAME "CERRADO" | |
| 54 | + EXPRESSION ('[CD_LEGENDA]'eq'CERRADO') | |
| 55 | + STYLE | |
| 56 | + COLOR 57 32 234 | |
| 57 | + OUTLINECOLOR 255 255 255 | |
| 58 | + END # STYLE | |
| 59 | + TITLE "" | |
| 60 | + END # CLASS | |
| 61 | + CLASS | |
| 62 | + NAME "PANTANAL" | |
| 63 | + EXPRESSION ('[CD_LEGENDA]'eq'PANTANAL') | |
| 64 | + STYLE | |
| 65 | + COLOR 214 107 232 | |
| 66 | + OUTLINECOLOR 255 255 255 | |
| 67 | + END # STYLE | |
| 68 | + TITLE "" | |
| 69 | + END # CLASS | |
| 70 | + CLASS | |
| 71 | + NAME "AMAZÔNIA" | |
| 72 | + EXPRESSION ('[CD_LEGENDA]'eq'AMAZÔNIA') | |
| 73 | + STYLE | |
| 74 | + COLOR 102 177 195 | |
| 75 | + OUTLINECOLOR 255 255 255 | |
| 76 | + END # STYLE | |
| 77 | + TITLE "" | |
| 78 | + END # CLASS | |
| 79 | + CLASS | |
| 80 | + NAME "MATA ATLÂNTICA" | |
| 81 | + EXPRESSION ('[CD_LEGENDA]'eq'MATA ATLÂNTICA') | |
| 82 | + STYLE | |
| 83 | + COLOR 44 215 49 | |
| 84 | + OUTLINECOLOR 255 255 255 | |
| 85 | + END # STYLE | |
| 86 | + TITLE "" | |
| 87 | + END # CLASS | |
| 88 | + END # LAYER | |
| 89 | +END # MAP | ... | ... |
| ... | ... | @@ -0,0 +1,29 @@ |
| 1 | +MAP | |
| 2 | + FONTSET "../symbols/fontes.txt" | |
| 3 | + SYMBOLSET "../symbols/simbolosv6.sym" | |
| 4 | + LAYER | |
| 5 | + DATA "/var/www/i3geo/aplicmap/dados/mundo" | |
| 6 | + METADATA | |
| 7 | + "CLASSE" "SIM" #o simbolo sera mostrado na legenda | |
| 8 | + "ITENS" "FIPS_CNTRY,GMI_CNTRY,LONG_NAME,CNTRY_NAME" #itens que serao mostrados na opcao de identificacao | |
| 9 | + "ITENSDESC" "FIPS,GMI,Nome,Wikipedia" #descricao dos nomes dos itens | |
| 10 | + "ITENSLINK" ",,,http://pt.wikipedia.org/wiki/[CNTRY_NAME]" | |
| 11 | + "TEMA" "Países do mundo" #nome que sera mostrado na legenda | |
| 12 | + "TITULO" "Países do mundo" #nome alternativo que e mostrado nos combos para escolha do tema | |
| 13 | + "TIP" "FIPS_CNTRY,GMI_CNTRY,CNTRY_NAME" | |
| 14 | + "itembuscarapida" "LONG_NAME" | |
| 15 | + "TME" '{"titulo":"População","colnome":"CNTRY_NAME","colsdata":["POP_CNTRY"],"hmax":"5000","wmax":"5000"}' | |
| 16 | + END | |
| 17 | + NAME "_lteste3d" | |
| 18 | + STATUS DEFAULT | |
| 19 | + TEMPLATE "none.htm" | |
| 20 | + TYPE POLYGON | |
| 21 | + CLASS | |
| 22 | + NAME "" #vazio indica que nao sera incluido o nome ao lado do simbolo | |
| 23 | + STYLE | |
| 24 | + COLOR 230 230 230 | |
| 25 | + OUTLINECOLOR 255 255 255 | |
| 26 | + END | |
| 27 | + END | |
| 28 | + END | |
| 29 | +END | |
| 0 | 30 | \ No newline at end of file | ... | ... |