Commit e1fbe0b10c157415610790ece1b44ac09444cbbe
1 parent
66a9b037
Exists in
master
and in
7 other branches
Inclusão de projeto gvsig no gerador de WMS
Showing
6 changed files
with
57 additions
and
45 deletions
Show diff stats
1017 Bytes
923 Bytes
513 Bytes
1.06 KB
518 Bytes
ogc.php
| ... | ... | @@ -60,20 +60,9 @@ ogc.php?intervalo=0,50 |
| 60 | 60 | //validações e includes |
| 61 | 61 | // |
| 62 | 62 | $cache = true; |
| 63 | -if (!function_exists('ms_GetVersion')) | |
| 64 | -{ | |
| 65 | - if (strtoupper(substr(PHP_OS, 0, 3) == 'WIN')) | |
| 66 | - { | |
| 67 | - if(!@dl('php_mapscript_48.dll')) | |
| 68 | - dl('php_mapscript.dll'); | |
| 69 | - } | |
| 70 | - else | |
| 71 | - {dl('php_mapscript.so');} | |
| 72 | -} | |
| 73 | -require_once("classesphp/carrega_ext.php"); | |
| 74 | -include("ms_configura.php"); | |
| 75 | -include("classesphp/pega_variaveis.php"); | |
| 76 | -//include("classesphp/classe_menutemas.php"); | |
| 63 | +require_once(__DIR__."/classesphp/carrega_ext.php"); | |
| 64 | +include(__DIR__."/ms_configura.php"); | |
| 65 | +include(__DIR__."/classesphp/pega_variaveis.php"); | |
| 77 | 66 | if(!isset($temas) && isset($tema)) |
| 78 | 67 | {$temas = $tema;} |
| 79 | 68 | // |
| ... | ... | @@ -82,7 +71,7 @@ if(!isset($temas) && isset($tema)) |
| 82 | 71 | if(isset($format) && strtolower($format) == "application/openlayers"){ |
| 83 | 72 | if(!isset($layers)) |
| 84 | 73 | {$layers = $temas;} |
| 85 | - $urln = "mashups/openlayers.php?temas=".$layers."&layers=".$layers."&mapext=".$bbox."&botoes=pan,zoombox,zoomtot,identifica"; | |
| 74 | + $urln = __DIR__."/mashups/openlayers.php?temas=".$layers."&layers=".$layers."&mapext=".$bbox."&botoes=pan,zoombox,zoomtot,identifica"; | |
| 86 | 75 | if(!headers_sent()) |
| 87 | 76 | {header("Location:".$urln);} |
| 88 | 77 | else |
| ... | ... | @@ -100,24 +89,22 @@ $urli3geo = str_replace("/ogc.php","",$protocolo.$_SERVER["PHP_SELF"]); |
| 100 | 89 | // |
| 101 | 90 | //imprime na tela a ajuda |
| 102 | 91 | // |
| 103 | -if(isset($ajuda)) | |
| 104 | -{ | |
| 92 | +if(isset($ajuda)){ | |
| 105 | 93 | ogc_imprimeAjuda(); |
| 106 | 94 | exit; |
| 107 | 95 | } |
| 108 | 96 | // |
| 109 | 97 | //imprime na tela a lista de temas disponíveis |
| 110 | 98 | // |
| 111 | -if(isset($lista) && $lista == "temas") | |
| 112 | -{ | |
| 113 | - include_once("classesphp/classe_menutemas.php"); | |
| 99 | +if(isset($lista) && $lista == "temas"){ | |
| 100 | + include_once(__DIR__."/classesphp/classe_menutemas.php"); | |
| 114 | 101 | ogc_imprimeListaDeTemas(); |
| 115 | 102 | exit; |
| 116 | 103 | } |
| 117 | 104 | // |
| 118 | 105 | //cria o web service |
| 119 | 106 | // |
| 120 | -include("classesphp/funcoes_gerais.php"); | |
| 107 | +include(__DIR__."/classesphp/funcoes_gerais.php"); | |
| 121 | 108 | error_reporting(0); |
| 122 | 109 | $versao = versao(); |
| 123 | 110 | $versao = $versao["principal"]; |
| ... | ... | @@ -125,25 +112,26 @@ $req = ms_newowsrequestobj(); |
| 125 | 112 | $tipo = ""; |
| 126 | 113 | $_GET = array_merge($_GET,$_POST); |
| 127 | 114 | |
| 128 | -if(isset($_GET["sld"]) || isset($_GET["filter"])) | |
| 129 | -{$cache = false;} | |
| 130 | -foreach ($_GET as $k=>$v) | |
| 131 | -{ | |
| 115 | +if(isset($_GET["sld"]) || isset($_GET["filter"])){ | |
| 116 | + $cache = false; | |
| 117 | +} | |
| 118 | +foreach ($_GET as $k=>$v){ | |
| 132 | 119 | $req->setParameter($k, $v); |
| 133 | 120 | if(strtolower($v) == "getcapabilities"){ |
| 134 | 121 | $tipo = "metadados"; |
| 135 | 122 | $cache = false; |
| 136 | 123 | } |
| 137 | - if(strtolower($k) == "layers") | |
| 124 | + if(strtolower($k) == "layers" && empty($_GET["tema"])) | |
| 138 | 125 | {$tema = $v;} |
| 139 | - if(strtolower($k) == "layer") | |
| 126 | + if(strtolower($k) == "layer" && empty($_GET["tema"])) | |
| 140 | 127 | {$tema = $v;} |
| 141 | 128 | } |
| 142 | -if(empty($srs)) | |
| 143 | -{$srs = "";} | |
| 144 | -if(!empty($SRS)) | |
| 145 | -{$srs = $SRS;} | |
| 146 | - | |
| 129 | +if(empty($srs)){ | |
| 130 | + $srs = ""; | |
| 131 | +} | |
| 132 | +if(!empty($SRS)){ | |
| 133 | + $srs = $SRS; | |
| 134 | +} | |
| 147 | 135 | $listaepsg = $srs." EPSG:4618 EPSG:4291 EPSG:4326 EPSG:22521 EPSG:22522 EPSG:22523 EPSG:22524 EPSG:22525 EPSG:29101 EPSG:29119 EPSG:29120 EPSG:29121 EPSG:29122 EPSG:29177 EPSG:29178 EPSG:29179 EPSG:29180 EPSG:29181 EPSG:29182 EPSG:29183 EPSG:29184 EPSG:29185"; |
| 148 | 136 | if(count($_GET) == 0){ |
| 149 | 137 | $tipo="intervalo"; |
| ... | ... | @@ -151,16 +139,17 @@ if(count($_GET) == 0){ |
| 151 | 139 | $req->setParameter("SERVICE", "WMS"); |
| 152 | 140 | $cache = false; |
| 153 | 141 | } |
| 154 | -if(isset($tema) && $tipo != "metadados") | |
| 155 | -{$tipo = "";} | |
| 156 | -if(!isset($version)) | |
| 157 | -{$req->setParameter("VeRsIoN","1.1.0");} | |
| 142 | +if(isset($tema) && $tipo != "metadados"){ | |
| 143 | + $tipo = ""; | |
| 144 | +} | |
| 145 | +if(!isset($version)){ | |
| 146 | + $req->setParameter("VeRsIoN","1.1.0"); | |
| 147 | +} | |
| 158 | 148 | $oMap = ms_newMapobj($locaplic."/aplicmap/ogcwsv".$versao.".map"); |
| 159 | 149 | // |
| 160 | 150 | //altera os caminhos das imagens |
| 161 | 151 | // |
| 162 | -if((isset($legenda)) && (strtolower($legenda) == "sim")) | |
| 163 | -{ | |
| 152 | +if((isset($legenda)) && (strtolower($legenda) == "sim")){ | |
| 164 | 153 | $leg = $oMap->legend; |
| 165 | 154 | $leg->set("status",MS_EMBED); |
| 166 | 155 | $cache = false; |
| ... | ... | @@ -168,8 +157,9 @@ if((isset($legenda)) && (strtolower($legenda) == "sim")) |
| 168 | 157 | $proto = "http" . ((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == "on") ? "s" : "") . "://"; |
| 169 | 158 | $server = isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : $_SERVER['SERVER_NAME']; |
| 170 | 159 | $or = $proto.$server.$_SERVER['PHP_SELF']; |
| 171 | -if((isset($tema)) && ($tema != "") && ($tipo=="metadados")) | |
| 172 | -{$or = $or."?tema=".$tema."&";} | |
| 160 | +if((isset($tema)) && ($tema != "") && ($tipo=="metadados")){ | |
| 161 | + $or = $or."?tema=".$tema."&"; | |
| 162 | +} | |
| 173 | 163 | // |
| 174 | 164 | //parametros no nível maior |
| 175 | 165 | // |
| ... | ... | @@ -186,10 +176,12 @@ $oMap->setmetadata("wms_attribution_title",$tituloInstituicao); |
| 186 | 176 | $oMap->setmetadata("ows_enable_request","*"); |
| 187 | 177 | $e = $oMap->extent; |
| 188 | 178 | $extensaoMap = ($e->minx)." ".($e->miny)." ".($e->maxx)." ".($e->maxy); |
| 189 | -if (!isset($intervalo)) | |
| 190 | -{$intervalo = "0,5000";} | |
| 191 | -else | |
| 192 | -{$tipo = "intervalo";} | |
| 179 | +if (!isset($intervalo)){ | |
| 180 | + $intervalo = "0,5000"; | |
| 181 | +} | |
| 182 | +else{ | |
| 183 | + $tipo = "intervalo"; | |
| 184 | +} | |
| 193 | 185 | if(!isset($tema)){ |
| 194 | 186 | if(!isset($intervalo)) |
| 195 | 187 | {$intervalo = "0,5000";} |
| ... | ... | @@ -301,6 +293,7 @@ if ($tipo == "" || $tipo == "metadados"){ |
| 301 | 293 | $oMap = $gm->addLayers($oMap,$gvsigview,$dataView["layerNames"]); |
| 302 | 294 | $numlayers = $oMap->numlayers; |
| 303 | 295 | $layers = array(); |
| 296 | + //$layers[] = "default"; | |
| 304 | 297 | for ($i=0;$i < $numlayers;$i++){ |
| 305 | 298 | $l = $oMap->getlayer($i); |
| 306 | 299 | $l->setmetadata("gml_include_items","all"); |
| ... | ... | @@ -309,10 +302,29 @@ if ($tipo == "" || $tipo == "metadados"){ |
| 309 | 302 | $l->setmetadata("WFS_INCLUDE_ITEMS","all"); |
| 310 | 303 | $l->setmetadata("ows_srs",$listaepsg); |
| 311 | 304 | $l->setmetadata("ows_title",$l->getmetadata("TEMA")); |
| 312 | - $l->set("status",MS_DEFAULT); | |
| 305 | + $l->set("status",MS_OFF); | |
| 313 | 306 | $layers[] = $l->name; |
| 307 | + if(file_exists($locaplic."/temas/miniaturas/".$tx.".map.mini.png")){ | |
| 308 | + $mini = $proto.$server.dirname($_SERVER['PHP_SELF'])."/temas/miniaturas/".$tx.".map.mini.png"; | |
| 309 | + $l->setmetadata("wms_attribution_logourl_format","image/png"); | |
| 310 | + $l->setmetadata("wms_attribution_logourl_height","50"); | |
| 311 | + $l->setmetadata("wms_attribution_logourl_width","50"); | |
| 312 | + $l->setmetadata("wms_attribution_logourl_href",$mini); | |
| 313 | + } | |
| 314 | + if($l->type == MS_LAYER_RASTER && $l->numclasses > 0){ | |
| 315 | + $c = $l->getclass(0); | |
| 316 | + if($c->name == "") | |
| 317 | + {$c->name = " ";} | |
| 318 | + } | |
| 319 | + //inclui extensao geografica | |
| 320 | + $extensao = $l->getmetadata("EXTENSAO"); | |
| 321 | + if($extensao == ""){ | |
| 322 | + $extensao = $extensaoMap; | |
| 323 | + } | |
| 324 | + $l->setmetadata("wms_extent",$extensao); | |
| 314 | 325 | } |
| 315 | 326 | $req->setParameter("LAYERS", implode(",",$layers)); |
| 327 | + $req->setParameter("STYLES", ""); | |
| 316 | 328 | //r_dump($req);exit; |
| 317 | 329 | } |
| 318 | 330 | } | ... | ... |