Commit f5643ffe78090950951ec10b4bbe95a0c10a28a4
1 parent
839d0f41
Exists in
master
and in
7 other branches
--no commit message
Showing
1 changed file
with
43 additions
and
18 deletions
Show diff stats
classesphp/funcoes_gerais.php
| ... | ... | @@ -1416,20 +1416,25 @@ function criaSHP($tema,$map_file,$locaplic,$dir_tmp,$nomeRand=TRUE) |
| 1416 | 1416 | $layer->set("template","none.htm"); |
| 1417 | 1417 | $diretorio = dirname($dir_tmp); |
| 1418 | 1418 | $tipol = MS_SHP_POINT; |
| 1419 | - if ($layer->type == MS_LAYER_LINE) | |
| 1420 | - {$tipol = MS_SHP_ARC;} | |
| 1421 | - if ($layer->type == MS_LAYER_POLYGON) | |
| 1422 | - {$tipol = MS_SHP_POLYGON;} | |
| 1423 | - if ($nomeRand == true) | |
| 1424 | - {$novonomelayer = $tema."_".nomeRandomico(5);} | |
| 1425 | - else | |
| 1426 | - {$novonomelayer = $tema;} | |
| 1419 | + if ($layer->type == MS_LAYER_LINE){ | |
| 1420 | + $tipol = MS_SHP_ARC; | |
| 1421 | + } | |
| 1422 | + if ($layer->type == MS_LAYER_POLYGON){ | |
| 1423 | + $tipol = MS_SHP_POLYGON; | |
| 1424 | + } | |
| 1425 | + if ($nomeRand == true){ | |
| 1426 | + $novonomelayer = $tema."_".nomeRandomico(5); | |
| 1427 | + } | |
| 1428 | + else{ | |
| 1429 | + $novonomelayer = $tema; | |
| 1430 | + } | |
| 1427 | 1431 | |
| 1428 | 1432 | $novonomelayer = str_replace(".","-",$novonomelayer); |
| 1429 | 1433 | $nomeshp = $dir_tmp."/".$novonomelayer; |
| 1430 | 1434 | |
| 1431 | - if(file_exists($nomeshp.".shp")) | |
| 1432 | - {return $nomeshp;} | |
| 1435 | + if(file_exists($nomeshp.".shp")){ | |
| 1436 | + return $nomeshp; | |
| 1437 | + } | |
| 1433 | 1438 | |
| 1434 | 1439 | $novoshpf = ms_newShapefileObj($nomeshp, $tipol); |
| 1435 | 1440 | |
| ... | ... | @@ -1536,13 +1541,31 @@ function criaSHP($tema,$map_file,$locaplic,$dir_tmp,$nomeRand=TRUE) |
| 1536 | 1541 | $resultadoFinal = false; |
| 1537 | 1542 | } |
| 1538 | 1543 | } |
| 1539 | - else | |
| 1540 | - {$resultadoFinal = false;} | |
| 1544 | + else{ | |
| 1545 | + $resultadoFinal = false; | |
| 1546 | + } | |
| 1547 | + } | |
| 1548 | + if($resultadoFinal == false){ | |
| 1549 | + return false; | |
| 1550 | + } | |
| 1551 | + else{ | |
| 1552 | + //gera o arquivo prj | |
| 1553 | + /* | |
| 1554 | + if(!file_exists($nomeshp.".prj")){ | |
| 1555 | + $projecao = $layer->getProjection(); | |
| 1556 | + if($projecao == ""){ | |
| 1557 | + $projecao = $map->getProjection(); | |
| 1558 | + } | |
| 1559 | + include($locaplic."/pacotes/proj4php-proj4php5.2/src/proj4php/proj4php.php"); | |
| 1560 | + | |
| 1561 | + $proj4 = new Proj4php(); | |
| 1562 | + $projWGS84 = new Proj4phpProj('EPSG:4326',$proj4); | |
| 1563 | + echo $projWGS84->projection;exit; | |
| 1564 | + | |
| 1565 | + } | |
| 1566 | + */ | |
| 1567 | + return $nomeshp; | |
| 1541 | 1568 | } |
| 1542 | - if($resultadoFinal == false) | |
| 1543 | - {return false;} | |
| 1544 | - else | |
| 1545 | - {return $nomeshp;} | |
| 1546 | 1569 | } |
| 1547 | 1570 | /* |
| 1548 | 1571 | Function: downloadTema (depreciado) |
| ... | ... | @@ -1750,6 +1773,7 @@ function downloadTema2($map_file,$tema,$locaplic,$dir_tmp,$postgis_mapa) |
| 1750 | 1773 | unlink($nomeshp.".dbf"); |
| 1751 | 1774 | unlink($nomeshp.".shp"); |
| 1752 | 1775 | unlink($nomeshp.".shx"); |
| 1776 | + unlink($nomeshp.".prj"); | |
| 1753 | 1777 | } |
| 1754 | 1778 | } |
| 1755 | 1779 | // |
| ... | ... | @@ -1762,8 +1786,9 @@ function downloadTema2($map_file,$tema,$locaplic,$dir_tmp,$postgis_mapa) |
| 1762 | 1786 | // |
| 1763 | 1787 | $nomecopia = $dir_tmp."/".basename($meta); |
| 1764 | 1788 | if(file_exists($meta)){ |
| 1765 | - if(!file_exists($nomecopia)) | |
| 1766 | - {copy($meta,$nomecopia);} | |
| 1789 | + if(!file_exists($nomecopia)){ | |
| 1790 | + copy($meta,$nomecopia); | |
| 1791 | + } | |
| 1767 | 1792 | } |
| 1768 | 1793 | $resultado[] = basename($dir_tmp)."/".basename($nomecopia); |
| 1769 | 1794 | } | ... | ... |