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,12 +527,13 @@ i3GEOadmin.editor = { | ||
527 | i3GEOadmin.editor.tabela.optionsTabela + | 527 | i3GEOadmin.editor.tabela.optionsTabela + |
528 | '</select></p>' + | 528 | '</select></p>' + |
529 | '<p class="paragrafo" >Tipo de operação:</p>' + | 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 | '<option value=criar >Criar a tabela nova e incluir registros do SHP</option>' + | 531 | '<option value=criar >Criar a tabela nova e incluir registros do SHP</option>' + |
532 | '<option value=incluir >Adicionar novos registros</option>' + | 532 | '<option value=incluir >Adicionar novos registros</option>' + |
533 | '<option value=apagar >Apagar dados atuais e incluir do SHP</option>' + | 533 | '<option value=apagar >Apagar dados atuais e incluir do SHP</option>' + |
534 | '</select></p>' + | 534 | '</select></p>' + |
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>' + | 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 | '<p class="paragrafo" ><input id=i3GEOuploadsubmit type="button" value="Enviar" size=12 />' + | 537 | '<p class="paragrafo" ><input id=i3GEOuploadsubmit type="button" value="Enviar" size=12 />' + |
537 | '<input type="hidden" name="MAX_FILE_SIZE" value="1000000">' + | 538 | '<input type="hidden" name="MAX_FILE_SIZE" value="1000000">' + |
538 | '<input type="hidden" id="i3GEOuploadcodigoconexao" name="i3GEOuploadcodigoconexao" value="">' + | 539 | '<input type="hidden" id="i3GEOuploadcodigoconexao" name="i3GEOuploadcodigoconexao" value="">' + |
admin/menu.html
@@ -106,12 +106,7 @@ | @@ -106,12 +106,7 @@ | ||
106 | href: "html/estat_fonteinfo.html", | 106 | href: "html/estat_fonteinfo.html", |
107 | target: "principal" | 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 | type: "text", | 110 | type: "text", |
116 | href: "html/estat_editor.html", | 111 | href: "html/estat_editor.html", |
117 | target: "principal" | 112 | target: "principal" |
@@ -126,6 +121,11 @@ | @@ -126,6 +121,11 @@ | ||
126 | type: "text", | 121 | type: "text", |
127 | href: "html/subirshapefile.html", | 122 | href: "html/subirshapefile.html", |
128 | target: "principal" | 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 | label: "Editor de mapfiles", | 131 | label: "Editor de mapfiles", |
admin/php/metaestat_uploadshp_submit.php
@@ -147,7 +147,7 @@ if (isset($_FILES['i3GEOuploadshp']['name'])){ | @@ -147,7 +147,7 @@ if (isset($_FILES['i3GEOuploadshp']['name'])){ | ||
147 | //a tabela nao existe e e do tipo create | 147 | //a tabela nao existe e e do tipo create |
148 | $sqltabela = array(); | 148 | $sqltabela = array(); |
149 | if($tabelaExiste == false && $_POST["tipoOperacao"] == "criar"){ | 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 | foreach($colunas as $coluna){ | 151 | foreach($colunas as $coluna){ |
152 | $sql .= ",".strtolower($coluna)." ".$tipoColuna[$coluna]; | 152 | $sql .= ",".strtolower($coluna)." ".$tipoColuna[$coluna]; |
153 | } | 153 | } |
@@ -176,7 +176,7 @@ if (isset($_FILES['i3GEOuploadshp']['name'])){ | @@ -176,7 +176,7 @@ if (isset($_FILES['i3GEOuploadshp']['name'])){ | ||
176 | } | 176 | } |
177 | //gera o script para inserir os dados | 177 | //gera o script para inserir os dados |
178 | $linhas = array(); | 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 | echo "<br>Preparando inclusão de dados"; | 180 | echo "<br>Preparando inclusão de dados"; |
181 | ob_flush(); | 181 | ob_flush(); |
182 | flush(); | 182 | flush(); |
@@ -184,7 +184,6 @@ if (isset($_FILES['i3GEOuploadshp']['name'])){ | @@ -184,7 +184,6 @@ if (isset($_FILES['i3GEOuploadshp']['name'])){ | ||
184 | for ($i=0; $i<$numshapes;$i++){ | 184 | for ($i=0; $i<$numshapes;$i++){ |
185 | $s = $layer->getShape(new resultObj($i)); | 185 | $s = $layer->getShape(new resultObj($i)); |
186 | $vs = array(); | 186 | $vs = array(); |
187 | - $vs[] = $i; | ||
188 | foreach($colunas as $coluna){ | 187 | foreach($colunas as $coluna){ |
189 | if($tipoColuna[$coluna] == "varchar"){ | 188 | if($tipoColuna[$coluna] == "varchar"){ |
190 | $texto = $s->getValue($layer,$coluna); | 189 | $texto = $s->getValue($layer,$coluna); |
@@ -204,6 +203,10 @@ if (isset($_FILES['i3GEOuploadshp']['name'])){ | @@ -204,6 +203,10 @@ if (isset($_FILES['i3GEOuploadshp']['name'])){ | ||
204 | ob_flush(); | 203 | ob_flush(); |
205 | flush(); | 204 | flush(); |
206 | sleep(1); | 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 | foreach($sqltabela as $linha){ | 210 | foreach($sqltabela as $linha){ |
208 | try { | 211 | try { |
209 | $dbh->query($linha); | 212 | $dbh->query($linha); |