Commit 2f0ecbf62b9b62492aa77e0bc85b62823c4a7436
1 parent
8e89acdf
Exists in
master
and in
7 other branches
--no commit message
Showing
3 changed files
with
45 additions
and
7 deletions
Show diff stats
admin/admin.db
No preview for this file type
admin/php/classe_metaestat.php
| ... | ... | @@ -432,9 +432,6 @@ class Metaestat{ |
| 432 | 432 | //outros metadados tambem sao utilizados, veja em admin/php/editormapfile.php |
| 433 | 433 | $arq = $this->dir_tmp."/".$this->nomecache.".map"; |
| 434 | 434 | if(!file_exists($arq)){ |
| 435 | - if(empty($tipolayer)){ | |
| 436 | - $tipolayer = "polygon"; | |
| 437 | - } | |
| 438 | 435 | $meta = $this->listaMedidaVariavel("",$id_medida_variavel); |
| 439 | 436 | //evita agregar regioes qd nao e necessario |
| 440 | 437 | if($meta["codigo_tipo_regiao"] == $codigo_tipo_regiao || empty($codigo_tipo_regiao) ){ |
| ... | ... | @@ -450,6 +447,14 @@ class Metaestat{ |
| 450 | 447 | $d = $this->listaMedidaVariavel("",$id_medida_variavel); |
| 451 | 448 | $codigo_tipo_regiao = $d["codigo_tipo_regiao"]; |
| 452 | 449 | } |
| 450 | + //define o tipo correto de layer | |
| 451 | + $dg = $this->listaDadosGeometriaRegiao($codigo_tipo_regiao); | |
| 452 | + if(empty($tipolayer) || $dg["dimension"] == 0){ | |
| 453 | + $tipolayer = "point"; | |
| 454 | + } | |
| 455 | + if($dg["dimension"] == 1){ | |
| 456 | + $tipolayer = "line"; | |
| 457 | + } | |
| 453 | 458 | $sqlf = $sql["sqlmapserver"]; |
| 454 | 459 | //echo $sqlf;exit; |
| 455 | 460 | if(!empty($filtro)){ |
| ... | ... | @@ -567,6 +572,14 @@ class Metaestat{ |
| 567 | 572 | } |
| 568 | 573 | if(!file_exists($arq)){ |
| 569 | 574 | $tipolayer = "polygon"; |
| 575 | + //define o tipo correto de layer | |
| 576 | + $dg = $this->listaDadosGeometriaRegiao($codigo_tipo_regiao); | |
| 577 | + if(empty($tipolayer) || $dg["dimension"] == 0){ | |
| 578 | + $tipolayer = "point"; | |
| 579 | + } | |
| 580 | + if($dg["dimension"] == 1){ | |
| 581 | + $tipolayer = "line"; | |
| 582 | + } | |
| 570 | 583 | $meta = $this->listaTipoRegiao($codigo_tipo_regiao); |
| 571 | 584 | $titulolayer = $meta["nome_tipo_regiao"]; |
| 572 | 585 | $titulolayer = mb_convert_encoding($titulolayer,"ISO-8859-1",mb_detect_encoding($titulolayer)); |
| ... | ... | @@ -603,8 +616,16 @@ class Metaestat{ |
| 603 | 616 | $dados[] = ' NAME ""'; |
| 604 | 617 | $dados[] = ' STYLE'; |
| 605 | 618 | $dados[] = ' OUTLINECOLOR '.$outlinecolor; |
| 606 | - $dados[] = ' COLOR -1 -1 -1'; | |
| 619 | + | |
| 607 | 620 | $dados[] = ' WIDTH '.$width; |
| 621 | + if(strtolower($tipolayer) == "point"){ | |
| 622 | + $dados[] = ' SYMBOL "ponto"'; | |
| 623 | + $dados[] = ' SIZE 5'; | |
| 624 | + $dados[] = ' COLOR 0 0 0 '; | |
| 625 | + } | |
| 626 | + else{ | |
| 627 | + $dados[] = ' COLOR -1 -1 -1'; | |
| 628 | + } | |
| 608 | 629 | $dados[] = ' END'; |
| 609 | 630 | //$dados[] = ' STYLE'; |
| 610 | 631 | //$dados[] = ' OUTLINECOLOR -1 -1 -1'; |
| ... | ... | @@ -1578,6 +1599,22 @@ class Metaestat{ |
| 1578 | 1599 | } |
| 1579 | 1600 | return $r; |
| 1580 | 1601 | } |
| 1602 | + function listaDadosGeometriaRegiao($codigo_tipo_regiao){ | |
| 1603 | + //pega a tabela, esquema e conexao para acessar os dados da regiao | |
| 1604 | + $regiao = $this->listaTipoRegiao($codigo_tipo_regiao); | |
| 1605 | + $c = $this->listaConexao($regiao["codigo_estat_conexao"],true); | |
| 1606 | + $dbh = new PDO('pgsql:dbname='.$c["bancodedados"].';user='.$c["usuario"].';password='.$c["senha"].';host='.$c["host"].';port='.$c["porta"]); | |
| 1607 | + $c = $regiao["colunageo"]; | |
| 1608 | + $s = "ST_dimension($c) as dimension "; | |
| 1609 | + $sql = "select $s,".$regiao["colunanomeregiao"]." as nome_regiao,".$regiao["identificador"]." as identificador_regiao from ".$regiao["esquemadb"].".".$regiao["tabela"]; | |
| 1610 | + $sql .= " limit 1"; | |
| 1611 | + $q = $dbh->query($sql,PDO::FETCH_ASSOC); | |
| 1612 | + $r = array(); | |
| 1613 | + if($q){ | |
| 1614 | + $r = $q->fetchAll()[0]; | |
| 1615 | + } | |
| 1616 | + return $r; | |
| 1617 | + } | |
| 1581 | 1618 | function listaAgregaRegiao($codigo_tipo_regiao,$id_agregaregiao=""){ |
| 1582 | 1619 | $sql = "select * from ".$this->esquemaadmin."i3geoestat_agregaregiao "; |
| 1583 | 1620 | if($id_agregaregiao != ""){ | ... | ... |
admin/php/metaestat_uploadshp_submit.php
| ... | ... | @@ -72,11 +72,12 @@ if (isset($_FILES['i3GEOuploadshp']['name'])){ |
| 72 | 72 | $colunasTemp = $layer->getItems(); |
| 73 | 73 | $colunas = array(); |
| 74 | 74 | foreach($colunasTemp as $c){ |
| 75 | - if(!is_numeric($c)){ | |
| 75 | + //abaixo gid e forçado a entrar | |
| 76 | + if(!is_numeric($c) && strtolower($c) != "gid"){ | |
| 76 | 77 | $colunas[] = $c; |
| 77 | 78 | } |
| 78 | 79 | } |
| 79 | - | |
| 80 | + | |
| 80 | 81 | echo "<br>Numshapes: ". $numshapes; |
| 81 | 82 | $tipo = $shapefileObj->type; |
| 82 | 83 | echo "<br>Tipo: ". $tipo; |
| ... | ... | @@ -142,7 +143,7 @@ if (isset($_FILES['i3GEOuploadshp']['name'])){ |
| 142 | 143 | } catch (PDOException $e) { |
| 143 | 144 | echo 'Connection failed: ' . $e->getMessage(); |
| 144 | 145 | } |
| 145 | - | |
| 146 | + | |
| 146 | 147 | foreach($sqltabela as $linha){ |
| 147 | 148 | try { |
| 148 | 149 | $dbh->query($linha); | ... | ... |