Commit 109bc75e04756fc7a3bb61b4398d458ae7ed3550
1 parent
11cab140
Exists in
master
Correção na opção de download de arquivos do tipo imagem
Showing
6 changed files
with
146 additions
and
225 deletions
Show diff stats
admin/admin.db
No preview for this file type
No preview for this file type
classesphp/funcoes_gerais.php
@@ -1751,7 +1751,6 @@ function downloadTema2($map_file, $tema, $locaplic, $dir_tmp, $postgis_mapa) | @@ -1751,7 +1751,6 @@ function downloadTema2($map_file, $tema, $locaplic, $dir_tmp, $postgis_mapa) | ||
1751 | { | 1751 | { |
1752 | ini_set("max_execution_time", "1800"); | 1752 | ini_set("max_execution_time", "1800"); |
1753 | ini_set('memory_limit', '5000M'); | 1753 | ini_set('memory_limit', '5000M'); |
1754 | - $temas = array(); | ||
1755 | if (file_exists($locaplic . "/ms_configura.php")) { | 1754 | if (file_exists($locaplic . "/ms_configura.php")) { |
1756 | include ($locaplic . "/ms_configura.php"); | 1755 | include ($locaplic . "/ms_configura.php"); |
1757 | } else { | 1756 | } else { |
@@ -1767,7 +1766,7 @@ function downloadTema2($map_file, $tema, $locaplic, $dir_tmp, $postgis_mapa) | @@ -1767,7 +1766,7 @@ function downloadTema2($map_file, $tema, $locaplic, $dir_tmp, $postgis_mapa) | ||
1767 | // | 1766 | // |
1768 | $nomeRand = true; | 1767 | $nomeRand = true; |
1769 | $projecao = pegaProjecaoDefault(); | 1768 | $projecao = pegaProjecaoDefault(); |
1770 | - if (($map_file == "") || (! @ms_newMapObj($map_file))) { // a funcao foi chamada do aplicativo datadownload | 1769 | + if (($map_file == "") || (! file_exists($map_file))) { // a funcao foi chamada do aplicativo datadownload |
1771 | if ($base == "" or ! isset($base)) { | 1770 | if ($base == "" or ! isset($base)) { |
1772 | $base = ""; | 1771 | $base = ""; |
1773 | if (strtoupper(substr(PHP_OS, 0, 3) == 'WIN')) { | 1772 | if (strtoupper(substr(PHP_OS, 0, 3) == 'WIN')) { |
@@ -1807,17 +1806,8 @@ function downloadTema2($map_file, $tema, $locaplic, $dir_tmp, $postgis_mapa) | @@ -1807,17 +1806,8 @@ function downloadTema2($map_file, $tema, $locaplic, $dir_tmp, $postgis_mapa) | ||
1807 | $map = ms_newMapObj($map_file); | 1806 | $map = ms_newMapObj($map_file); |
1808 | $rectextent = $map->extent; | 1807 | $rectextent = $map->extent; |
1809 | $extensao = ".map"; | 1808 | $extensao = ".map"; |
1810 | - // | ||
1811 | - // problema aqui | ||
1812 | - // $tema pode ser diferente do nome do mapfile | ||
1813 | - // | ||
1814 | - $teste = @$map->getlayerbyname($tema); | ||
1815 | - // caso o usuario tenha usado caixa alta no nome do layer | ||
1816 | - if ($teste == "") { | ||
1817 | - $teste = @$map->getlayerbyname(strtoupper($tema)); | ||
1818 | - } | ||
1819 | - // se o layer não existir no mapfile, pega da pasta i3geo/temas e adiciona em $map | ||
1820 | - if ($teste == "") { | 1809 | + // se o layer nao existir no mapfile, pega da pasta i3geo/temas e adiciona em $map |
1810 | + if (@$map->getlayerbyname($tema) == "") { | ||
1821 | // tema pode ser o nome de um arquivo mapfile | 1811 | // tema pode ser o nome de um arquivo mapfile |
1822 | if (file_exists($tema . ".map")) { | 1812 | if (file_exists($tema . ".map")) { |
1823 | $maptemp = ms_newMapObj($tema . ".map"); | 1813 | $maptemp = ms_newMapObj($tema . ".map"); |
@@ -1825,240 +1815,166 @@ function downloadTema2($map_file, $tema, $locaplic, $dir_tmp, $postgis_mapa) | @@ -1825,240 +1815,166 @@ function downloadTema2($map_file, $tema, $locaplic, $dir_tmp, $postgis_mapa) | ||
1825 | } else { | 1815 | } else { |
1826 | $maptemp = ms_newMapObj($temasdir . "/" . $tema . ".map"); | 1816 | $maptemp = ms_newMapObj($temasdir . "/" . $tema . ".map"); |
1827 | } | 1817 | } |
1828 | - $numlayers = $maptemp->numlayers; | ||
1829 | - for ($i = 0; $i < $numlayers; ++ $i) { | ||
1830 | - $ll = $maptemp->getlayer($i); | ||
1831 | - $permite = $ll->getmetadata("permitedownload"); | ||
1832 | - if ($permite != "nao") { | ||
1833 | - ms_newLayerObj($map, $ll); | ||
1834 | - } | ||
1835 | - } | ||
1836 | - $teste = @$map->getlayerbyname($tema); | ||
1837 | - if ($teste == "") { | ||
1838 | - $ll = $maptemp->getlayer(0); | ||
1839 | - $permite = $ll->getmetadata("permitedownload"); | ||
1840 | - if ($permite != "nao") { | ||
1841 | - ms_newLayerObj($map, $ll); | ||
1842 | - $tema = $ll->name; | ||
1843 | - } | 1818 | + $ll = $maptemp->getlayer(0); |
1819 | + if($ll->getmetadata("permitedownload") != "nao"){ | ||
1820 | + ms_newLayerObj($map, $ll); | ||
1844 | } | 1821 | } |
1845 | } else { | 1822 | } else { |
1846 | // remove o metadata com um nome de arquivo opcional, pois a função de download pode estar sendo executada da árvore de camadas | 1823 | // remove o metadata com um nome de arquivo opcional, pois a função de download pode estar sendo executada da árvore de camadas |
1847 | $teste = $map->getlayerbyname($tema); | 1824 | $teste = $map->getlayerbyname($tema); |
1848 | $teste->setmetadata("arquivodownload", ""); | 1825 | $teste->setmetadata("arquivodownload", ""); |
1849 | } | 1826 | } |
1850 | - | ||
1851 | - // | ||
1852 | - // salva o mapfile com um outro nome para evitar que o mapa atual, se estiver aberto, seja modificado | ||
1853 | - // | ||
1854 | - // verifica se tem query e copia o arquivo | ||
1855 | - $qyfile = str_replace(".map", "_qy.map", $map_file); | ||
1856 | - $nr = nomerandomico(5); | ||
1857 | - $map_file = str_replace(".map", $nr . "tmp.map", $map_file); | ||
1858 | - if (file_exists($qyfile)) { | ||
1859 | - $nqyfile = str_replace(".map", "_qy.map", $map_file); | ||
1860 | - $nqyfile = str_replace("_qy.map", "", $nqyfile) . "_qy.map"; | ||
1861 | - copy($qyfile, $nqyfile); | ||
1862 | - } | 1827 | + $map_file = str_replace(".map","",$map_file).nomerandomico(5).".map"; |
1863 | $map->save($map_file); | 1828 | $map->save($map_file); |
1864 | - | ||
1865 | - // $map_file agora contem os LAYERS necessários | 1829 | + validaAcessoTemas($map_file); |
1866 | $map = ms_newMapObj($map_file); | 1830 | $map = ms_newMapObj($map_file); |
1867 | substituiConObj($map, $postgis_mapa); | 1831 | substituiConObj($map, $postgis_mapa); |
1868 | $nameMapfile = $map->name; | 1832 | $nameMapfile = $map->name; |
1833 | + $radtmp = dirname($dir_tmp); | ||
1834 | + $nomezip = $dir_tmp . "/" . $nameMapfile . "_" . $tema; | ||
1835 | + $qyfile = str_replace(".map", "_qy.map", $map_file); | ||
1836 | + if(file_exists($qyfile)){ | ||
1837 | + $nomezip = $nomezip . nomerandomico(5); | ||
1838 | + } | ||
1839 | + if(file_exists($nomezip.".zip")){ | ||
1840 | + return array( | ||
1841 | + "tema" => $tema, | ||
1842 | + "mapfile" => "", | ||
1843 | + "mapfileurl" => "", | ||
1844 | + "arquivos" => "", | ||
1845 | + "nreg" => "", | ||
1846 | + "datas" => "", | ||
1847 | + "shape-zip" => $nomezip.".zip" | ||
1848 | + ); | ||
1849 | + } | ||
1850 | + $l = $map->getlayerbyname($tema); | ||
1869 | // | 1851 | // |
1870 | - // verifica se existe mais de um tema (grupo) montando o array com os temas | ||
1871 | - // os grupos podem ter o nome do layer em GROUP ao invés de NAME | 1852 | + // se existir um arquivo já pronto, definido no metadata arquivodownload, irá ser utilizado |
1872 | // | 1853 | // |
1873 | - $multilayer = 0; | ||
1874 | - $grupos = $map->getAllGroupNames(); | ||
1875 | - foreach ($grupos as $grupo) { | ||
1876 | - if ($grupo == $tema) { | ||
1877 | - $multilayer = 1; | ||
1878 | - } | ||
1879 | - } | ||
1880 | - if ($multilayer == 1) { | ||
1881 | - $temasnx = $map->getAllLayerNames(); | ||
1882 | - foreach ($temasnx as $l) { | ||
1883 | - $gl = $map->getlayerbyname($l); | ||
1884 | - $g = $gl->group; | ||
1885 | - if (($g == $tema) || ($l == $tema)) { | ||
1886 | - $temas[] = $l; | ||
1887 | - } | 1854 | + $meta = $l->getmetadata("arquivodownload"); |
1855 | + if ($meta != "") { | ||
1856 | + $meta = str_replace(".zip", "", $meta) . ".zip"; | ||
1857 | + if (file_exists($meta)) { | ||
1858 | + if (! file_exists($nomecopia)) { | ||
1859 | + copy($meta, $nomezip.".zip"); | ||
1888 | } | 1860 | } |
1889 | } | 1861 | } |
1890 | - if ($multilayer == 0) { | ||
1891 | - $temas[] = $tema; | ||
1892 | - } | ||
1893 | - // $temas agora é um array com os NAMEs dos LAYERS que serão baixados | ||
1894 | - $radtmp = dirname($dir_tmp); | 1862 | + return array( |
1863 | + "tema" => $tema, | ||
1864 | + "mapfile" => "", | ||
1865 | + "mapfileurl" => "", | ||
1866 | + "arquivos" => "", | ||
1867 | + "nreg" => "", | ||
1868 | + "datas" => "", | ||
1869 | + "shape-zip" => $nomezip.".zip" | ||
1870 | + ); | ||
1871 | + } | ||
1895 | $ziper = new zipfile(); | 1872 | $ziper = new zipfile(); |
1896 | - foreach ($temas as $tema) { | ||
1897 | - $l = $map->getlayerbyname($tema); | ||
1898 | - $novonomelayer = $tema; | ||
1899 | - // usa o NAME do mapfile para nao gerar arquivos com o mesmo nome em instalacoes multiplas do i3geo | ||
1900 | - $nomeshp = $dir_tmp . "/" . $nameMapfile . "_" . $novonomelayer; | ||
1901 | - if (file_exists($nomeshp . ".dbf")) { | ||
1902 | - // | ||
1903 | - // verifica se o arquivo está vazio ou não | ||
1904 | - // se estiver, apaga o arquivo | ||
1905 | - // | ||
1906 | - $verificaDBF = verificaDBF($nomeshp . ".dbf"); | ||
1907 | - if ($verificaDBF == false) { | ||
1908 | - unlink($nomeshp . ".dbf"); | ||
1909 | - unlink($nomeshp . ".shp"); | ||
1910 | - unlink($nomeshp . ".shx"); | ||
1911 | - unlink($nomeshp . ".prj"); | ||
1912 | - unlink($nomeshp . ".zip"); | ||
1913 | - } | ||
1914 | - } | 1873 | + $zipar = array(); |
1874 | + $novonomelayer = $tema; | ||
1875 | + // usa o NAME do mapfile para nao gerar arquivos com o mesmo nome em instalacoes multiplas do i3geo | ||
1876 | + $nomeshp = $dir_tmp . "/" . $nameMapfile . "_" . $tema; | ||
1877 | + if (file_exists($nomeshp . ".dbf")) { | ||
1915 | // | 1878 | // |
1916 | - // se existir um arquivo já pronto, definido no metadata arquivodownload, irá ser utilizado | 1879 | + // verifica se o arquivo está vazio ou não |
1880 | + // se estiver, apaga o arquivo | ||
1917 | // | 1881 | // |
1918 | - $meta = $l->getmetadata("arquivodownload"); | ||
1919 | - if ($meta != "") { | ||
1920 | - // | ||
1921 | - // se o arquivo não tiver sido copiado | ||
1922 | - // | ||
1923 | - // evita que se tente copiar qualquer arquivo | ||
1924 | - $meta = str_replace(".zip", "", $meta) . ".zip"; | ||
1925 | - $nomecopia = $dir_tmp . "/" . $nameMapfile . "_" . basename($meta); | ||
1926 | - // para evitar que tente copiar um arquivo mapfile | ||
1927 | - $nomecopia = str_replace(".map", "", $nomecopia); | ||
1928 | - $nomecopia = str_replace(".zip", "zip", $nomecopia) . ".zip"; | ||
1929 | - if (file_exists($meta)) { | ||
1930 | - if (! file_exists($nomecopia)) { | ||
1931 | - copy($meta, $nomecopia); | ||
1932 | - } | ||
1933 | - } | ||
1934 | - $resultado[] = basename($dir_tmp) . "/" . basename($nomecopia); | ||
1935 | - } else { // se não existir arquivo definido | ||
1936 | - $dados = $l->data; | ||
1937 | - // | ||
1938 | - // se for imagem, copia o arquivo | ||
1939 | - // | ||
1940 | - if ($l->type == MS_LAYER_RASTER) { | ||
1941 | - if (file_exists($dados)) { | ||
1942 | - $dir = dirname($dados); | ||
1943 | - $arq = explode(".", basename($dados)); | ||
1944 | - $nomecopia = $dir_tmp . "/" . $nameMapfile . "_" . $arq[0]; | ||
1945 | - $exts = array( | ||
1946 | - "jpg", | ||
1947 | - "jpw", | ||
1948 | - "tif", | ||
1949 | - "tifw", | ||
1950 | - "tfw", | ||
1951 | - "png", | ||
1952 | - "pngw", | ||
1953 | - "jpgw", | ||
1954 | - "wld", | ||
1955 | - "img" | ||
1956 | - ); | ||
1957 | - foreach ($exts as $ext) { | ||
1958 | - $copia = $nomecopia . "." . $ext; | ||
1959 | - if (! file_exists($copia) && file_exists($dir . "/" . $arq[0] . "." . $ext)) { | ||
1960 | - copy($dir . "/" . $arq[0] . "." . $ext, $copia); | ||
1961 | - } | ||
1962 | - if (file_exists($copia)) { | ||
1963 | - $resultado[] = basename($dir_tmp) . "/" . basename($copia); | ||
1964 | - } | ||
1965 | - } | ||
1966 | - } else { | ||
1967 | - return "erro"; | ||
1968 | - } | ||
1969 | - } else { // se for vetorial, extrai o arquivo | ||
1970 | - // | ||
1971 | - // verifica se existe selecao, caso contrario, faz a selecao baseada na extensao | ||
1972 | - // do mapfile | ||
1973 | - // | ||
1974 | - include (dirname(__FILE__) . "/../classesphp/classe_selecao.php"); | ||
1975 | - $sel = new Selecao($map_file, $tema); | ||
1976 | - // carrega a query para ver se o layer possui selecao ou nao | ||
1977 | - $numSel = 0; | ||
1978 | - $nomeRand = true; | ||
1979 | - | ||
1980 | - if (file_exists($sel->qyfile)) { | ||
1981 | - $map->loadquery($sel->qyfile); | ||
1982 | - $numSel = $l->getNumresults(); | ||
1983 | - $nomeshp = criaSHP($tema, $map_file, $locaplic, $dir_tmp, $nomeRand, $projecao["prj"]); | ||
1984 | - } | ||
1985 | - // | ||
1986 | - // se nao existir selecao seleciona por box | ||
1987 | - // o box vem do mapfile original | ||
1988 | - // | ||
1989 | - if (! file_exists($sel->qyfile)) { | ||
1990 | - $box = $rectextent->minx . " " . $rectextent->miny . " " . $rectextent->maxx . " " . $rectextent->maxy; | ||
1991 | - $shapesSel = $sel->selecaoBOX("novo", $box, true); | ||
1992 | - // reaproveita arquivo anterior | ||
1993 | - $nomeRand = false; | ||
1994 | - $nomeshp = criaSHP($tema, $map_file, $locaplic, $dir_tmp, $nomeRand, $projecao["prj"], true, $shapesSel); | ||
1995 | - } | ||
1996 | - // remove o arquivo de selecao se ele foi criado apenas para pegar todos os elementos | ||
1997 | - if ($nomeRand == false) { | ||
1998 | - $sel->selecaoLimpa(); | ||
1999 | - } | ||
2000 | - if ($nomeshp == false) { | ||
2001 | - return array( | ||
2002 | - "arquivos" => "<span style=color:red >Ocorreu um erro, tente novamente", | ||
2003 | - "nreg" => 0 | ||
2004 | - ); | ||
2005 | - } | ||
2006 | - $pre = str_replace($radtmp . "/", "", $nomeshp); | ||
2007 | - $resultado[] = $pre . ".shp"; | ||
2008 | - $dataArquivos[] = date("F d Y H:i:s.", filemtime($nomeshp . ".shp")); | ||
2009 | - | ||
2010 | - $resultado[] = $pre . ".shx"; | ||
2011 | - $dataArquivos[] = date("F d Y H:i:s.", filemtime($nomeshp . ".shx")); | ||
2012 | - | ||
2013 | - $resultado[] = $pre . ".dbf"; | ||
2014 | - $dataArquivos[] = date("F d Y H:i:s.", filemtime($nomeshp . ".dbf")); | ||
2015 | - | ||
2016 | - $resultado[] = $pre . ".prj"; | ||
2017 | - $dataArquivos[] = date("F d Y H:i:s.", filemtime($nomeshp . ".prj")); | ||
2018 | - // zipa o arquivo | ||
2019 | - $zip = basename($pre); | ||
2020 | - if (! file_exists($pre . ".zip")) { | ||
2021 | - $ziper->addFile(file_get_contents($nomeshp . ".shp"), $zip . ".shp"); | ||
2022 | - $ziper->addFile(file_get_contents($nomeshp . ".shx"), $zip . ".shx"); | ||
2023 | - $ziper->addFile(file_get_contents($nomeshp . ".dbf"), $zip . ".dbf"); | ||
2024 | - $ziper->addFile(file_get_contents($nomeshp . ".prj"), $zip . ".prj"); | ||
2025 | - $fp = fopen($nomeshp . ".zip", "wb"); | ||
2026 | - fwrite($fp, $ziper->file()); | ||
2027 | - fclose($fp); | ||
2028 | - } | ||
2029 | - $resultado[] = $pre . ".zip"; | ||
2030 | - $dataArquivos[] = date("F d Y H:i:s.", filemtime($nomeshp . ".zip")); | ||
2031 | - } | 1882 | + $verificaDBF = verificaDBF($nomeshp . ".dbf"); |
1883 | + if ($verificaDBF == false) { | ||
1884 | + unlink($nomeshp . ".dbf"); | ||
1885 | + unlink($nomeshp . ".shp"); | ||
1886 | + unlink($nomeshp . ".shx"); | ||
1887 | + unlink($nomeshp . ".prj"); | ||
1888 | + unlink($nomeshp . ".zip"); | ||
2032 | } | 1889 | } |
2033 | } | 1890 | } |
2034 | - $nreg = ""; | ||
2035 | - if (count($resultado) == 3) { | ||
2036 | - $arq = $radtmp . "/" . $resultado[2]; | ||
2037 | - if (function_exists("dbase_open")) { | ||
2038 | - $db = dbase_open($arq, 0); | ||
2039 | - if ($db) { | ||
2040 | - $nreg = dbase_numrecords($db); | 1891 | + $dados = $l->data; |
1892 | + // | ||
1893 | + // se for imagem, copia o arquivo | ||
1894 | + // | ||
1895 | + if ($l->type == MS_LAYER_RASTER) { | ||
1896 | + if (file_exists($dados)) { | ||
1897 | + $dir = dirname($dados); | ||
1898 | + $arq = explode(".", basename($dados))[0]; | ||
1899 | + $nomecopia = $dir_tmp . "/" . $nameMapfile . "_" . $arq; | ||
1900 | + $exts = array( | ||
1901 | + "jpg", | ||
1902 | + "jpw", | ||
1903 | + "tif", | ||
1904 | + "tifw", | ||
1905 | + "tfw", | ||
1906 | + "png", | ||
1907 | + "pngw", | ||
1908 | + "jpgw", | ||
1909 | + "wld", | ||
1910 | + "img" | ||
1911 | + ); | ||
1912 | + foreach ($exts as $ext) { | ||
1913 | + if (file_exists($dir . "/" . $arq . "." . $ext)) { | ||
1914 | + $zipar[] = $dir . "/" . $arq . "." . $ext; | ||
1915 | + } | ||
2041 | } | 1916 | } |
2042 | } else { | 1917 | } else { |
2043 | - $db = xbase_open($arq, 0); | ||
2044 | - if ($db) { | ||
2045 | - $nreg = xbase_numrecords($db); | ||
2046 | - } | 1918 | + return "erro"; |
2047 | } | 1919 | } |
2048 | - } | 1920 | + } else { // se for vetorial, extrai o arquivo |
1921 | + // | ||
1922 | + // verifica se existe selecao, caso contrario, faz a selecao baseada na extensao | ||
1923 | + // do mapfile | ||
1924 | + // | ||
1925 | + include (dirname(__FILE__) . "/../classesphp/classe_selecao.php"); | ||
1926 | + $sel = new Selecao($map_file, $tema); | ||
1927 | + // carrega a query para ver se o layer possui selecao ou nao | ||
1928 | + $numSel = 0; | ||
1929 | + $nomeRand = true; | ||
1930 | + if (file_exists($sel->qyfile)) { | ||
1931 | + $map->loadquery($sel->qyfile); | ||
1932 | + $numSel = $l->getNumresults(); | ||
1933 | + $nomeshp = criaSHP($tema, $map_file, $locaplic, $dir_tmp, $nomeRand, $projecao["prj"]); | ||
1934 | + } | ||
1935 | + // | ||
1936 | + // se nao existir selecao seleciona por box | ||
1937 | + // o box vem do mapfile original | ||
1938 | + // | ||
2049 | 1939 | ||
2050 | - // | ||
2051 | - // gera um mapfile para download | ||
2052 | - // | ||
2053 | - $nomemapfileurl = ""; | 1940 | + if (! file_exists($sel->qyfile)) { |
1941 | + $box = $rectextent->minx . " " . $rectextent->miny . " " . $rectextent->maxx . " " . $rectextent->maxy; | ||
1942 | + $shapesSel = $sel->selecaoBOX("novo", $box, true); | ||
1943 | + // reaproveita arquivo anterior | ||
1944 | + $nomeRand = false; | ||
1945 | + $nomeshp = criaSHP($tema, $map_file, $locaplic, $dir_tmp, $nomeRand, $projecao["prj"], true, $shapesSel); | ||
1946 | + } | ||
1947 | + // remove o arquivo de selecao se ele foi criado apenas para pegar todos os elementos | ||
1948 | + if ($nomeRand == false) { | ||
1949 | + $sel->selecaoLimpa(); | ||
1950 | + } | ||
1951 | + if ($nomeshp == false) { | ||
1952 | + return array( | ||
1953 | + "arquivos" => "<span style=color:red >Ocorreu um erro, tente novamente", | ||
1954 | + "nreg" => 0 | ||
1955 | + ); | ||
1956 | + } | ||
1957 | + $pre = str_replace($radtmp . "/", "", $nomeshp); | ||
1958 | + $zipar[] = $nomeshp . ".shp"; | ||
1959 | + $zipar[] = $nomeshp . ".shx"; | ||
1960 | + $zipar[] = $nomeshp . ".dbf"; | ||
1961 | + $zipar[] = $nomeshp . ".prj"; | ||
1962 | + } | ||
1963 | + foreach($zipar as $z) { | ||
1964 | + $ext = explode(".",$z)[1]; | ||
1965 | + $ziper->addFile(file_get_contents($z), $tema . "." . $ext); | ||
1966 | + } | ||
1967 | + $fp = fopen($nomeshp . ".zip", "wb"); | ||
1968 | + fwrite($fp, $ziper->file()); | ||
1969 | + fclose($fp); | ||
2054 | 1970 | ||
2055 | return array( | 1971 | return array( |
2056 | "tema" => $tema, | 1972 | "tema" => $tema, |
2057 | "mapfile" => "", | 1973 | "mapfile" => "", |
2058 | "mapfileurl" => "", | 1974 | "mapfileurl" => "", |
2059 | - "arquivos" => implode(",", $resultado), | ||
2060 | - "nreg" => $nreg, | ||
2061 | - "datas" => $dataArquivos, | 1975 | + "arquivos" => [], |
1976 | + "nreg" => "", | ||
1977 | + "datas" => [], | ||
2062 | "shape-zip" => $nomeshp . ".zip" | 1978 | "shape-zip" => $nomeshp . ".zip" |
2063 | ); | 1979 | ); |
2064 | } | 1980 | } |
classesphp/mapa_controle.php
@@ -1041,11 +1041,14 @@ switch (strtoupper($funcao)) { | @@ -1041,11 +1041,14 @@ switch (strtoupper($funcao)) { | ||
1041 | * Gera um arquivo para download de um tema. | 1041 | * Gera um arquivo para download de um tema. |
1042 | */ | 1042 | */ |
1043 | case "DOWNLOAD3": | 1043 | case "DOWNLOAD3": |
1044 | + if(isset($_SESSION)){ | ||
1045 | + $map_file = $_SESSION["map_file"]; | ||
1046 | + } | ||
1044 | $retorno = downloadTema2($map_file, $_pg["tema"], $locaplic, $dir_tmp, $postgis_mapa); | 1047 | $retorno = downloadTema2($map_file, $_pg["tema"], $locaplic, $dir_tmp, $postgis_mapa); |
1045 | $retorno["arquivos"] = ""; | 1048 | $retorno["arquivos"] = ""; |
1046 | $retorno["datas"] = ""; | 1049 | $retorno["datas"] = ""; |
1047 | $_SESSION["downloadZipTema"] = $retorno["shape-zip"]; | 1050 | $_SESSION["downloadZipTema"] = $retorno["shape-zip"]; |
1048 | - $retorno["shape-zip"] = ""; | 1051 | + $retorno["shape-zip"] = basename($retorno["shape-zip"]); |
1049 | session_write_close(); | 1052 | session_write_close(); |
1050 | break; | 1053 | break; |
1051 | /* | 1054 | /* |
@@ -1053,7 +1056,7 @@ switch (strtoupper($funcao)) { | @@ -1053,7 +1056,7 @@ switch (strtoupper($funcao)) { | ||
1053 | * | 1056 | * |
1054 | * Gera os arquivos para download de um tema forçando um mapfile vazio. | 1057 | * Gera os arquivos para download de um tema forçando um mapfile vazio. |
1055 | */ | 1058 | */ |
1056 | - case "DOWNLOAD3": | 1059 | + case "DOWNLOAD3x": |
1057 | // caso o tema tenha de vir do sistema de metadados estatisticos | 1060 | // caso o tema tenha de vir do sistema de metadados estatisticos |
1058 | // pode ser uma regiao cadastrada no sistema de metadados | 1061 | // pode ser uma regiao cadastrada no sistema de metadados |
1059 | $tema = $_pg["tema"]; | 1062 | $tema = $_pg["tema"]; |
ogc/templates/templatelinksdownload.php
@@ -3,13 +3,11 @@ | @@ -3,13 +3,11 @@ | ||
3 | <p>{{{linkpagina}}}: <a href="{{{url}}}?temaDownload={{{tema}}}">{{{url}}}?temaDownload={{{tema}}}</a> | 3 | <p>{{{linkpagina}}}: <a href="{{{url}}}?temaDownload={{{tema}}}">{{{url}}}?temaDownload={{{tema}}}</a> |
4 | <p>{{{sld}}}: <a href="{{{sldurl}}}" target="_blank" >{{{sldurl}}}</a> | 4 | <p>{{{sld}}}: <a href="{{{sldurl}}}" target="_blank" >{{{sldurl}}}</a> |
5 | <p><a href="{{{urli3geo}}}/fontetema.php?tema={{{tema}}}" target="_blank" >Metadata</a></p> | 5 | <p><a href="{{{urli3geo}}}/fontetema.php?tema={{{tema}}}" target="_blank" >Metadata</a></p> |
6 | -<p><a target=blank href="{{{servico}}}OUTPUTFORMAT=shape-zip&bbox={{mapext}}&service=wfs&version=1.1.0&request=getfeature&layers={{{tema}}}&typeName={{{tema}}}" >{{{downwfs}}}</a> | 6 | +<p><a target=blank href="{{{servico}}}OUTPUTFORMAT=shape-zip&bbox={{mapext}}&service=wfs&version=1.1.0&request=getfeature&layers={{{tema}}}&typeName={{{tema}}}" >Shape File</a> |
7 | <p><a target=blank href="{{{servico}}}OUTPUTFORMAT=csv&bbox={{mapext}}&service=wfs&version=1.1.0&request=getfeature&layers={{{tema}}}&typeName={{{tema}}}&ows_geomtype=AS_WKT" >{{{downCgeo}}}</a> | 7 | <p><a target=blank href="{{{servico}}}OUTPUTFORMAT=csv&bbox={{mapext}}&service=wfs&version=1.1.0&request=getfeature&layers={{{tema}}}&typeName={{{tema}}}&ows_geomtype=AS_WKT" >{{{downCgeo}}}</a> |
8 | <p><a target=blank href="{{{servico}}}OUTPUTFORMAT=csv&bbox={{mapext}}&service=wfs&version=1.1.0&request=getfeature&layers={{{tema}}}&typeName={{{tema}}}&ows_geomtype=none" >{{{downSgeo}}}</a> | 8 | <p><a target=blank href="{{{servico}}}OUTPUTFORMAT=csv&bbox={{mapext}}&service=wfs&version=1.1.0&request=getfeature&layers={{{tema}}}&typeName={{{tema}}}&ows_geomtype=none" >{{{downSgeo}}}</a> |
9 | <p><a target=blank href="{{{servico}}}OUTPUTFORMAT=kmz&bbox={{mapext}}&service=wfs&version=1.1.0&request=getfeature&layers={{{tema}}}&typeName={{{tema}}}" >{{{kmz}}}</a> | 9 | <p><a target=blank href="{{{servico}}}OUTPUTFORMAT=kmz&bbox={{mapext}}&service=wfs&version=1.1.0&request=getfeature&layers={{{tema}}}&typeName={{{tema}}}" >{{{kmz}}}</a> |
10 | <p><a target=blank href="{{{servico}}}OUTPUTFORMAT=kml&bbox={{mapext}}&service=wfs&version=1.1.0&request=getfeature&layers={{{tema}}}&typeName={{{tema}}}" >{{{kml}}}</a> | 10 | <p><a target=blank href="{{{servico}}}OUTPUTFORMAT=kml&bbox={{mapext}}&service=wfs&version=1.1.0&request=getfeature&layers={{{tema}}}&typeName={{{tema}}}" >{{{kml}}}</a> |
11 | <p><a target=blank href="{{{servico}}}OUTPUTFORMAT=geojson&bbox={{mapext}}&service=wfs&version=1.1.0&request=getfeature&layers={{{tema}}}&typeName={{{tema}}}" >GeoJson</a> | 11 | <p><a target=blank href="{{{servico}}}OUTPUTFORMAT=geojson&bbox={{mapext}}&service=wfs&version=1.1.0&request=getfeature&layers={{{tema}}}&typeName={{{tema}}}" >GeoJson</a> |
12 | <p><a target=blank href="{{{urli3geo}}}/ferramentas/recline/default.php?tema={{{tema}}}" >{{{explore}}}</a> | 12 | <p><a target=blank href="{{{urli3geo}}}/ferramentas/recline/default.php?tema={{{tema}}}" >{{{explore}}}</a> |
13 | -<h4>Shape file</h4> | ||
14 | -{{{shp}}} | ||
15 | </script> | 13 | </script> |
16 | \ No newline at end of file | 14 | \ No newline at end of file |
versao.php
@@ -8,6 +8,10 @@ Utilizado como um include em ms_configura.php | @@ -8,6 +8,10 @@ Utilizado como um include em ms_configura.php | ||
8 | 8 | ||
9 | Alteracoes em relacao a versao 7.0.0 | 9 | Alteracoes em relacao a versao 7.0.0 |
10 | 10 | ||
11 | +- Correção de bug na função de download de temas do tipo Imagem | ||
12 | + | ||
13 | +- Remoção da opção de download individual de arquivos shapefile em prol da opção de download via WFS | ||
14 | + | ||
11 | - Reformulação da página principal | 15 | - Reformulação da página principal |
12 | 16 | ||
13 | - Implementacao de UTFGRID | 17 | - Implementacao de UTFGRID |
@@ -17,5 +21,5 @@ Alteracoes em relacao a versao 7.0.0 | @@ -17,5 +21,5 @@ Alteracoes em relacao a versao 7.0.0 | ||
17 | - Inclusao de funcoes JS nas etiquetas | 21 | - Inclusao de funcoes JS nas etiquetas |
18 | 22 | ||
19 | */ | 23 | */ |
20 | -$mensagemInicia = 'V. 7.0.5'; | 24 | +$mensagemInicia = 'V. 7.0.6'; |
21 | ?> | 25 | ?> |