From 9087fa1f3b8af9dfd7ca2403d32c7c189ea59627 Mon Sep 17 00:00:00 2001 From: Edmar Moretti Date: Thu, 14 May 2015 14:03:28 +0000 Subject: [PATCH] Inclusão de info_format json em ogc.php --- .project | 7 +++++++ ogc.php | 70 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++-------------- 2 files changed, 63 insertions(+), 14 deletions(-) diff --git a/.project b/.project index 7d4bb76..8516ede 100644 --- a/.project +++ b/.project @@ -25,6 +25,13 @@ org.eclipse.wst.jsdt.core.jsNature org.eclipse.php.core.PHPNature + + + cesium + 2 + /var/www/i3geo/pacotes/cesium + + 1431135588159 diff --git a/ogc.php b/ogc.php index a6b58f4..25f5f46 100644 --- a/ogc.php +++ b/ogc.php @@ -1,6 +1,6 @@ _filter= - Exemplo de filtro +Exemplo de filtro - http://localhost/i3geo/ogc.php?map_layer__lbiomashp_filter=(('[CD_LEGENDA]'='CAATINGA'))&tema=_lbiomashp&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=_lbiomashp +http://localhost/i3geo/ogc.php?map_layer__lbiomashp_filter=(('[CD_LEGENDA]'='CAATINGA'))&tema=_lbiomashp&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=_lbiomashp - no caso de camadas Postgis basta usar map_layer__lbiomashp_filter=cd_legenda='CAATINGA' +no caso de camadas Postgis basta usar map_layer__lbiomashp_filter=cd_legenda='CAATINGA' Exemplos: @@ -392,8 +392,8 @@ else{ $l->set("status",MS_OFF); } /* - if($cache == true && strtolower($l->getmetadata('cache')) == 'sim' && $tipo == '' && count($tema) == 1){ - carregaCacheImagem($_GET['BBOX'],$tx,$_GET['WIDTH'],$_GET['HEIGHT'],$cachedir); + if($cache == true && strtolower($l->getmetadata('cache')) == 'sim' && $tipo == '' && count($tema) == 1){ + carregaCacheImagem($_GET['BBOX'],$tx,$_GET['WIDTH'],$_GET['HEIGHT'],$cachedir); } */ $l->setmetadata("ows_title",pegaNome($l)); @@ -455,7 +455,7 @@ else{ if(!in_array("POLYLINE_NO_CLIP=True",$pr)){ $l->setprocessing("POLYLINE_NO_CLIP=True"); } - } + } // //verifica se existem parametros de substituicao passados via url // @@ -871,11 +871,50 @@ if(isset($OUTPUTFORMAT)){ } } ms_ioinstallstdouttobuffer(); + //verifica parametro outputformat if(strtolower($req->getValueByName("REQUEST")) == "getmap" && $req->getValueByName("format") == ""){ $req->setParameter("format","image/png"); } -$oMap->owsdispatch($req); + +if(strtolower($req->getValueByName("REQUEST")) == "getfeatureinfo" && $_GET["info_format"] == "application/json"){ + $req->setParameter("info_format","text/plain"); + $oMap->owsdispatch($req); + ms_iostripstdoutbuffercontentheaders(); + ob_clean(); + $r = ms_iogetstdoutbufferstring(); + $t = explode("=",$r); + $n = array(); + if(count($t) > 1){ + $v = str_replace("\\n","",$t[1]); + $v = str_replace("\\r","",$v); + if(trim($v) != ""){ + $va = trim($v); + $coluna = trim(explode(":",$t[0])[2]); + $valor = str_replace("'","",$va); + $n[] = array ( + "type" => "FeatureCollection", + "features" => array( + array( + "type"=>"Feature", + "id" => "", + "geometry" => array(), + "properties" => array( + $coluna => $valor + ), + "geometry_name" => "" + ) + ) + ); + } + } + header("Content-type: application/json"); + echo json_encode($n[0]); + exit; +} + +$oMap->owsdispatch($req); + $contenttype = ms_iostripstdoutbuffercontenttype(); if(strtolower($request) == "getcapabilities"){ header('Content-Disposition: attachment; filename=getcapabilities.xml'); @@ -887,7 +926,8 @@ if(!isset($OUTPUTFORMAT)){ if(strtolower($OUTPUTFORMAT) == "geojson"){ ms_iostripstdoutbuffercontentheaders(); header("Content-type: application/json; subtype=geojson"); -} +} + $buffer = ms_iogetStdoutBufferBytes(); ms_ioresethandlers(); // @@ -1059,7 +1099,9 @@ function nomeRand($n=10) $a = 'azertyuiopqsdfghjklmwxcvbnABCDEFGHIJKLMNOPQRSTUVWXYZ'; $max = 51; for($i=0; $i < $n; ++$i) - {$nomes .= $a{mt_rand(0, $max)};} + { + $nomes .= $a{mt_rand(0, $max)}; + } return $nomes; } function renderNocacheTms(){ @@ -1101,4 +1143,4 @@ function renderNocacheTms(){ header("Content-type: image/png"); } } -?> +?> -- libgit2 0.21.2