From 112cad2deabd6db4df32bbf547dbaa2017a260cf Mon Sep 17 00:00:00 2001
From: Edmar Moretti
Tipo de operação:
' + - '' + '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 :
Inclui uma coluna gid do tipo serial e chave primária com código único
' + '' +
'' +
'' +
diff --git a/admin/menu.html b/admin/menu.html
index 8628b93..bebe866 100644
--- a/admin/menu.html
+++ b/admin/menu.html
@@ -106,12 +106,7 @@
href: "html/estat_fonteinfo.html",
target: "principal"
},{
- label: "Upload de dados para uma variável (para upload de shapefile, utilize o gerenciador de tabelas)",
- type: "text",
- href: "html/estat_uploaddados.html",
- target: "principal"
- },{
- label: "Gerenciador de tabelas de dados estatísticos",
+ label: "Gerenciador de tabelas de dados estatísticos (upload de SHP e CSV)",
type: "text",
href: "html/estat_editor.html",
target: "principal"
@@ -126,6 +121,11 @@
type: "text",
href: "html/subirshapefile.html",
target: "principal"
+ },{
+ label: "Gerenciador de tabelas de dados estatísticos (upload de SHP e CSV)",
+ type: "text",
+ href: "html/estat_editor.html",
+ target: "principal"
}
]},{
label: "Editor de mapfiles",
diff --git a/admin/php/metaestat_uploadshp_submit.php b/admin/php/metaestat_uploadshp_submit.php
index f8af07c..de6eaa8 100755
--- a/admin/php/metaestat_uploadshp_submit.php
+++ b/admin/php/metaestat_uploadshp_submit.php
@@ -147,7 +147,7 @@ if (isset($_FILES['i3GEOuploadshp']['name'])){
//a tabela nao existe e e do tipo create
$sqltabela = array();
if($tabelaExiste == false && $_POST["tipoOperacao"] == "criar"){
- $sql = "CREATE TABLE ".$_POST["i3GEOuploadesquema"].".".$_POST["tabelaDestino"]."(gid integer, the_geom geometry";
+ $sql = "CREATE TABLE ".$_POST["i3GEOuploadesquema"].".".$_POST["tabelaDestino"]."(the_geom geometry";
foreach($colunas as $coluna){
$sql .= ",".strtolower($coluna)." ".$tipoColuna[$coluna];
}
@@ -176,7 +176,7 @@ if (isset($_FILES['i3GEOuploadshp']['name'])){
}
//gera o script para inserir os dados
$linhas = array();
- $insert = "INSERT INTO ".$_POST["i3GEOuploadesquema"].".".$_POST["tabelaDestino"]."( gid,".strtolower(implode(",",$colunas)).",the_geom)";
+ $insert = "INSERT INTO ".$_POST["i3GEOuploadesquema"].".".$_POST["tabelaDestino"]." (".strtolower(implode(",",$colunas)).",the_geom)";
echo "
Preparando inclusão de dados";
ob_flush();
flush();
@@ -184,7 +184,6 @@ if (isset($_FILES['i3GEOuploadshp']['name'])){
for ($i=0; $i<$numshapes;$i++){
$s = $layer->getShape(new resultObj($i));
$vs = array();
- $vs[] = $i;
foreach($colunas as $coluna){
if($tipoColuna[$coluna] == "varchar"){
$texto = $s->getValue($layer,$coluna);
@@ -204,6 +203,10 @@ if (isset($_FILES['i3GEOuploadshp']['name'])){
ob_flush();
flush();
sleep(1);
+ if($_POST["incluiserialshp"] == "on"){
+ $linhas[] = "alter table ".$_POST["i3GEOuploadesquema"].".".$_POST["tabelaDestino"]." add gid serial CONSTRAINT gid_pkey PRIMARY KEY";
+ }
+
foreach($sqltabela as $linha){
try {
$dbh->query($linha);
--
libgit2 0.21.2