Commit 31cc5e09f696f041d754fe5ad42e4d1cdec5aa36
1 parent
b5067d10
Exists in
master
and in
7 other branches
Resolvido #105 - Parâmetros para iniciar com WMS inserido
Showing
1 changed file
with
46 additions
and
1 deletions
Show diff stats
ms_criamapa.php
... | ... | @@ -84,6 +84,26 @@ debug - ativa o retorno de mensagens de erro do PHP sim|nao |
84 | 84 | idioma - idioma da interface (veja os idiomas disponíveis em classe_idioma.js |
85 | 85 | |
86 | 86 | kmlurl - url de um arquivo KML que será incluido no mapa. Válido apenas na interface google maps |
87 | + | |
88 | +Parâmetros utilizados para adicionar uma camada baseada em um wms | |
89 | + | |
90 | +Testar com http://localhost/i3geo/ms_criamapa.php?url_wms=http://mapas.mma.gov.br/cgi-bin/mapserv?map=/opt/www/html/webservices/biorregioes.map&layer_wms=biomas&style_wms=default&nome_wms=Biomas do Brasil&srs_wms=epsg:4291&image_wms=image/png&versao_wms=1.1.1 | |
91 | + | |
92 | +url_wms - endereço | |
93 | + | |
94 | +layer_wms - nome do layer | |
95 | + | |
96 | +style_wms - estilo do layer | |
97 | + | |
98 | +nome_wms - nome da camada (titulo) | |
99 | + | |
100 | +srs_wms - código da projeção | |
101 | + | |
102 | +image_wms - tipo de imagem disponível | |
103 | + | |
104 | +versao_wms - versão do WMS | |
105 | + | |
106 | + | |
87 | 107 | */ |
88 | 108 | |
89 | 109 | /* |
... | ... | @@ -152,7 +172,7 @@ $tituloInstituicao_ = $tituloInstituicao; |
152 | 172 | $atlasxml_ = $atlasxml; |
153 | 173 | $expoeMapfile_ = $expoeMapfile; |
154 | 174 | $googleApiKey_ = $googleApiKey; |
155 | -$kmlurl_ = $kmlurl; | |
175 | +if(isset($kmlurl)){$kmlurl_ = $kmlurl;} | |
156 | 176 | // |
157 | 177 | //se houver string de conexão para substituição |
158 | 178 | //o modo cgi não irá funcionar |
... | ... | @@ -211,6 +231,7 @@ $_SESSION["tituloInstituicao"] = $tituloInstituicao_; |
211 | 231 | $_SESSION["atlasxml"] = $atlasxml; |
212 | 232 | $_SESSION["expoeMapfile"] = $expoeMapfile; |
213 | 233 | $_SESSION["googleApiKey"] = $googleApiKey_; |
234 | +if(isset($kmlurl_)) | |
214 | 235 | $_SESSION["kmlurl"] = $kmlurl_; |
215 | 236 | //rotina de segurança, ver http://shiflett.org/articles/the-truth-about-sessions |
216 | 237 | $fingerprint = 'I3GEOSEC' . $_SERVER['HTTP_USER_AGENT']; |
... | ... | @@ -432,6 +453,14 @@ Note: Inclui uma camada de polígonos utilizando os parâmetros passados pela URL |
432 | 453 | */ |
433 | 454 | if (isset($poligonos)) |
434 | 455 | {inserePoligonosUrl();} |
456 | +/* | |
457 | +Note: inclui um tema wms se for o caso | |
458 | + | |
459 | +Verifica os parâmetros WMS e adiciona uma camada se for o caso | |
460 | +*/ | |
461 | +if(isset($url_wms)) | |
462 | +{incluiTemaWms();} | |
463 | + | |
435 | 464 | $error = ms_GetErrorObj(); |
436 | 465 | while($error && $error->code != MS_NOERR) |
437 | 466 | { |
... | ... | @@ -439,6 +468,7 @@ while($error && $error->code != MS_NOERR) |
439 | 468 | $error = $error->next(); |
440 | 469 | } |
441 | 470 | ms_ResetErrorList(); |
471 | + | |
442 | 472 | // |
443 | 473 | //se vc quiser parar o script aqui, para verificar erros, descomente a linha abaixo |
444 | 474 | // |
... | ... | @@ -971,4 +1001,19 @@ function inserePoligonosUrl() |
971 | 1001 | $cor->setRGB(255,0,0); |
972 | 1002 | $salvo = $mapa->save($tmpfname); |
973 | 1003 | } |
1004 | +/* | |
1005 | +Function: incluiTemaWms | |
1006 | +*/ | |
1007 | +function incluiTemaWms() | |
1008 | +{ | |
1009 | + global $nome_wms,$url_wms,$layer_wms,$style_wms,$srs_wms,$image_wms,$versao_wms,$tmpfname,$locaplic; | |
1010 | + include_once ($locaplic."/classesphp/classe_mapa.php"); | |
1011 | + if(!$nome_wms) | |
1012 | + {$nome = $layer_wms." ".$style_wms;} | |
1013 | + else | |
1014 | + $nome = $nome_wms; | |
1015 | + $m = new Mapa($tmpfname); | |
1016 | + $m->adicionatemawms($layer_wms,$url_wms,$style_wms,$srs_wms,$image_wms,$locaplic,"",$versao_wms,$nome,"","","","","nao","text/plain",""); | |
1017 | + $salvo = $m->salva($tmpfname); | |
1018 | +} | |
974 | 1019 | ?> |
975 | 1020 | \ No newline at end of file | ... | ... |