Commit 11d33b421e6c342cf737213f2db778c9eb03671b
1 parent
b862c837
Exists in
master
and in
7 other branches
validação do tamanho das colunas na função de criação de shapefiles utilizada no download de dados
Showing
1 changed file
with
8 additions
and
2 deletions
Show diff stats
classesphp/funcoes_gerais.php
| @@ -1730,6 +1730,8 @@ function criaSHP($tema,$map_file,$locaplic,$dir_tmp,$nomeRand=TRUE) | @@ -1730,6 +1730,8 @@ function criaSHP($tema,$map_file,$locaplic,$dir_tmp,$nomeRand=TRUE) | ||
| 1730 | else | 1730 | else |
| 1731 | $novonomelayer = $tema; | 1731 | $novonomelayer = $tema; |
| 1732 | 1732 | ||
| 1733 | + //$novonomelayer = str_replace("_","",$novonomelayer); | ||
| 1734 | + | ||
| 1733 | $nomeshp = $dir_tmp."/".$novonomelayer; | 1735 | $nomeshp = $dir_tmp."/".$novonomelayer; |
| 1734 | if(file_exists($nomeshp.".shp")) | 1736 | if(file_exists($nomeshp.".shp")) |
| 1735 | {return $nomeshp;} | 1737 | {return $nomeshp;} |
| @@ -1771,6 +1773,7 @@ function criaSHP($tema,$map_file,$locaplic,$dir_tmp,$nomeRand=TRUE) | @@ -1771,6 +1773,7 @@ function criaSHP($tema,$map_file,$locaplic,$dir_tmp,$nomeRand=TRUE) | ||
| 1771 | foreach ($items as $ni) | 1773 | foreach ($items as $ni) |
| 1772 | { | 1774 | { |
| 1773 | $temp = strtoupper($ni); | 1775 | $temp = strtoupper($ni); |
| 1776 | + $temp = substr($temp,0,9); | ||
| 1774 | // | 1777 | // |
| 1775 | //nao tem como descobrir o tamanho e tipo do campo | 1778 | //nao tem como descobrir o tamanho e tipo do campo |
| 1776 | // | 1779 | // |
| @@ -1801,7 +1804,6 @@ function criaSHP($tema,$map_file,$locaplic,$dir_tmp,$nomeRand=TRUE) | @@ -1801,7 +1804,6 @@ function criaSHP($tema,$map_file,$locaplic,$dir_tmp,$nomeRand=TRUE) | ||
| 1801 | { | 1804 | { |
| 1802 | $sopen = $layer->open(); | 1805 | $sopen = $layer->open(); |
| 1803 | if($sopen == MS_FAILURE){return "erro";} | 1806 | if($sopen == MS_FAILURE){return "erro";} |
| 1804 | - | ||
| 1805 | for ($i = 0; $i < $res_count; ++$i) | 1807 | for ($i = 0; $i < $res_count; ++$i) |
| 1806 | { | 1808 | { |
| 1807 | $result = $layer->getResult($i); | 1809 | $result = $layer->getResult($i); |
| @@ -1809,7 +1811,11 @@ function criaSHP($tema,$map_file,$locaplic,$dir_tmp,$nomeRand=TRUE) | @@ -1809,7 +1811,11 @@ function criaSHP($tema,$map_file,$locaplic,$dir_tmp,$nomeRand=TRUE) | ||
| 1809 | $shape = $layer->getfeature($shp_index,-1); | 1811 | $shape = $layer->getfeature($shp_index,-1); |
| 1810 | foreach ($items as $ni) | 1812 | foreach ($items as $ni) |
| 1811 | { | 1813 | { |
| 1812 | - $reg[] = $shape->values[$ni]; | 1814 | + $vreg = $shape->values[$ni]; |
| 1815 | + if(strlen($vreg) > 255){ | ||
| 1816 | + $vreg = substr($vreg,0,255); | ||
| 1817 | + } | ||
| 1818 | + $reg[] = $vreg; | ||
| 1813 | } | 1819 | } |
| 1814 | $novoshpf->addShape($shape); | 1820 | $novoshpf->addShape($shape); |
| 1815 | if(!function_exists("dbase_create")) | 1821 | if(!function_exists("dbase_create")) |