diff --git a/aplicmap/ogcwsv6.map b/aplicmap/ogcwsv6.map index a9f1903..ee24a85 100644 --- a/aplicmap/ogcwsv6.map +++ b/aplicmap/ogcwsv6.map @@ -31,6 +31,14 @@ MAP DRIVER 'OGR/ESRI Shapefile' IMAGEMODE FEATURE END + OUTPUTFORMAT + NAME "csv" + DRIVER "OGR/CSV" + #MIMETYPE "text/csv" + FORMATOPTION "LCO:GEOMETRY=AS_WKT" + FORMATOPTION "STORAGE=memory" + #FORMATOPTION "FILENAME=result.csv" + END PROJECTION "+proj=longlat +ellps=GRS67 +no_defs" END diff --git a/classesjs/datadownload.js b/classesjs/datadownload.js index d3f5b0b..01dfe09 100644 --- a/classesjs/datadownload.js +++ b/classesjs/datadownload.js @@ -312,8 +312,9 @@ function mostraDownload(retorno) ins += "Serviço OGC: "+g_locaplic+"/ogc.php?tema="+retorno.tema+"

"; ins += "OGC GetCapabilities

"; ins += "Ver com OpenLayers

"; - ins += "Download com WFS (arquivo compactado incluindo .prj)

"; - + ins += "Download shapefile com WFS (arquivo compactado incluindo .prj)

"; + ins += "Download CSV com WFS (arquivo compactado)

"; + for (var arq=0;arq"+arqs[arq]+"
"; diff --git a/ogc.htm b/ogc.htm index bb0ef20..9a2a113 100644 --- a/ogc.htm +++ b/ogc.htm @@ -94,7 +94,8 @@ function ogc_endereco(botao) ins += "

"; ins += "

testar getmap"; ins += "

visualizar com openLayers"; - ins += "

download via WFS"; + ins += "

download sahpefile via WFS"; + ins += "

download CSV via WFS"; if(!$i("panellistaarquivos")){ YAHOO.namespace("datadownloadLista"); @@ -104,6 +105,7 @@ function ogc_endereco(botao) YAHOO.datadownloadLista.panel.setFooter(""); YAHOO.datadownloadLista.panel.render(document.body); YAHOO.datadownloadLista.panel.center(); + YAHOO.datadownloadLista.panel.cfg.setProperty("y", 100); }; YAHOO.datadownloadLista.panel.setBody(ins); YAHOO.datadownloadLista.panel.show(); diff --git a/ogc.php b/ogc.php index cc03270..42e10c6 100644 --- a/ogc.php +++ b/ogc.php @@ -48,7 +48,7 @@ format - (opcional) pode ser utilizado a opção &format=application abrir o mashup do OpenLayers com as camadas definida em temas. Na geração da legenda pode ser utilizado text/html para gerar no formato html. -OUTPUTFORMAT - em getfeature, aceita também shape-zip para download de shapefile +OUTPUTFORMAT - em getfeature, aceita também shape-zip para download de shapefile e csv para download de csv compactado id_medida_variavel - id da medida de variavel - utilizado apenas quando a fonte para definicao do layer for o sistema de metadados estatisticos nao deve ser utilizado junto com tema @@ -741,6 +741,19 @@ if(isset($OUTPUTFORMAT)){ header('Content-Disposition: attachment; filename='.$n.'.zip'); } } + if(strtolower($OUTPUTFORMAT) == "csv"){ + $l = $oMap->getlayer(0); + $n = $l->name."-csv"; + $oMap->selectOutputFormat("csv"); + $oMap->outputformat->setOption("STORAGE", "memory"); + $oMap->outputformat->setOption("FILENAME", $n.".zip"); + $oMap->outputformat->setOption("FORM", "zip"); + $l->setmetadata("wfs_getfeature_formatlist","csv"); + $oMap->save($nomeMapfileTmp); + if(strtolower($request) != "getcapabilities"){ + header('Content-Disposition: attachment; filename='.$n.'.zip'); + } + } } ms_ioinstallstdouttobuffer(); $oMap->owsdispatch($req); @@ -748,9 +761,10 @@ $contenttype = ms_iostripstdoutbuffercontenttype(); if(strtolower($request) == "getcapabilities"){ header('Content-Disposition: attachment; filename=getcapabilities.xml'); } -//header("Content-type: application/xml"); -header("Content-type: $contenttype"); - + +if(!isset($OUTPUTFORMAT)){ + header("Content-type: $contenttype"); +} $buffer = ms_iogetStdoutBufferBytes(); ms_ioresethandlers(); // -- libgit2 0.21.2