Commit acf33bfa9365216e2fca1f78c08fe25f36dd098e
1 parent
808d9f76
Exists in
master
and in
7 other branches
Inclusão de opção para gerar arquivo CSV sem a geometria
Showing
3 changed files
with
17 additions
and
12 deletions
Show diff stats
admin/admin.db
No preview for this file type
ogc.htm
@@ -201,6 +201,8 @@ A:hover { | @@ -201,6 +201,8 @@ A:hover { | ||
201 | ins += | 201 | ins += |
202 | "<p><a target=blank href='"+servico+"OUTPUTFORMAT=csv&bbox=-76.5125927,-39.3925675209,-29.5851853,9.49014852081&service=wfs&version=1.1.0&request=getfeature&layers="+tema+"&typeName="+tema+"' />download CSV via WFS</a>"; | 202 | "<p><a target=blank href='"+servico+"OUTPUTFORMAT=csv&bbox=-76.5125927,-39.3925675209,-29.5851853,9.49014852081&service=wfs&version=1.1.0&request=getfeature&layers="+tema+"&typeName="+tema+"' />download CSV via WFS</a>"; |
203 | ins += | 203 | ins += |
204 | + "<p><a target=blank href='"+servico+"OUTPUTFORMAT=csv&bbox=-76.5125927,-39.3925675209,-29.5851853,9.49014852081&service=wfs&version=1.1.0&request=getfeature&layers="+tema+"&typeName="+tema+"&ows_geomtype=none' />download CSV via WFS mas sem a geometria</a>"; | ||
205 | + ins += | ||
204 | "<p><a target=blank href='"+servico+"OUTPUTFORMAT=kmz&bbox=-76.5125927,-39.3925675209,-29.5851853,9.49014852081&service=wfs&version=1.1.0&request=getfeature&layers="+tema+"&typeName="+tema+"' />download KMZ</a>"; | 206 | "<p><a target=blank href='"+servico+"OUTPUTFORMAT=kmz&bbox=-76.5125927,-39.3925675209,-29.5851853,9.49014852081&service=wfs&version=1.1.0&request=getfeature&layers="+tema+"&typeName="+tema+"' />download KMZ</a>"; |
205 | ins += | 207 | ins += |
206 | "<p><a target=blank href='"+servico+"OUTPUTFORMAT=geojson&bbox=-76.5125927,-39.3925675209,-29.5851853,9.49014852081&service=wfs&version=1.1.0&request=getfeature&layers="+tema+"&typeName="+tema+"' />GeoJson</a>"; | 208 | "<p><a target=blank href='"+servico+"OUTPUTFORMAT=geojson&bbox=-76.5125927,-39.3925675209,-29.5851853,9.49014852081&service=wfs&version=1.1.0&request=getfeature&layers="+tema+"&typeName="+tema+"' />GeoJson</a>"; |
ogc.php
@@ -38,8 +38,6 @@ ajuda - (opcional) mostra uma ajuda ao usu&aacute;rio | @@ -38,8 +38,6 @@ ajuda - (opcional) mostra uma ajuda ao usu&aacute;rio | ||
38 | 38 | ||
39 | tema - (opcional) nome do tema que será mostrado no serviço. Se for definido, o web service conterá apenas esse tema. O tema é o nome do mapfile existente em i3geo/temas, mas pode ser especificado um mapfile existente em outra pasta. Nesse caso, deve-se especificar o caminho completo para o arquivo. Se não for definido, serão considerados todos os temas | 39 | tema - (opcional) nome do tema que será mostrado no serviço. Se for definido, o web service conterá apenas esse tema. O tema é o nome do mapfile existente em i3geo/temas, mas pode ser especificado um mapfile existente em outra pasta. Nesse caso, deve-se especificar o caminho completo para o arquivo. Se não for definido, serão considerados todos os temas |
40 | 40 | ||
41 | -intervalo - (opcional) valor inicial e final com o número de temas que serão mostrados no serviço | ||
42 | - | ||
43 | legenda - (opcional) mostra a legenda no corpo do mapa sim|nao | 41 | legenda - (opcional) mostra a legenda no corpo do mapa sim|nao |
44 | 42 | ||
45 | perfil - (opcional) perfil utilizado para restringir os temas que serão mostrados | 43 | perfil - (opcional) perfil utilizado para restringir os temas que serão mostrados |
@@ -50,6 +48,9 @@ Na gera&ccedil;&atilde;o da legenda pode ser utilizado text/html para gerar no f | @@ -50,6 +48,9 @@ Na gera&ccedil;&atilde;o da legenda pode ser utilizado text/html para gerar no f | ||
50 | 48 | ||
51 | OUTPUTFORMAT - em getfeature, aceita também shape-zip para download de shapefile e csv para download de csv compactado | 49 | OUTPUTFORMAT - em getfeature, aceita também shape-zip para download de shapefile e csv para download de csv compactado |
52 | 50 | ||
51 | +ows_geomtype - permite definir o tipo de geometria conforme utilizado pelo parametro GEOMETRY do OGR (veja http://gdal.org/drv_csv.html) | ||
52 | +afeta o OUTPUTFORMAT csv. Utilize &ows_geomtype=none para obter um csv sem a coluna geometry | ||
53 | + | ||
53 | id_medida_variavel - id da medida de variavel - utilizado apenas quando a fonte para definicao do layer for o sistema de metadados estatisticos | 54 | id_medida_variavel - id da medida de variavel - utilizado apenas quando a fonte para definicao do layer for o sistema de metadados estatisticos |
54 | nao deve ser utilizado junto com tema | 55 | nao deve ser utilizado junto com tema |
55 | 56 | ||
@@ -75,7 +76,6 @@ ogc.php?tema=bioma | @@ -75,7 +76,6 @@ ogc.php?tema=bioma | ||
75 | 76 | ||
76 | ogc.php?tema=/var/www/i3geo/aplicmap/geral1debianv6.map&layers=mundo | 77 | ogc.php?tema=/var/www/i3geo/aplicmap/geral1debianv6.map&layers=mundo |
77 | 78 | ||
78 | -ogc.php?intervalo=0,50 | ||
79 | */ | 79 | */ |
80 | $_GET = array_merge($_GET,$_POST); | 80 | $_GET = array_merge($_GET,$_POST); |
81 | // | 81 | // |
@@ -854,12 +854,13 @@ if(strtolower($OUTPUTFORMAT) == "shape-zip"){ | @@ -854,12 +854,13 @@ if(strtolower($OUTPUTFORMAT) == "shape-zip"){ | ||
854 | exit; | 854 | exit; |
855 | } | 855 | } |
856 | if(strtolower($OUTPUTFORMAT) == "csv"){ | 856 | if(strtolower($OUTPUTFORMAT) == "csv"){ |
857 | + ms_iostripstdoutbuffercontentheaders(); | ||
857 | //grava em disco | 858 | //grava em disco |
858 | - $arq = $dir_tmp."/".$tema.".csv"; | 859 | + $arq = $dir_tmp."/".$tema.$ows_geomtype.".csv"; |
859 | $contents = ms_iogetstdoutbufferstring(); | 860 | $contents = ms_iogetstdoutbufferstring(); |
860 | file_put_contents($arq,$contents); | 861 | file_put_contents($arq,$contents); |
861 | //envia para download | 862 | //envia para download |
862 | - header('Content-Disposition: attachment; filename='.$tema.'.csv'); | 863 | + header('Content-Disposition: attachment; filename='.$tema.$ows_geomtype.'.csv'); |
863 | header("Content-type: text/csv"); | 864 | header("Content-type: text/csv"); |
864 | ms_iogetStdoutBufferBytes(); | 865 | ms_iogetStdoutBufferBytes(); |
865 | ms_ioresethandlers(); | 866 | ms_ioresethandlers(); |
@@ -1066,7 +1067,6 @@ function renderNocacheTms(){ | @@ -1066,7 +1067,6 @@ function renderNocacheTms(){ | ||
1066 | imagepng($imgc,$nomer); | 1067 | imagepng($imgc,$nomer); |
1067 | } | 1068 | } |
1068 | if($i3georendermode == 0 || !isset($i3georendermode)){ | 1069 | if($i3georendermode == 0 || !isset($i3georendermode)){ |
1069 | - | ||
1070 | header('Content-Length: '.filesize($nomer)); | 1070 | header('Content-Length: '.filesize($nomer)); |
1071 | header('Content-Type: image/png'); | 1071 | header('Content-Type: image/png'); |
1072 | header('Cache-Control: max-age=3600, must-revalidate'); | 1072 | header('Cache-Control: max-age=3600, must-revalidate'); |
@@ -1128,7 +1128,7 @@ function getfeatureinfoJson(){ | @@ -1128,7 +1128,7 @@ function getfeatureinfoJson(){ | ||
1128 | echo $json; | 1128 | echo $json; |
1129 | } | 1129 | } |
1130 | function processaOutputformatMapfile(){ | 1130 | function processaOutputformatMapfile(){ |
1131 | - global $OUTPUTFORMAT, $oMap, $tema; | 1131 | + global $OUTPUTFORMAT, $oMap, $tema, $ows_geomtype; |
1132 | if(strtolower($OUTPUTFORMAT) == "shape-zip"){ | 1132 | if(strtolower($OUTPUTFORMAT) == "shape-zip"){ |
1133 | $l = $oMap->getlayer(0); | 1133 | $l = $oMap->getlayer(0); |
1134 | $n = $l->name; | 1134 | $n = $l->name; |
@@ -1143,8 +1143,11 @@ function processaOutputformatMapfile(){ | @@ -1143,8 +1143,11 @@ function processaOutputformatMapfile(){ | ||
1143 | $n = $l->name."-csv"; | 1143 | $n = $l->name."-csv"; |
1144 | $oMap->selectOutputFormat("csv"); | 1144 | $oMap->selectOutputFormat("csv"); |
1145 | $oMap->outputformat->setOption("STORAGE", "filesystem"); | 1145 | $oMap->outputformat->setOption("STORAGE", "filesystem"); |
1146 | - $oMap->outputformat->setOption("FILENAME", $tema.".csv"); | ||
1147 | - $oMap->outputformat->setOption("FORM", "simple"); | 1146 | + $oMap->outputformat->setOption("FILENAME", $tema.$ows_geomtype.".csv"); |
1147 | + $oMap->outputformat->setOption("FORM", "simple"); | ||
1148 | + if(isset($ows_geomtype) && $ows_geomtype != ""){ | ||
1149 | + $oMap->outputformat->setOption("LCO:GEOMETRY", $ows_geomtype); | ||
1150 | + } | ||
1148 | $l->setmetadata("wfs_getfeature_formatlist","csv"); | 1151 | $l->setmetadata("wfs_getfeature_formatlist","csv"); |
1149 | } | 1152 | } |
1150 | if(strtolower($OUTPUTFORMAT) == "geojson" || strtolower($OUTPUTFORMAT) == "json"){ | 1153 | if(strtolower($OUTPUTFORMAT) == "geojson" || strtolower($OUTPUTFORMAT) == "json"){ |
@@ -1154,7 +1157,7 @@ function processaOutputformatMapfile(){ | @@ -1154,7 +1157,7 @@ function processaOutputformatMapfile(){ | ||
1154 | } | 1157 | } |
1155 | } | 1158 | } |
1156 | function carregaCacheArquivo(){ | 1159 | function carregaCacheArquivo(){ |
1157 | - global $dir_tmp, $tema, $OUTPUTFORMAT; | 1160 | + global $dir_tmp, $tema, $OUTPUTFORMAT, $ows_geomtype; |
1158 | if(strtolower($OUTPUTFORMAT) == "shape-zip"){ | 1161 | if(strtolower($OUTPUTFORMAT) == "shape-zip"){ |
1159 | $arq = $dir_tmp."/".$tema."_shapefile.zip"; | 1162 | $arq = $dir_tmp."/".$tema."_shapefile.zip"; |
1160 | if(file_exists($arq)){ | 1163 | if(file_exists($arq)){ |
@@ -1164,9 +1167,9 @@ function carregaCacheArquivo(){ | @@ -1164,9 +1167,9 @@ function carregaCacheArquivo(){ | ||
1164 | } | 1167 | } |
1165 | } | 1168 | } |
1166 | if(strtolower($OUTPUTFORMAT) == "csv"){ | 1169 | if(strtolower($OUTPUTFORMAT) == "csv"){ |
1167 | - $arq = $dir_tmp."/".$tema.".csv"; | 1170 | + $arq = $dir_tmp."/".$tema.$ows_geomtype.".csv"; |
1168 | if(file_exists($arq)){ | 1171 | if(file_exists($arq)){ |
1169 | - header('Content-Disposition: attachment; filename='.$tema.'.csv'); | 1172 | + header('Content-Disposition: attachment; filename='.$tema.$ows_geomtype.'.csv'); |
1170 | header("Content-type: text/csv"); | 1173 | header("Content-type: text/csv"); |
1171 | readfile($arq); | 1174 | readfile($arq); |
1172 | exit; | 1175 | exit; |