Commit 112cad2deabd6db4df32bbf547dbaa2017a260cf
1 parent
e7036494
Exists in
master
and in
7 other branches
$1
Showing
3 changed files
with
14 additions
and
10 deletions
Show diff stats
admin/js/estat_editor.js
... | ... | @@ -527,12 +527,13 @@ i3GEOadmin.editor = { |
527 | 527 | i3GEOadmin.editor.tabela.optionsTabela + |
528 | 528 | '</select></p>' + |
529 | 529 | '<p class="paragrafo" >Tipo de operação:</p>' + |
530 | - '<p class="paragrafo" ><select id=i3GEOtipoOperacao name=tipoOperacao >' + | |
530 | + '<select id=i3GEOtipoOperacao name=tipoOperacao >' + | |
531 | 531 | '<option value=criar >Criar a tabela nova e incluir registros do SHP</option>' + |
532 | 532 | '<option value=incluir >Adicionar novos registros</option>' + |
533 | 533 | '<option value=apagar >Apagar dados atuais e incluir do SHP</option>' + |
534 | 534 | '</select></p>' + |
535 | 535 | '<p class="paragrafo" >Código da projeção (SRID) Assegure-se que o shapefile esteja na projeção geográfica se você for usar com o sistema de metadados estatísticos :<br><input class=digitar type="text" value="4326" size=20 id="srid" name="srid" style="top:0px;left:0px;cursor:pointer;"></p>' + |
536 | + '<p class="paragrafo" ><input type="checkbox" id="incluiserialshp" name="incluiserialshp" style="cursor:pointer;position:relative;top:2px;"> Inclui uma coluna gid do tipo serial e chave primária com código único</p>' + | |
536 | 537 | '<p class="paragrafo" ><input id=i3GEOuploadsubmit type="button" value="Enviar" size=12 />' + |
537 | 538 | '<input type="hidden" name="MAX_FILE_SIZE" value="1000000">' + |
538 | 539 | '<input type="hidden" id="i3GEOuploadcodigoconexao" name="i3GEOuploadcodigoconexao" value="">' + | ... | ... |
admin/menu.html
... | ... | @@ -106,12 +106,7 @@ |
106 | 106 | href: "html/estat_fonteinfo.html", |
107 | 107 | target: "principal" |
108 | 108 | },{ |
109 | - label: "Upload de dados para uma variável (para upload de shapefile, utilize o gerenciador de tabelas)", | |
110 | - type: "text", | |
111 | - href: "html/estat_uploaddados.html", | |
112 | - target: "principal" | |
113 | - },{ | |
114 | - label: "Gerenciador de tabelas de dados estatísticos", | |
109 | + label: "Gerenciador de tabelas de dados estatísticos (upload de SHP e CSV)", | |
115 | 110 | type: "text", |
116 | 111 | href: "html/estat_editor.html", |
117 | 112 | target: "principal" |
... | ... | @@ -126,6 +121,11 @@ |
126 | 121 | type: "text", |
127 | 122 | href: "html/subirshapefile.html", |
128 | 123 | target: "principal" |
124 | + },{ | |
125 | + label: "Gerenciador de tabelas de dados estatísticos (upload de SHP e CSV)", | |
126 | + type: "text", | |
127 | + href: "html/estat_editor.html", | |
128 | + target: "principal" | |
129 | 129 | } |
130 | 130 | ]},{ |
131 | 131 | label: "Editor de mapfiles", | ... | ... |
admin/php/metaestat_uploadshp_submit.php
... | ... | @@ -147,7 +147,7 @@ if (isset($_FILES['i3GEOuploadshp']['name'])){ |
147 | 147 | //a tabela nao existe e e do tipo create |
148 | 148 | $sqltabela = array(); |
149 | 149 | if($tabelaExiste == false && $_POST["tipoOperacao"] == "criar"){ |
150 | - $sql = "CREATE TABLE ".$_POST["i3GEOuploadesquema"].".".$_POST["tabelaDestino"]."(gid integer, the_geom geometry"; | |
150 | + $sql = "CREATE TABLE ".$_POST["i3GEOuploadesquema"].".".$_POST["tabelaDestino"]."(the_geom geometry"; | |
151 | 151 | foreach($colunas as $coluna){ |
152 | 152 | $sql .= ",".strtolower($coluna)." ".$tipoColuna[$coluna]; |
153 | 153 | } |
... | ... | @@ -176,7 +176,7 @@ if (isset($_FILES['i3GEOuploadshp']['name'])){ |
176 | 176 | } |
177 | 177 | //gera o script para inserir os dados |
178 | 178 | $linhas = array(); |
179 | - $insert = "INSERT INTO ".$_POST["i3GEOuploadesquema"].".".$_POST["tabelaDestino"]."( gid,".strtolower(implode(",",$colunas)).",the_geom)"; | |
179 | + $insert = "INSERT INTO ".$_POST["i3GEOuploadesquema"].".".$_POST["tabelaDestino"]." (".strtolower(implode(",",$colunas)).",the_geom)"; | |
180 | 180 | echo "<br>Preparando inclusão de dados"; |
181 | 181 | ob_flush(); |
182 | 182 | flush(); |
... | ... | @@ -184,7 +184,6 @@ if (isset($_FILES['i3GEOuploadshp']['name'])){ |
184 | 184 | for ($i=0; $i<$numshapes;$i++){ |
185 | 185 | $s = $layer->getShape(new resultObj($i)); |
186 | 186 | $vs = array(); |
187 | - $vs[] = $i; | |
188 | 187 | foreach($colunas as $coluna){ |
189 | 188 | if($tipoColuna[$coluna] == "varchar"){ |
190 | 189 | $texto = $s->getValue($layer,$coluna); |
... | ... | @@ -204,6 +203,10 @@ if (isset($_FILES['i3GEOuploadshp']['name'])){ |
204 | 203 | ob_flush(); |
205 | 204 | flush(); |
206 | 205 | sleep(1); |
206 | + if($_POST["incluiserialshp"] == "on"){ | |
207 | + $linhas[] = "alter table ".$_POST["i3GEOuploadesquema"].".".$_POST["tabelaDestino"]." add gid serial CONSTRAINT gid_pkey PRIMARY KEY"; | |
208 | + } | |
209 | + | |
207 | 210 | foreach($sqltabela as $linha){ |
208 | 211 | try { |
209 | 212 | $dbh->query($linha); | ... | ... |