Commit f71eb48e9124a4d2ed237e7ef9139f2be3af3055
1 parent
41111c91
Exists in
master
and in
7 other branches
Inclusão do outputformat CSV nas interfaces ogc.htm e datadownload.htm
Showing
4 changed files
with
32 additions
and
7 deletions
Show diff stats
aplicmap/ogcwsv6.map
... | ... | @@ -31,6 +31,14 @@ MAP |
31 | 31 | DRIVER 'OGR/ESRI Shapefile' |
32 | 32 | IMAGEMODE FEATURE |
33 | 33 | END |
34 | + OUTPUTFORMAT | |
35 | + NAME "csv" | |
36 | + DRIVER "OGR/CSV" | |
37 | + #MIMETYPE "text/csv" | |
38 | + FORMATOPTION "LCO:GEOMETRY=AS_WKT" | |
39 | + FORMATOPTION "STORAGE=memory" | |
40 | + #FORMATOPTION "FILENAME=result.csv" | |
41 | + END | |
34 | 42 | PROJECTION |
35 | 43 | "+proj=longlat +ellps=GRS67 +no_defs" |
36 | 44 | END | ... | ... |
classesjs/datadownload.js
... | ... | @@ -312,8 +312,9 @@ function mostraDownload(retorno) |
312 | 312 | ins += "Serviço OGC: "+g_locaplic+"/ogc.php?tema="+retorno.tema+"<br><br>"; |
313 | 313 | ins += "<a href='"+g_locaplic+"/ogc.php?tema="+retorno.tema+"&SERVICE=WMS&VERSION=1.1.0&REQUEST=GetCapabilities' target=blank >OGC GetCapabilities</a><br><br>"; |
314 | 314 | ins += "<a href='"+g_locaplic+"/ogc.php?tema="+retorno.tema+"&SERVICE=WMS&VERSION=1.1.0&format=application/openlayers&bbox=-76.5125927,-39.3925675209,-29.5851853,9.49014852081' target=blank >Ver com OpenLayers</a><br><br>"; |
315 | - ins += "<a href='"+g_locaplic+"/ogc.php?tema="+retorno.tema+"&SERVICE=WFS&VERSION=1.1.0&request=getfeature&OUTPUTFORMAT=shape-zip' target=blank >Download com WFS (arquivo compactado incluindo .prj)</a><br><br>"; | |
316 | - | |
315 | + ins += "<a href='"+g_locaplic+"/ogc.php?tema="+retorno.tema+"&SERVICE=WFS&VERSION=1.1.0&request=getfeature&OUTPUTFORMAT=shape-zip' target=blank >Download shapefile com WFS (arquivo compactado incluindo .prj)</a><br><br>"; | |
316 | + ins += "<a href='"+g_locaplic+"/ogc.php?tema="+retorno.tema+"&SERVICE=WFS&VERSION=1.1.0&request=getfeature&OUTPUTFORMAT=csv' target=blank >Download CSV com WFS (arquivo compactado)</a><br><br>"; | |
317 | + | |
317 | 318 | for (var arq=0;arq<n;arq++) |
318 | 319 | { |
319 | 320 | ins += "<a href='"+window.location.protocol+"//"+window.location.host+"/"+arqs[arq]+"'>"+arqs[arq]+"</a><br>"; | ... | ... |
ogc.htm
... | ... | @@ -94,7 +94,8 @@ function ogc_endereco(botao) |
94 | 94 | ins += "<p><iframe src='http://www.facebook.com/plugins/like.php?href="+servico+"&layout=button_count&show_faces=false&width=100&action=like&colorscheme=light&height=21' scrolling='no' frameborder='0' style='border:none; overflow:hidden; width:100px; height:21px;' allowTransparency='true'></iframe>"; |
95 | 95 | ins += "<p><a target=blank href='"+servico+"&SRS=EPSG:4618&WIDTH=500&HEIGHT=500&BBOX=-76.5125927,-39.3925675209,-29.5851853,9.49014852081&FORMAT=image/png&service=wms&version=1.1.0&request=getmap&layers="+tema+"' />testar getmap</a>"; |
96 | 96 | ins += "<p><a target=blank href='"+servico+"&format=application/openlayers&bbox=-76.5125927,-39.3925675209,-29.5851853,9.49014852081' />visualizar com openLayers</a>"; |
97 | - ins += "<p><a target=blank href='"+servico+"&OUTPUTFORMAT=shape-zip&bbox=-76.5125927,-39.3925675209,-29.5851853,9.49014852081&service=wfs&version=1.1.0&request=getfeature&layers="+tema+"' />download via WFS</a>"; | |
97 | + ins += "<p><a target=blank href='"+servico+"&OUTPUTFORMAT=shape-zip&bbox=-76.5125927,-39.3925675209,-29.5851853,9.49014852081&service=wfs&version=1.1.0&request=getfeature&layers="+tema+"' />download sahpefile via WFS</a>"; | |
98 | + ins += "<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+"' />download CSV via WFS</a>"; | |
98 | 99 | |
99 | 100 | if(!$i("panellistaarquivos")){ |
100 | 101 | YAHOO.namespace("datadownloadLista"); |
... | ... | @@ -104,6 +105,7 @@ function ogc_endereco(botao) |
104 | 105 | YAHOO.datadownloadLista.panel.setFooter(""); |
105 | 106 | YAHOO.datadownloadLista.panel.render(document.body); |
106 | 107 | YAHOO.datadownloadLista.panel.center(); |
108 | + YAHOO.datadownloadLista.panel.cfg.setProperty("y", 100); | |
107 | 109 | }; |
108 | 110 | YAHOO.datadownloadLista.panel.setBody(ins); |
109 | 111 | YAHOO.datadownloadLista.panel.show(); | ... | ... |
ogc.php
... | ... | @@ -48,7 +48,7 @@ format - (opcional) pode ser utilizado a op&ccedil;&atilde;o &format=application |
48 | 48 | abrir o mashup do OpenLayers com as camadas definida em temas. |
49 | 49 | Na geração da legenda pode ser utilizado text/html para gerar no formato html. |
50 | 50 | |
51 | -OUTPUTFORMAT - em getfeature, aceita também shape-zip para download de shapefile | |
51 | +OUTPUTFORMAT - em getfeature, aceita também shape-zip para download de shapefile e csv para download de csv compactado | |
52 | 52 | |
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 | 54 | nao deve ser utilizado junto com tema |
... | ... | @@ -741,6 +741,19 @@ if(isset($OUTPUTFORMAT)){ |
741 | 741 | header('Content-Disposition: attachment; filename='.$n.'.zip'); |
742 | 742 | } |
743 | 743 | } |
744 | + if(strtolower($OUTPUTFORMAT) == "csv"){ | |
745 | + $l = $oMap->getlayer(0); | |
746 | + $n = $l->name."-csv"; | |
747 | + $oMap->selectOutputFormat("csv"); | |
748 | + $oMap->outputformat->setOption("STORAGE", "memory"); | |
749 | + $oMap->outputformat->setOption("FILENAME", $n.".zip"); | |
750 | + $oMap->outputformat->setOption("FORM", "zip"); | |
751 | + $l->setmetadata("wfs_getfeature_formatlist","csv"); | |
752 | + $oMap->save($nomeMapfileTmp); | |
753 | + if(strtolower($request) != "getcapabilities"){ | |
754 | + header('Content-Disposition: attachment; filename='.$n.'.zip'); | |
755 | + } | |
756 | + } | |
744 | 757 | } |
745 | 758 | ms_ioinstallstdouttobuffer(); |
746 | 759 | $oMap->owsdispatch($req); |
... | ... | @@ -748,9 +761,10 @@ $contenttype = ms_iostripstdoutbuffercontenttype(); |
748 | 761 | if(strtolower($request) == "getcapabilities"){ |
749 | 762 | header('Content-Disposition: attachment; filename=getcapabilities.xml'); |
750 | 763 | } |
751 | -//header("Content-type: application/xml"); | |
752 | -header("Content-type: $contenttype"); | |
753 | - | |
764 | + | |
765 | +if(!isset($OUTPUTFORMAT)){ | |
766 | + header("Content-type: $contenttype"); | |
767 | +} | |
754 | 768 | $buffer = ms_iogetStdoutBufferBytes(); |
755 | 769 | ms_ioresethandlers(); |
756 | 770 | // | ... | ... |