Commit ee55328ecd387588a061ead4467d62e3a7d7f64c

Authored by Edmar Moretti
1 parent fca2731b

Inclusão do OUTPUTFORMAT shape-zip em ogc.php

Showing 2 changed files with 35 additions and 7 deletions   Show diff stats
aplicmap/ogcwsv6.map
@@ -4,7 +4,7 @@ MAP @@ -4,7 +4,7 @@ MAP
4 SYMBOLSET "../symbols/simbolosv6.sym" 4 SYMBOLSET "../symbols/simbolosv6.sym"
5 IMAGECOLOR 255 255 255 5 IMAGECOLOR 255 255 255
6 IMAGETYPE png 6 IMAGETYPE png
7 -MAXSIZE 10000 7 + MAXSIZE 10000
8 SHAPEPATH "/opt/www/html/geodados" 8 SHAPEPATH "/opt/www/html/geodados"
9 SIZE 450 450 9 SIZE 450 450
10 STATUS ON 10 STATUS ON
@@ -26,6 +26,11 @@ MAXSIZE 10000 @@ -26,6 +26,11 @@ MAXSIZE 10000
26 FORMATOPTION "INTERLACE=OFF" 26 FORMATOPTION "INTERLACE=OFF"
27 TRANSPARENT TRUE 27 TRANSPARENT TRUE
28 END 28 END
  29 + OUTPUTFORMAT
  30 + NAME 'shape-zip'
  31 + DRIVER 'OGR/ESRI Shapefile'
  32 + IMAGEMODE FEATURE
  33 + END
