Commit d5d4ad8694422fb563112ce9bd94a58ccb6d1df7
1 parent
8f715a15
Exists in
master
and in
7 other branches
Correção na busca dos layers em um mapfile
Showing
1 changed file
with
14 additions
and
3 deletions
Show diff stats
ogc.php
| ... | ... | @@ -41,6 +41,8 @@ tema - nome do tema do serviço. Se for definido, o web service conterá apenas o |
| 41 | 41 | |
| 42 | 42 | intervalo - valor inicial e final com o número de temas que serão mostrados no serviço |
| 43 | 43 | |
| 44 | +legenda - mostra a legenda no corpo do mapa sim|nao | |
| 45 | + | |
| 44 | 46 | About: Exemplos |
| 45 | 47 | |
| 46 | 48 | ogc.php?lista=temas |
| ... | ... | @@ -119,6 +121,11 @@ if(isset($tema)) |
| 119 | 121 | {$tipo = "";} |
| 120 | 122 | $req->setParameter("VeRsIoN","1.1.0"); |
| 121 | 123 | $oMap = ms_newMapobj("aplicmap/ogcws.map"); |
| 124 | +if((isset($legenda)) && ($legenda == "sim")) | |
| 125 | +{ | |
| 126 | + $leg = $oMap->legend; | |
| 127 | + $leg->set("status",MS_EMBED); | |
| 128 | +} | |
| 122 | 129 | $proto = "http" . ((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == "on") ? "s" : "") . "://"; |
| 123 | 130 | $server = isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : $_SERVER['SERVER_NAME']; |
| 124 | 131 | $or = $proto.$server.$_SERVER['PHP_SELF']; |
| ... | ... | @@ -131,16 +138,20 @@ if (!isset($intervalo)) |
| 131 | 138 | if ($tipo == "") |
| 132 | 139 | { |
| 133 | 140 | $tema = explode(" ",$tema); |
| 134 | - foreach ($tema as $t) | |
| 141 | + foreach ($tema as $tx) | |
| 135 | 142 | { |
| 136 | - $nmap = ms_newMapobj("temas/".$t.".map"); | |
| 143 | + $nmap = ms_newMapobj("temas/".$tx.".map"); | |
| 137 | 144 | $ts = $nmap->getalllayernames(); |
| 138 | 145 | foreach ($ts as $t) |
| 139 | 146 | { |
| 140 | 147 | $l = $nmap->getlayerbyname($t); |
| 141 | 148 | $l->setmetadata("ows_title",pegaNome($l)); |
| 142 | 149 | $l->setmetadata("ows_srs","EPSG:4291 EPSG:4326"); |
| 143 | - $l->set("status",MS_OFF); | |
| 150 | + //essa linha é necessária pq as vezes no mapfile não tem nenhum layer com o nome igual ao nome do mapfile | |
| 151 | + if(count($ts)==1) | |
| 152 | + { | |
| 153 | + $l->set("name",$tx); | |
| 154 | + } | |
| 144 | 155 | $l->setmetadata("gml_include_items","all"); |
| 145 | 156 | $l->set("dump",MS_TRUE); |
| 146 | 157 | $l->setmetadata("WMS_INCLUDE_ITEMS","all"); | ... | ... |