Commit 2c8f444c88dbf048ffd0385a9fe4a040751e257e
1 parent
b21cad7c
Exists in
master
remocão de arquivos desnecessarios
Showing
2 changed files
with
122 additions
and
145 deletions
Show diff stats
ferramentas/parametrossql/ogc.php
1 | <?php | 1 | <?php |
2 | +exit; | ||
2 | /** | 3 | /** |
3 | Esse programa e uma adaptacao do codigo i3geo/ogc.php | 4 | Esse programa e uma adaptacao do codigo i3geo/ogc.php |
4 | E utilizado no mashup (i3geo/mashup) nas camadas que sao configuradas cm o plugin parametrossql | 5 | E utilizado no mashup (i3geo/mashup) nas camadas que sao configuradas cm o plugin parametrossql |
ogc.php
@@ -78,8 +78,36 @@ ogc.php?tema=/var/www/i3geo/aplicmap/geral1debianv6.map&layers=mundo | @@ -78,8 +78,36 @@ ogc.php?tema=/var/www/i3geo/aplicmap/geral1debianv6.map&layers=mundo | ||
78 | 78 | ||
79 | */ | 79 | */ |
80 | set_time_limit(0); | 80 | set_time_limit(0); |
81 | -ini_set('memory_limit', '512M'); | 81 | +ini_set('memory_limit', '512M'); |
82 | +include_once (dirname(__FILE__)."/classesphp/sani_request.php"); | ||
83 | +if(isset($_GET["BBOX"])){ | ||
84 | + $_GET["BBOX"] = str_replace(" ",",",$_GET["BBOX"]); | ||
85 | +} | ||
86 | +if(isset($_GET["TileMatrix"])){ | ||
87 | + $_GET["WIDTH"] = 256; | ||
88 | + $_GET["HEIGHT"] = 256; | ||
89 | + //calcula resolucoes | ||
90 | + $res = array(); | ||
91 | + $temp = 0.703125; | ||
92 | + for($i = 0; $i < 40; $i++){ | ||
93 | + $res[] = $temp; | ||
94 | + $temp = $temp / 2; | ||
95 | + } | ||
96 | + //$_GET["tms"] = null; | ||
97 | + $_GET["tms"] = "/wmts/".$_GET["layer"]."/".$_GET["TileMatrix"]."/".$_GET["TileCol"]."/".$_GET["TileRow"].".png"; | ||
98 | + if($_GET["TileMatrix"]."/".$_GET["TileCol"]."/".$_GET["TileRow"] == "0/0/0" || $_GET["TileCol"] == -1 || $_GET["TileRow"]== -1){ | ||
99 | + return; | ||
100 | + } | ||
101 | + $_GET["BBOX"] = $lon1.",".$lat1.",".$lon2.",".$lat2; | ||
102 | + $_GET["SERVICE"] = "WMS"; | ||
103 | + $_GET["REQUEST"] = "getMap"; | ||
104 | +} | ||
82 | $_GET = array_merge($_GET,$_POST); | 105 | $_GET = array_merge($_GET,$_POST); |
106 | + | ||
107 | + | ||
108 | +if($_GET["id_medida_variavel"] != ""){ | ||
109 | + $_GET["id_medida_variavel"] = filter_var ( $_GET["id_medida_variavel"], FILTER_SANITIZE_NUMBER_INT); | ||
110 | +} | ||
83 | // | 111 | // |
84 | //caso nenhum parametros tenha sido enviado | 112 | //caso nenhum parametros tenha sido enviado |
85 | // | 113 | // |
@@ -101,18 +129,20 @@ if(isset($_GET["outputformat"]) && $_GET["outputformat"] != ""){ | @@ -101,18 +129,20 @@ if(isset($_GET["outputformat"]) && $_GET["outputformat"] != ""){ | ||
101 | $cache = true; | 129 | $cache = true; |
102 | //require_once(dirname(__FILE__)."/classesphp/carrega_ext.php"); | 130 | //require_once(dirname(__FILE__)."/classesphp/carrega_ext.php"); |
103 | include(dirname(__FILE__)."/ms_configura.php"); | 131 | include(dirname(__FILE__)."/ms_configura.php"); |
104 | -include(dirname(__FILE__)."/classesphp/pega_variaveis.php"); | ||
105 | include(dirname(__FILE__)."/classesphp/funcoes_gerais.php"); | 132 | include(dirname(__FILE__)."/classesphp/funcoes_gerais.php"); |
106 | // | 133 | // |
107 | //ajusta o default | 134 | //ajusta o default |
108 | // | 135 | // |
109 | -if(!isset($ows_geomtype) || $ows_geomtype == ""){ | 136 | +if(!isset($_GET["ows_geomtype"]) || $_GET["ows_geomtype"] == ""){ |
110 | $ows_geomtype = "none"; | 137 | $ows_geomtype = "none"; |
111 | } | 138 | } |
139 | +else{ | ||
140 | + $ows_geomtype = $_GET["ows_geomtype"]; | ||
141 | +} | ||
112 | // | 142 | // |
113 | //imprime na tela a ajuda | 143 | //imprime na tela a ajuda |
114 | // | 144 | // |
115 | -if(isset($ajuda)){ | 145 | +if(isset($_GET["ajuda"])){ |
116 | ogc_imprimeAjuda(); | 146 | ogc_imprimeAjuda(); |
117 | exit; | 147 | exit; |
118 | } | 148 | } |
@@ -125,44 +155,34 @@ $protocolo1 = strtolower($protocolo) . '://'.$_SERVER['SERVER_NAME']; | @@ -125,44 +155,34 @@ $protocolo1 = strtolower($protocolo) . '://'.$_SERVER['SERVER_NAME']; | ||
125 | $protocolo = strtolower($protocolo) . '://'.$_SERVER['SERVER_NAME'] .":". $_SERVER['SERVER_PORT']; | 155 | $protocolo = strtolower($protocolo) . '://'.$_SERVER['SERVER_NAME'] .":". $_SERVER['SERVER_PORT']; |
126 | $urli3geo = str_replace("/ogc.php","",$protocolo.$_SERVER["PHP_SELF"]); | 156 | $urli3geo = str_replace("/ogc.php","",$protocolo.$_SERVER["PHP_SELF"]); |
127 | // | 157 | // |
128 | -//imprime na tela a lista de temas disponiveis | ||
129 | -// | ||
130 | -if(isset($lista) && $lista != ""){ | ||
131 | - include_once(dirname(__FILE__)."/classesphp/classe_menutemas.php"); | ||
132 | - if($lista == "temas"){ | ||
133 | - ogc_imprimeListaDeTemas(); | ||
134 | - } | ||
135 | - if($lista == "temaswfs"){ | ||
136 | - ogc_imprimeListaDeTemasWfs(); | ||
137 | - } | ||
138 | - exit; | ||
139 | -} | ||
140 | -// | ||
141 | //define um nome para o mapfile caso a origem seja o sistema de metadados estatisticos | 158 | //define um nome para o mapfile caso a origem seja o sistema de metadados estatisticos |
142 | // | 159 | // |
143 | -if(isset($id_medida_variavel) && $id_medida_variavel != ""){ | ||
144 | - $tema = "ogcmetaestat".$id_medida_variavel; | 160 | +if(isset($_GET["id_medida_variavel"]) && $_GET["id_medida_variavel"] != ""){ |
161 | + $tema = "ogcmetaestat".$_GET["id_medida_variavel"]; | ||
145 | } | 162 | } |
146 | // | 163 | // |
147 | //compatibiliza variaveis | 164 | //compatibiliza variaveis |
148 | // | 165 | // |
149 | -if(!isset($tema) && isset($layers)){ | ||
150 | - $tema = $layers; | 166 | +if(!isset($tema) && isset($_GET["layers"])){ |
167 | + $tema = $_GET["layers"]; | ||
151 | } | 168 | } |
152 | -if(!isset($tema) && isset($LAYERS)){ | ||
153 | - $tema = $LAYERS; | 169 | +if(!isset($tema) && isset($_GET["LAYERS"])){ |
170 | + $tema = $_GET["LAYERS"]; | ||
154 | } | 171 | } |
155 | -if(!isset($tema) && isset($LAYER)){ | ||
156 | - $tema = $LAYER; | 172 | +if(!isset($tema) && isset($_GET["LAYER"])){ |
173 | + $tema = $_GET["LAYER"]; | ||
157 | } | 174 | } |
158 | -if(!isset($tema) && isset($temas)){ | ||
159 | - $tema = $temas; | 175 | +if(!isset($tema) && isset($_GET["temas"])){ |
176 | + $tema = $_GET["temas"]; | ||
160 | } | 177 | } |
161 | -if(isset($typeName)){ | ||
162 | - $typename = $typeName; | 178 | +if(isset($_GET["typeName"])){ |
179 | + $typename = $_GET["typeName"]; | ||
180 | + if(!isset($tema)){ | ||
181 | + $tema = $typename; | ||
182 | + } | ||
163 | } | 183 | } |
164 | -if(!isset($tema) && isset($typename)){ | ||
165 | - $tema = $typename; | 184 | +if(!isset($tema) && isset($_GET["typename"])){ |
185 | + $tema = $_GET["typename"]; | ||
166 | } | 186 | } |
167 | // | 187 | // |
168 | //garante que layers possam ser especificados de diferentes maneiras | 188 | //garante que layers possam ser especificados de diferentes maneiras |
@@ -175,6 +195,7 @@ if(!file_exists($tema)){ | @@ -175,6 +195,7 @@ if(!file_exists($tema)){ | ||
175 | 195 | ||
176 | $layers = $tema; | 196 | $layers = $tema; |
177 | //ajusta o OUTPUTFORMAT | 197 | //ajusta o OUTPUTFORMAT |
198 | +$OUTPUTFORMAT = $_GET["OUTPUTFORMAT"]; | ||
178 | if(strpos(strtolower($OUTPUTFORMAT),"kml") !== false){ | 199 | if(strpos(strtolower($OUTPUTFORMAT),"kml") !== false){ |
179 | $OUTPUTFORMAT = "kml"; | 200 | $OUTPUTFORMAT = "kml"; |
180 | } | 201 | } |
@@ -196,6 +217,7 @@ if(strtolower($OUTPUTFORMAT) == "kmz"){ | @@ -196,6 +217,7 @@ if(strtolower($OUTPUTFORMAT) == "kmz"){ | ||
196 | header("Location:".$urln); | 217 | header("Location:".$urln); |
197 | exit; | 218 | exit; |
198 | } | 219 | } |
220 | +$ogrOutput = $_GET["ogrOutput"]; | ||
199 | if(strtolower($OUTPUTFORMAT) == "kml" && $ogrOutput == false){ | 221 | if(strtolower($OUTPUTFORMAT) == "kml" && $ogrOutput == false){ |
200 | $urln = "pacotes/kmlmapserver/kmlservice.php?request=kmz&map=".$tema."&typename=".$tema; | 222 | $urln = "pacotes/kmlmapserver/kmlservice.php?request=kmz&map=".$tema."&typename=".$tema; |
201 | header("Location:".$urln); | 223 | header("Location:".$urln); |
@@ -215,6 +237,7 @@ if(strtolower($OUTPUTFORMAT) == "shape-zip" && $ogrOutput == false){ | @@ -215,6 +237,7 @@ if(strtolower($OUTPUTFORMAT) == "shape-zip" && $ogrOutput == false){ | ||
215 | // | 237 | // |
216 | //caso seja uma requisição WMS com format | 238 | //caso seja uma requisição WMS com format |
217 | // | 239 | // |
240 | +$format = $_GET["format"]; | ||
218 | if(strpos(strtolower($format),"kml") !== false){ | 241 | if(strpos(strtolower($format),"kml") !== false){ |
219 | $urln = "pacotes/kmlmapserver/kmlservice.php?request=kml&map=".$tema."&typename=".$tema; | 242 | $urln = "pacotes/kmlmapserver/kmlservice.php?request=kml&map=".$tema."&typename=".$tema; |
220 | header("Location:".$urln); | 243 | header("Location:".$urln); |
@@ -245,22 +268,24 @@ if(strtolower($OUTPUTFORMAT) == "geojson"){ | @@ -245,22 +268,24 @@ if(strtolower($OUTPUTFORMAT) == "geojson"){ | ||
245 | // | 268 | // |
246 | //recupera um mapa salvo no banco de administracao | 269 | //recupera um mapa salvo no banco de administracao |
247 | // | 270 | // |
248 | -if(!empty($restauramapa)){ | 271 | +if(!empty($_GET["restauramapa"])){ |
249 | restauraMapaSalvo(); | 272 | restauraMapaSalvo(); |
250 | } | 273 | } |
251 | // | 274 | // |
252 | //para operar como o Geoserver, abre o openlayers | 275 | //para operar como o Geoserver, abre o openlayers |
253 | // | 276 | // |
254 | -if(isset($format) && strtolower($format) == "application/openlayers"){ | 277 | +if(isset($format) && strtolower($format) == "application/openlayers"){ |
255 | $urln = dirname($_SERVER["PHP_SELF"])."/mashups/openlayers.php?layers=".$layers."&mapext=".$bbox."&botoes=pan,zoombox,zoomtot,identifica,legenda"; | 278 | $urln = dirname($_SERVER["PHP_SELF"])."/mashups/openlayers.php?layers=".$layers."&mapext=".$bbox."&botoes=pan,zoombox,zoomtot,identifica,legenda"; |
256 | - //echo $urln;exit; | 279 | + //caso exista o openlayers3 |
280 | + if(file_exists(dirname(__FILE__)."/mashups/openlayers3.php")){ | ||
281 | + $urln = dirname($_SERVER["PHP_SELF"])."/mashups/openlayers3.php?layers=".$layers."&mapext=".$bbox."&botoes=pan,zoombox,zoomtot,identifica,legenda"; | ||
282 | + } | ||
257 | if(!headers_sent()){ | 283 | if(!headers_sent()){ |
258 | header("Location:".$urln); | 284 | header("Location:".$urln); |
259 | } | 285 | } |
260 | else{ | 286 | else{ |
261 | echo "<meta http-equiv='refresh' content='0;url=$urln'>"; | 287 | echo "<meta http-equiv='refresh' content='0;url=$urln'>"; |
262 | - } | ||
263 | - //exit.... | 288 | + } |
264 | } | 289 | } |
265 | // | 290 | // |
266 | //pega a versao do Mapserver | 291 | //pega a versao do Mapserver |
@@ -290,8 +315,8 @@ foreach ($_GET as $k=>$v){ | @@ -290,8 +315,8 @@ foreach ($_GET as $k=>$v){ | ||
290 | // | 315 | // |
291 | $req->setParameter("srsName",$req->getValueByName("SRS")); | 316 | $req->setParameter("srsName",$req->getValueByName("SRS")); |
292 | $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"; | 317 | $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"; |
293 | - | ||
294 | -if(isset($version) && !isset($VERSION)){ | 318 | +$VERSION = $_GET["VERSION"]; |
319 | +if(isset($_GET["version"]) && !isset($_GET["VERSION"])){ | ||
295 | $VERSION = $version; | 320 | $VERSION = $version; |
296 | } | 321 | } |
297 | if(!isset($VERSION) || $VERSION == ""){ | 322 | if(!isset($VERSION) || $VERSION == ""){ |
@@ -327,9 +352,14 @@ $arrayget["Z"] = ""; | @@ -327,9 +352,14 @@ $arrayget["Z"] = ""; | ||
327 | $arrayget["X"] = ""; | 352 | $arrayget["X"] = ""; |
328 | $arrayget["Y"] = ""; | 353 | $arrayget["Y"] = ""; |
329 | $arrayget["tms"] = ""; | 354 | $arrayget["tms"] = ""; |
355 | +$arrayget["TileMatrix"] = ""; | ||
356 | +$arrayget["TileCol"] = ""; | ||
357 | +$arrayget["TileRow"] = ""; | ||
358 | + | ||
330 | $nomeMapfileTmp = $dir_tmp."/ogc_".md5(implode("",$arrayget))."_".$agora.".map"; | 359 | $nomeMapfileTmp = $dir_tmp."/ogc_".md5(implode("",$arrayget))."_".$agora.".map"; |
331 | //essa variavel e usada para definir se a imagem final gerada devera ser cortada ou nao | 360 | //essa variavel e usada para definir se a imagem final gerada devera ser cortada ou nao |
332 | $cortePixels = 0; | 361 | $cortePixels = 0; |
362 | +$ogcwsmap = $_GET["ogcwsmap"]; | ||
333 | if(file_exists($nomeMapfileTmp) && $tipo == ""){ | 363 | if(file_exists($nomeMapfileTmp) && $tipo == ""){ |
334 | $oMap = ms_newMapobj($nomeMapfileTmp); | 364 | $oMap = ms_newMapobj($nomeMapfileTmp); |
335 | } | 365 | } |
@@ -375,7 +405,7 @@ else{ | @@ -375,7 +405,7 @@ else{ | ||
375 | //$temai3geo = true indica que o layer será buscado na pasta i3geo/temas | 405 | //$temai3geo = true indica que o layer será buscado na pasta i3geo/temas |
376 | $temai3geo = true; | 406 | $temai3geo = true; |
377 | //FIXME nao aceita gvp quando o caminho e completo | 407 | //FIXME nao aceita gvp quando o caminho e completo |
378 | - if(file_exists($_GET["tema"]) && !isset($id_medida_variavel)){ | 408 | + if(file_exists($_GET["tema"]) && !isset($_GET["id_medida_variavel"])){ |
379 | $nmap = ms_newMapobj($_GET["tema"]); | 409 | $nmap = ms_newMapobj($_GET["tema"]); |
380 | $temai3geo = false; | 410 | $temai3geo = false; |
381 | $nmap->setmetadata("ows_enable_request","*"); | 411 | $nmap->setmetadata("ows_enable_request","*"); |
@@ -383,7 +413,7 @@ else{ | @@ -383,7 +413,7 @@ else{ | ||
383 | foreach ($listatema as $tx){ | 413 | foreach ($listatema as $tx){ |
384 | $extensao = ".map"; | 414 | $extensao = ".map"; |
385 | if($temai3geo == true && file_exists($locaplic."/temas/".$tx.".php")){ | 415 | if($temai3geo == true && file_exists($locaplic."/temas/".$tx.".php")){ |
386 | - $extensao = ".php"; | 416 | + //$extensao = ".php"; |
387 | } | 417 | } |
388 | if($temai3geo == true && file_exists($locaplic."/temas/".$tx.".gvp")){ | 418 | if($temai3geo == true && file_exists($locaplic."/temas/".$tx.".gvp")){ |
389 | $extensao = ".gvp"; | 419 | $extensao = ".gvp"; |
@@ -391,23 +421,23 @@ else{ | @@ -391,23 +421,23 @@ else{ | ||
391 | if($extensao == ".map"){ | 421 | if($extensao == ".map"){ |
392 | //cria o mapfile com base no sistema de metadados estatisticos | 422 | //cria o mapfile com base no sistema de metadados estatisticos |
393 | //verifica se o id_medida_variavel existe no mapfile e nao foi passado como um parametro | 423 | //verifica se o id_medida_variavel existe no mapfile e nao foi passado como um parametro |
394 | - if(!isset($id_medida_variavel) && $temai3geo == true){ | 424 | + if(!isset($_GET["id_medida_variavel"]) && $temai3geo == true){ |
395 | $nmap = ms_newMapobj($locaplic."/temas/".$tx.".map"); | 425 | $nmap = ms_newMapobj($locaplic."/temas/".$tx.".map"); |
396 | $l = $nmap->getlayer(0); | 426 | $l = $nmap->getlayer(0); |
397 | $teste = $l->getmetadata("METAESTAT_ID_MEDIDA_VARIAVEL"); | 427 | $teste = $l->getmetadata("METAESTAT_ID_MEDIDA_VARIAVEL"); |
398 | if($teste != "" && $l->data == ""){ | 428 | if($teste != "" && $l->data == ""){ |
399 | - $id_medida_variavel = $teste; | 429 | + $_GET["id_medida_variavel"] = $teste; |
400 | } | 430 | } |
401 | } | 431 | } |
402 | - if(isset($id_medida_variavel)){ | 432 | + if(isset($_GET["id_medida_variavel"])){ |
403 | $temai3geo = false; | 433 | $temai3geo = false; |
404 | include("admin/php/classe_metaestat.php"); | 434 | include("admin/php/classe_metaestat.php"); |
405 | $m = new Metaestat(); | 435 | $m = new Metaestat(); |
406 | - $m->nomecache = "ogcmetaestat".$id_medida_variavel; | ||
407 | - $mapfileMetaestat = $m->mapfileMedidaVariavel($id_medida_variavel,"",1,"","","","","","",true); | 436 | + $m->nomecache = "ogcmetaestat".$_GET["id_medida_variavel"]; |
437 | + $mapfileMetaestat = $m->mapfileMedidaVariavel($_GET["id_medida_variavel"],"",1,"","","","","","",true); | ||
408 | $nmap = ms_newMapobj($mapfileMetaestat["mapfile"]); | 438 | $nmap = ms_newMapobj($mapfileMetaestat["mapfile"]); |
409 | $nmap->setmetadata("ows_enable_request","*"); | 439 | $nmap->setmetadata("ows_enable_request","*"); |
410 | - $req->setParameter("LAYERS", "ogcmetaestat".$id_medida_variavel); | 440 | + $req->setParameter("LAYERS", "ogcmetaestat".$_GET["id_medida_variavel"]); |
411 | } | 441 | } |
412 | if($temai3geo == true){ | 442 | if($temai3geo == true){ |
413 | $nmap = ms_newMapobj($locaplic."/temas/".$tx.".map"); | 443 | $nmap = ms_newMapobj($locaplic."/temas/".$tx.".map"); |
@@ -542,10 +572,7 @@ else{ | @@ -542,10 +572,7 @@ else{ | ||
542 | } | 572 | } |
543 | } | 573 | } |
544 | } | 574 | } |
545 | - if($extensao == ".php"){ | ||
546 | - include_once($locaplic."/temas/".$tx.".php"); | ||
547 | - eval($tx."(\$oMap);"); | ||
548 | - } | 575 | + |
549 | if($extensao == ".gvp"){ | 576 | if($extensao == ".gvp"){ |
550 | include_once($locaplic."/pacotes/gvsig/gvsig2mapfile/class.gvsig2mapfile.php"); | 577 | include_once($locaplic."/pacotes/gvsig/gvsig2mapfile/class.gvsig2mapfile.php"); |
551 | $gm = new gvsig2mapfile($locaplic."/temas/".$tx.".gvp"); | 578 | $gm = new gvsig2mapfile($locaplic."/temas/".$tx.".gvp"); |
@@ -603,7 +630,7 @@ else{ | @@ -603,7 +630,7 @@ else{ | ||
603 | $conta = 0; | 630 | $conta = 0; |
604 | $int = explode(",",$intervalo); | 631 | $int = explode(",",$intervalo); |
605 | $codigosTema = array(); | 632 | $codigosTema = array(); |
606 | - if(empty($perfil)){ | 633 | + if(empty($_GET["perfil"])){ |
607 | $perfil = ""; | 634 | $perfil = ""; |
608 | } | 635 | } |
609 | include("classesphp/classe_menutemas.php"); | 636 | include("classesphp/classe_menutemas.php"); |
@@ -691,8 +718,8 @@ else{ | @@ -691,8 +718,8 @@ else{ | ||
691 | echo "Erro no arquivo ".$locaplic."/temas/".$codigoTema.".map <br>"; | 718 | echo "Erro no arquivo ".$locaplic."/temas/".$codigoTema.".map <br>"; |
692 | $error = ms_GetErrorObj(); | 719 | $error = ms_GetErrorObj(); |
693 | while($error && $error->code != MS_NOERR){ | 720 | while($error && $error->code != MS_NOERR){ |
694 | - printf("<br>Error in %s: %s<br>\n", $error->routine, $error->message); | ||
695 | - $error = $error->next(); | 721 | + //printf("<br>Error in %s: %s<br>\n", $error->routine, $error->message); |
722 | + //$error = $error->next(); | ||
696 | } | 723 | } |
697 | } | 724 | } |
698 | } | 725 | } |
@@ -700,7 +727,8 @@ else{ | @@ -700,7 +727,8 @@ else{ | ||
700 | } | 727 | } |
701 | // | 728 | // |
702 | //a imagem do mapa recebera a legenda | 729 | //a imagem do mapa recebera a legenda |
703 | - // | 730 | + // |
731 | + $legenda = $_GET["legenda"]; | ||
704 | if((isset($legenda)) && (strtolower($legenda) == "sim")){ | 732 | if((isset($legenda)) && (strtolower($legenda) == "sim")){ |
705 | $leg = $oMap->legend; | 733 | $leg = $oMap->legend; |
706 | $leg->set("status",MS_EMBED); | 734 | $leg->set("status",MS_EMBED); |
@@ -713,10 +741,11 @@ else{ | @@ -713,10 +741,11 @@ else{ | ||
713 | //caso seja download ou json ou csv | 741 | //caso seja download ou json ou csv |
714 | // | 742 | // |
715 | processaOutputformatMapfile(); | 743 | processaOutputformatMapfile(); |
744 | + $nomeMapfileTmp = str_replace(".map","").".map"; | ||
716 | $oMap->save($nomeMapfileTmp); | 745 | $oMap->save($nomeMapfileTmp); |
717 | 746 | ||
718 | validaAcessoTemas($nomeMapfileTmp,true); | 747 | validaAcessoTemas($nomeMapfileTmp,true); |
719 | - | 748 | + |
720 | $oMap = ms_newMapobj($nomeMapfileTmp); | 749 | $oMap = ms_newMapobj($nomeMapfileTmp); |
721 | } | 750 | } |
722 | 751 | ||
@@ -734,16 +763,30 @@ if(ob_get_contents ()){ | @@ -734,16 +763,30 @@ if(ob_get_contents ()){ | ||
734 | //tms e usado basicamente por mashup ou openlayers | 763 | //tms e usado basicamente por mashup ou openlayers |
735 | // | 764 | // |
736 | if(isset($_GET["tms"])){ | 765 | if(isset($_GET["tms"])){ |
737 | - $temp = explode("/",$_GET["tms"]); | ||
738 | - $z = $temp[2]; | ||
739 | - $x = $temp[3]; | ||
740 | - $y = str_replace(".png","",$temp[4]); | ||
741 | - $n = pow(2,$z+1); | ||
742 | - $lon1 = $x / $n * 360.0 - 180.0; | ||
743 | - $lon2 = ($x+1) / $n * 360.0 - 180.0; | ||
744 | - $n = pow(2,$z); | ||
745 | - $lat1 = $y / $n * 180.0 - 90.0; | ||
746 | - $lat2 = ($y+1) / $n * 180.0 - 90.0; | 766 | + if(!isset($_GET["TileMatrix"])){ |
767 | + $temp = explode("/",$_GET["tms"]); | ||
768 | + $z = $temp[2]; | ||
769 | + $x = $temp[3]; | ||
770 | + $y = str_replace(".png","",$temp[4]); | ||
771 | + $n = pow(2,$z+1); | ||
772 | + $lon1 = $x / $n * 360.0 - 180.0; | ||
773 | + $lon2 = ($x+1) / $n * 360.0 - 180.0; | ||
774 | + $n = pow(2,$z); | ||
775 | + $lat1 = $y / $n * 180.0 - 90.0; | ||
776 | + $lat2 = ($y+1) / $n * 180.0 - 90.0; | ||
777 | + } | ||
778 | + else{ | ||
779 | + $top_left_minx = -180; | ||
780 | + $top_left_maxy = 90; | ||
781 | + | ||
782 | + $x_size = $res[$_GET["TileMatrix"] - 1] * 256; | ||
783 | + $y_size = $x_size; | ||
784 | + | ||
785 | + $lon1 = $top_left_minx + ($_GET["TileCol"] * $x_size); | ||
786 | + $lat1 = $top_left_maxy - ($_GET["TileRow"] * $y_size) - $y_size; | ||
787 | + $lon2 = $top_left_minx + ($_GET["TileCol"] * $x_size) + $x_size; | ||
788 | + $lat2 = $top_left_maxy - ($_GET["TileRow"] * $y_size); | ||
789 | + } | ||
747 | //essa funcao termina o processo se a imagem existir | 790 | //essa funcao termina o processo se a imagem existir |
748 | if($cache == true){ | 791 | if($cache == true){ |
749 | carregaCacheImagem($cachedir,$nomeMapfileTmp,$_GET["tms"]); | 792 | carregaCacheImagem($cachedir,$nomeMapfileTmp,$_GET["tms"]); |
@@ -758,7 +801,6 @@ if(isset($_GET["tms"])){ | @@ -758,7 +801,6 @@ if(isset($_GET["tms"])){ | ||
758 | //se nao existir, salva a imagem | 801 | //se nao existir, salva a imagem |
759 | //echo $lon1." ".$lat1." ".$lon2." ".$lat2;exit; | 802 | //echo $lon1." ".$lat1." ".$lon2." ".$lat2;exit; |
760 | $oMap->setsize(256,256); | 803 | $oMap->setsize(256,256); |
761 | - | ||
762 | $oMap->setExtent($lon1,$lat1,$lon2,$lat2); | 804 | $oMap->setExtent($lon1,$lat1,$lon2,$lat2); |
763 | 805 | ||
764 | $layer0->set("status",MS_DEFAULT); | 806 | $layer0->set("status",MS_DEFAULT); |
@@ -838,8 +880,6 @@ if(isset($_GET["Z"]) && isset($_GET["X"])){ | @@ -838,8 +880,6 @@ if(isset($_GET["Z"]) && isset($_GET["X"])){ | ||
838 | $poPoint2->project($projInObj, $projOutObj); | 880 | $poPoint2->project($projInObj, $projOutObj); |
839 | $oMap->setsize(256,256); | 881 | $oMap->setsize(256,256); |
840 | $oMap->setExtent($poPoint1->x,$poPoint1->y,$poPoint2->x,$poPoint2->y); | 882 | $oMap->setExtent($poPoint1->x,$poPoint1->y,$poPoint2->x,$poPoint2->y); |
841 | - | ||
842 | - | ||
843 | 883 | ||
844 | $oMap->setProjection("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"); | 884 | $oMap->setProjection("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"); |
845 | 885 | ||
@@ -1081,84 +1121,16 @@ function ogc_imprimeAjuda(){ | @@ -1081,84 +1121,16 @@ function ogc_imprimeAjuda(){ | ||
1081 | echo "de dados de administracao para utiliza-lo como um WMS"; | 1121 | echo "de dados de administracao para utiliza-lo como um WMS"; |
1082 | } | 1122 | } |
1083 | function ogc_imprimeListaDeTemas(){ | 1123 | function ogc_imprimeListaDeTemas(){ |
1084 | - global $urli3geo,$perfil,$locaplic; | ||
1085 | - $m = new Menutemas("",$perfil,$locaplic,$urli3geo); | ||
1086 | - $menus = $m->pegaListaDeMenus(); | ||
1087 | - echo '<html><head><title>WMS</title><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1"><meta name="description" content="OGC"><meta name="keywords" content="WMS OGC mapa sig gis webmapping geo geoprocessamento interativo meio ambiente MMA cartografia geografia"> <meta name="robots" content="index,follow">'; | ||
1088 | - echo "<body><b>Lista de temas por grupos e subgrupos e endereços de acesso aos dados por meio de Web Services WMS (os códigos dos temas estão em vermelho)</b><br><br>"; | ||
1089 | - $imprimir = ""; | ||
1090 | - foreach ($menus as $menu){ | ||
1091 | - $grupos = $m->pegaListaDeGrupos($menu["idmenu"],$listasistemas="nao",$listasgrupos="sim"); | ||
1092 | - foreach($grupos as $grupo){ | ||
1093 | - if(!empty($grupo["ogc"]) && strtolower($grupo["ogc"]) == "sim"){ | ||
1094 | - $imprimegrupo = "<i>".texto2iso($grupo["nome"])."</i>"; | ||
1095 | - foreach($grupo["subgrupos"] as $sgrupo){ | ||
1096 | - if(strtolower($sgrupo["ogc"]) == "sim"){ | ||
1097 | - $imprimesubgrupo = $sgrupo["nome"]; | ||
1098 | - $lts = $m->pegaListaDeTemas($grupo["id_n1"],$sgrupo["id_n2"],$menu["idmenu"]); | ||
1099 | - foreach($lts as $t){ | ||
1100 | - if(strtolower($t["ogc"]) == "sim"){ | ||
1101 | - $imprimir .= texto2iso($imprimegrupo)."->".texto2iso($imprimesubgrupo)."<br>"; | ||
1102 | - $imprimir .= " "; | ||
1103 | - $imprimir .= "<span style=color:red >".$t["tid"]."</span>"; | ||
1104 | - $imprimir .= " - ".texto2iso($t["nome"])." "; | ||
1105 | - $imprimir .= " <a href='".$urli3geo."/ogc.php?tema=".$t["tid"]."&service=wms&request=getcapabilities' >Getcapabilities</a>"; | ||
1106 | - $imprimir .= " <a href='".$urli3geo."/ogc.php?tema=".$t["tid"]."&SRS=EPSG:4618&WIDTH=500&HEIGHT=500&BBOX=-76.5125927,-39.3925675209,-29.5851853,9.49014852081&FORMAT=image/png&service=wms&version=1.1.0&request=getmap&layers=".$t["tid"]."' >GetMap </a>"; | ||
1107 | - if($t["link"] != " ") | ||
1108 | - $imprimir .= " <a href='".$t["link"]."' >fonte</a>"; | ||
1109 | - $imprimir .= "<br>"; | ||
1110 | - } | ||
1111 | - } | ||
1112 | - } | ||
1113 | - } | ||
1114 | - } | ||
1115 | - } | ||
1116 | - } | ||
1117 | - echo $imprimir."</body></html>"; | ||
1118 | } | 1124 | } |
1119 | function ogc_imprimeListaDeTemasWfs(){ | 1125 | function ogc_imprimeListaDeTemasWfs(){ |
1120 | - global $urli3geo,$perfil,$locaplic; | ||
1121 | - $m = new Menutemas("",$perfil,$locaplic,$urli3geo); | ||
1122 | - $menus = $m->pegaListaDeMenus(); | ||
1123 | - echo '<html><head><title>WFS</title><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1"><meta name="description" content="OGC"><meta name="keywords" content="WMS OGC mapa sig gis webmapping geo geoprocessamento interativo meio ambiente MMA cartografia geografia"> <meta name="robots" content="index,follow">'; | ||
1124 | - echo "<body><b>Lista de temas por grupos e subgrupos e endereços de acesso aos dados por meio de Web Services WFS (os códigos dos temas estão em vermelho)</b><br><br>"; | ||
1125 | - $imprimir = ""; | ||
1126 | - foreach ($menus as $menu){ | ||
1127 | - $grupos = $m->pegaListaDeGrupos($menu["idmenu"],$listasistemas="nao",$listasgrupos="sim"); | ||
1128 | - foreach($grupos as $grupo){ | ||
1129 | - if(strtolower($grupo["ogc"]) == "sim"){ | ||
1130 | - $imprimegrupo = "<i>".$grupo["nome"]."</i>"; | ||
1131 | - foreach($grupo["subgrupos"] as $sgrupo){ | ||
1132 | - if(strtolower($sgrupo["ogc"]) == "sim"){ | ||
1133 | - $imprimesubgrupo = $sgrupo["nome"]; | ||
1134 | - $lts = $m->pegaListaDeTemas($grupo["id_n1"],$sgrupo["id_n2"],$menu["idmenu"]); | ||
1135 | - foreach($lts as $t){ | ||
1136 | - if(strtolower($t["ogc"]) == "sim" && strtolower($t["down"]) !== "nao"){ | ||
1137 | - $imprimir .= $imprimegrupo."->".$imprimesubgrupo."<br>"; | ||
1138 | - $imprimir .= " "; | ||
1139 | - $imprimir .= "<span style=color:red >".$t["tid"]."</span>"; | ||
1140 | - $imprimir .= " - ".$t["nome"]." "; | ||
1141 | - $imprimir .= " <a href='".$urli3geo."/ogc.php?tema=".$t["tid"]."&service=wfs&request=getcapabilities' >Getcapabilities</a>"; | ||
1142 | - $imprimir .= " <a href='".$urli3geo."/ogc.php?tema=".$t["tid"]."&SRS=EPSG:4618&service=wfs&version=1.1.0&request=getfeature&typename=".$t["tid"]."' >Getfeature </a>"; | ||
1143 | - if($t["link"] != " ") | ||
1144 | - $imprimir .= " <a href='".$t["link"]."' >fonte</a>"; | ||
1145 | - $imprimir .= "<br>"; | ||
1146 | - } | ||
1147 | - } | ||
1148 | - } | ||
1149 | - } | ||
1150 | - } | ||
1151 | - } | ||
1152 | - } | ||
1153 | - echo $imprimir."</body></html>"; | ||
1154 | } | 1126 | } |
1155 | function carregaCacheImagem($cachedir,$map,$tms){ | 1127 | function carregaCacheImagem($cachedir,$map,$tms){ |
1156 | global $dir_tmp; | 1128 | global $dir_tmp; |
1157 | if($cachedir == ""){ | 1129 | if($cachedir == ""){ |
1158 | - $nome = $dir_tmp."/cache".$tms; | 1130 | + $nome = $dir_tmp."/cache".$tms.".png"; |
1159 | } | 1131 | } |
1160 | else{ | 1132 | else{ |
1161 | - $nome = $cachedir.$tms; | 1133 | + $nome = $cachedir.$tms.".png"; |
1162 | } | 1134 | } |
1163 | if(file_exists($nome)){ | 1135 | if(file_exists($nome)){ |
1164 | header('Content-Length: '.filesize($nome)); | 1136 | header('Content-Length: '.filesize($nome)); |
@@ -1174,15 +1146,17 @@ function carregaCacheImagem($cachedir,$map,$tms){ | @@ -1174,15 +1146,17 @@ function carregaCacheImagem($cachedir,$map,$tms){ | ||
1174 | } | 1146 | } |
1175 | function salvaCacheImagem($cachedir,$map,$tms){ | 1147 | function salvaCacheImagem($cachedir,$map,$tms){ |
1176 | global $img,$dir_tmp,$cortePixels; | 1148 | global $img,$dir_tmp,$cortePixels; |
1149 | + //por seguranca | ||
1177 | if($cachedir == ""){ | 1150 | if($cachedir == ""){ |
1178 | $nome = $dir_tmp."/cache".$tms; | 1151 | $nome = $dir_tmp."/cache".$tms; |
1179 | } | 1152 | } |
1180 | else{ | 1153 | else{ |
1181 | $nome = $cachedir.$tms; | 1154 | $nome = $cachedir.$tms; |
1182 | } | 1155 | } |
1183 | - @mkdir(dirname($nome),0777,true); | ||
1184 | - chmod(dirname($nome),0777); | ||
1185 | - $img->saveImage($nome); | 1156 | + @mkdir(dirname($nome),0774,true); |
1157 | + chmod(dirname($nome),0774); | ||
1158 | + | ||
1159 | + $img->saveImage($nome.".png"); | ||
1186 | // | 1160 | // |
1187 | //corta a imagem gerada para voltar ao tamanho normal | 1161 | //corta a imagem gerada para voltar ao tamanho normal |
1188 | // | 1162 | // |
@@ -1198,7 +1172,7 @@ function salvaCacheImagem($cachedir,$map,$tms){ | @@ -1198,7 +1172,7 @@ function salvaCacheImagem($cachedir,$map,$tms){ | ||
1198 | imagecopy($imgc, $img, 0 , 0 , $cortePixels , $cortePixels , 256, 256); | 1172 | imagecopy($imgc, $img, 0 , 0 , $cortePixels , $cortePixels , 256, 256); |
1199 | imagepng($imgc,$nome); | 1173 | imagepng($imgc,$nome); |
1200 | } | 1174 | } |
1201 | - chmod($nome,0777); | 1175 | + chmod($nome,0774); |
1202 | header('Content-Length: '.filesize($nome)); | 1176 | header('Content-Length: '.filesize($nome)); |
1203 | header('Content-Type: image/png'); | 1177 | header('Content-Type: image/png'); |
1204 | header('Cache-Control: max-age=3600, must-revalidate'); | 1178 | header('Cache-Control: max-age=3600, must-revalidate'); |
@@ -1453,10 +1427,10 @@ function exportaCsv(){ | @@ -1453,10 +1427,10 @@ function exportaCsv(){ | ||
1453 | 1427 | ||
1454 | } | 1428 | } |
1455 | $contents = implode("\n",$linhas); | 1429 | $contents = implode("\n",$linhas); |
1456 | - file_put_contents($arq,$contents); | 1430 | + file_put_contents($arq.".csv",$contents); |
1457 | //envia para download | 1431 | //envia para download |
1458 | ob_clean(); | 1432 | ob_clean(); |
1459 | - header('Content-Disposition: attachment; filename='.$fileName); | 1433 | + header('Content-Disposition: attachment; filename='.$fileName.".csv"); |
1460 | header("Content-type: text/csv"); | 1434 | header("Content-type: text/csv"); |
1461 | echo $contents; | 1435 | echo $contents; |
1462 | exit; | 1436 | exit; |
@@ -1502,7 +1476,7 @@ function exportaGeojson(){ | @@ -1502,7 +1476,7 @@ function exportaGeojson(){ | ||
1502 | ); | 1476 | ); |
1503 | $contents = json_encode($n[0]); | 1477 | $contents = json_encode($n[0]); |
1504 | $contents = str_replace('\"','',$contents); | 1478 | $contents = str_replace('\"','',$contents); |
1505 | - file_put_contents($arq,$contents); | 1479 | + file_put_contents($arq.".json",$contents); |
1506 | ob_clean(); | 1480 | ob_clean(); |
1507 | header("Content-type: application/json; subtype=geojson"); | 1481 | header("Content-type: application/json; subtype=geojson"); |
1508 | echo $contents; | 1482 | echo $contents; |
@@ -1517,6 +1491,7 @@ function converteenc($texto){ | @@ -1517,6 +1491,7 @@ function converteenc($texto){ | ||
1517 | } | 1491 | } |
1518 | function processaPluginI3geo(){ | 1492 | function processaPluginI3geo(){ |
1519 | global $oMap, $locaplic; | 1493 | global $oMap, $locaplic; |
1494 | + return; | ||
1520 | $numlayers = $oMap->numlayers; | 1495 | $numlayers = $oMap->numlayers; |
1521 | for ($i=0;$i < $numlayers;$i++){ | 1496 | for ($i=0;$i < $numlayers;$i++){ |
1522 | $l = $oMap->getlayer($i); | 1497 | $l = $oMap->getlayer($i); |
@@ -1577,6 +1552,7 @@ function processaPluginI3geo(){ | @@ -1577,6 +1552,7 @@ function processaPluginI3geo(){ | ||
1577 | } | 1552 | } |
1578 | //utilizada para obter os dados default quando se utiliza o plugin parametrossql | 1553 | //utilizada para obter os dados default quando se utiliza o plugin parametrossql |
1579 | function execProg($prog){ | 1554 | function execProg($prog){ |
1555 | + return; | ||
1580 | include($prog); | 1556 | include($prog); |
1581 | //$retorno variavel deve ser retornada pelo programa $prog | 1557 | //$retorno variavel deve ser retornada pelo programa $prog |
1582 | //veja como exemplo i3geo/aplicmap/daods/listaano.php | 1558 | //veja como exemplo i3geo/aplicmap/daods/listaano.php |