29 PROJECTION 34 PROJECTION
30 "+proj=longlat +ellps=GRS67 +no_defs" 35 "+proj=longlat +ellps=GRS67 +no_defs"
31 END 36 END
@@ -223,6 +223,12 @@ if(isset($_GET["tms"])){ @@ -223,6 +223,12 @@ if(isset($_GET["tms"])){
223 if(isset($_GET["Z"]) && isset($_GET["X"])){ 223 if(isset($_GET["Z"]) && isset($_GET["X"])){
224 $agora .= "google"; 224 $agora .= "google";
225 } 225 }
  226 +//
  227 +//se o outputformat for definido, evita o cahce de arquivo
  228 +//
  229 +if(isset($_GET["OUTPUTFORMAT"])){
  230 + $_GET["DESLIGACACHE"] = "sim";
  231 +}
226 if(isset($_GET["DESLIGACACHE"]) && $_GET["DESLIGACACHE"] == "sim"){ 232 if(isset($_GET["DESLIGACACHE"]) && $_GET["DESLIGACACHE"] == "sim"){
227 $agora = time(); 233 $agora = time();
228 $cache = false; 234 $cache = false;
@@ -331,7 +337,7 @@ else{ @@ -331,7 +337,7 @@ else{
331 carregaCacheImagem($_GET['BBOX'],$tx,$_GET['WIDTH'],$_GET['HEIGHT'],$cachedir); 337 carregaCacheImagem($_GET['BBOX'],$tx,$_GET['WIDTH'],$_GET['HEIGHT'],$cachedir);
332 } 338 }
333 */ 339 */
334 - $l->setmetadata("ows_title",pegaNome($l)); 340 + $l->setmetadata("ows_title",pegaNome($l));
335 $l->setmetadata("ows_srs",$listaepsg); 341 $l->setmetadata("ows_srs",$listaepsg);
336 $l->set("group",""); 342 $l->set("group","");
337 //essa linha é necessária pq as vezes no mapfile não tem nenhum layer com o nome igual ao nome do mapfile 343 //essa linha é necessária pq as vezes no mapfile não tem nenhum layer com o nome igual ao nome do mapfile
@@ -502,8 +508,7 @@ else{ @@ -502,8 +508,7 @@ else{
502 $l->setmetadata("gml_include_items","all"); 508 $l->setmetadata("gml_include_items","all");
503 $l->set("dump",MS_TRUE); 509 $l->set("dump",MS_TRUE);
504 $l->setmetadata("WMS_INCLUDE_ITEMS","all"); 510 $l->setmetadata("WMS_INCLUDE_ITEMS","all");
505 - $l->setmetadata("WFS_INCLUDE_ITEMS","all");  
506 - 511 + $l->setmetadata("WFS_INCLUDE_ITEMS","all");
507 if($l->getmetadata("ows_metadataurl_href") == ""){ 512 if($l->getmetadata("ows_metadataurl_href") == ""){
508 $l->setmetadata("ows_metadataurl_href",$c["fonte"]); 513 $l->setmetadata("ows_metadataurl_href",$c["fonte"]);
509 $l->setmetadata("ows_metadataurl_type","TC211"); 514 $l->setmetadata("ows_metadataurl_type","TC211");
@@ -585,7 +590,7 @@ if(isset($_GET["tms"])){ @@ -585,7 +590,7 @@ if(isset($_GET["tms"])){
585 //echo $lon1." ".$lat1." ".$lon2." ".$lat2;exit; 590 //echo $lon1." ".$lat1." ".$lon2." ".$lat2;exit;
586 $oMap->setsize(256,256); 591 $oMap->setsize(256,256);
587 $oMap->setExtent($lon1,$lat1,$lon2,$lat2); 592 $oMap->setExtent($lon1,$lat1,$lon2,$lat2);
588 - 593 +
589 $layer0->set("status",MS_DEFAULT); 594 $layer0->set("status",MS_DEFAULT);
590 // 595 //
591 //se o layer foi marcado para corte altera os parametros para ampliar o mapa 596 //se o layer foi marcado para corte altera os parametros para ampliar o mapa
@@ -648,7 +653,7 @@ if(isset($_GET["Z"]) && isset($_GET["X"])){ @@ -648,7 +653,7 @@ if(isset($_GET["Z"]) && isset($_GET["X"])){
648 $poPoint2->project($projInObj, $projOutObj); 653 $poPoint2->project($projInObj, $projOutObj);
649 $oMap->setsize(256,256); 654 $oMap->setsize(256,256);
650 $oMap->setExtent($poPoint1->x,$poPoint1->y,$poPoint2->x,$poPoint2->y); 655 $oMap->setExtent($poPoint1->x,$poPoint1->y,$poPoint2->x,$poPoint2->y);
651 - 656 +
652 $oMap->getlayer(0)->set("status",MS_DEFAULT); 657 $oMap->getlayer(0)->set("status",MS_DEFAULT);
653 $oMap->setProjection("proj=merc,a=6378137,b=6378137,lat_ts=0.0,lon_0=0.0,x_0=0.0,y_0=0,k=1.0,units=m"); 658 $oMap->setProjection("proj=merc,a=6378137,b=6378137,lat_ts=0.0,lon_0=0.0,x_0=0.0,y_0=0,k=1.0,units=m");
654 $layer0->setProjection("proj=latlong,a=6378137,b=6378137"); 659 $layer0->setProjection("proj=latlong,a=6378137,b=6378137");
@@ -716,6 +721,24 @@ if(strtolower($req->getValueByName("REQUEST")) == "getfeature"){ @@ -716,6 +721,24 @@ if(strtolower($req->getValueByName("REQUEST")) == "getfeature"){
716 if((isset($legenda)) && (strtolower($legenda) == "sim")){ 721 if((isset($legenda)) && (strtolower($legenda) == "sim")){
717 $leg = $oMap->legend; 722 $leg = $oMap->legend;
718 $leg->set("status",MS_EMBED); 723 $leg->set("status",MS_EMBED);
  724 +}
  725 +//
  726 +//altera o outputformat
  727 +//
  728 +if(isset($OUTPUTFORMAT)){
  729 + if(strtolower($OUTPUTFORMAT) == "shape-zip"){
  730 + $l = $oMap->getlayer(0);
  731 + $n = $l->name.time();
  732 + $oMap->selectOutputFormat("shape-zip");
  733 + $oMap->outputformat->setOption("STORAGE", "memory");
  734 + $oMap->outputformat->setOption("FORM", "zip");
  735 + $oMap->outputformat->setOption("FILENAME", $n.".zip");
  736 + $l->setmetadata("wfs_getfeature_formatlist","shape-zip");
  737 + $oMap->save($nomeMapfileTmp);
  738 + if(strtolower($request) != "getcapabilities"){
  739 + header('Content-Disposition: attachment; filename='.$n.'.zip');
  740 + }
  741 + }
719 } 742 }
720 ms_ioinstallstdouttobuffer(); 743 ms_ioinstallstdouttobuffer();
721 $oMap->owsdispatch($req); 744 $oMap->owsdispatch($req);
@@ -870,7 +893,7 @@ function salvaCacheImagem($cachedir,$map,$tms){ @@ -870,7 +893,7 @@ function salvaCacheImagem($cachedir,$map,$tms){
870 // Fill the image with transparent color 893 // Fill the image with transparent color
871 $color = imagecolorallocatealpha($imgc,0x00,0x00,0x00,127); 894 $color = imagecolorallocatealpha($imgc,0x00,0x00,0x00,127);
872 imagefill($imgc, 0, 0, $color); 895 imagefill($imgc, 0, 0, $color);
873 - 896 +
874 imagecopy($imgc, $img, 0 , 0 , $cortePixels , $cortePixels , 256, 256); 897 imagecopy($imgc, $img, 0 , 0 , $cortePixels , $cortePixels , 256, 256);
875 imagepng($imgc,$nome); 898 imagepng($imgc,$nome);
876 } 899 }