From 062f96ac075bd5d0ca59fc7403766a59d16404dd Mon Sep 17 00:00:00 2001 From: Edmar Moretti Date: Wed, 26 Aug 2009 02:12:58 +0000 Subject: [PATCH] Inclusão de uma opção para acesso aos dados no formato vetorial compactado (kmz) --- kml.php | 42 ++++++++++++++++++++++++++++++++++++++---- 1 file changed, 38 insertions(+), 4 deletions(-) diff --git a/kml.php b/kml.php index fd785f0..84c90fc 100644 --- a/kml.php +++ b/kml.php @@ -109,7 +109,7 @@ if($menutemas == "") kml_cabecalho($menu["nome_menu"],$menu["desc_menu"]); $id_menu = $menu["id_menu"]; //raiz - $sql = "select id_raiz,i3geoadmin_raiz.id_tema,nome_tema,tipoa_tema,codigo_tema FROM i3geoadmin_raiz LEFT JOIN i3geoadmin_temas ON i3geoadmin_temas.id_tema = i3geoadmin_raiz.id_tema where (lower(i3geoadmin_temas.tipoa_tema) != 'wms' or i3geoadmin_temas.tipoa_tema isnull) and (lower(i3geoadmin_temas.kml_tema) != 'nao' or i3geoadmin_temas.kml_tema isnull) and i3geoadmin_temas.tipoa_tema != 'WMS' and i3geoadmin_temas.kml_tema != 'nao' and i3geoadmin_raiz.id_menu='$id_menu' and i3geoadmin_raiz.nivel = 0 and i3geoadmin_raiz.id_nivel = 0 order by ordem"; + $sql = "select id_raiz,i3geoadmin_raiz.id_tema,nome_tema,tipoa_tema,codigo_tema,kmz_tema FROM i3geoadmin_raiz LEFT JOIN i3geoadmin_temas ON i3geoadmin_temas.id_tema = i3geoadmin_raiz.id_tema where (lower(i3geoadmin_temas.tipoa_tema) != 'wms' or i3geoadmin_temas.tipoa_tema isnull) and (lower(i3geoadmin_temas.kml_tema) != 'nao' or i3geoadmin_temas.kml_tema isnull) and i3geoadmin_temas.tipoa_tema != 'WMS' and i3geoadmin_temas.kml_tema != 'nao' and i3geoadmin_raiz.id_menu='$id_menu' and i3geoadmin_raiz.nivel = 0 and i3geoadmin_raiz.id_nivel = 0 order by ordem"; $temas = pegaDados($sql); if(count($temas) > 0) { @@ -122,7 +122,7 @@ if($menutemas == "") kml_cabecalho($grupo["nome_grupo"],$grupo["desc_grupo"]); $id_grupo = $grupo["id_grupo"]; //raiz - $sql = "select id_raiz,i3geoadmin_raiz.id_tema,nome_tema,tipoa_tema,kml_tema,codigo_tema FROM i3geoadmin_raiz LEFT JOIN i3geoadmin_temas ON i3geoadmin_temas.id_tema = i3geoadmin_raiz.id_tema where lower(i3geoadmin_temas.tipoa_tema) != 'wms' and lower(i3geoadmin_temas.kml_tema) != 'nao' and i3geoadmin_temas.tipoa_tema != 'WMS' and i3geoadmin_temas.kml_tema != 'nao' and i3geoadmin_raiz.id_menu='$id_menu' and i3geoadmin_raiz.nivel = 1 and i3geoadmin_raiz.id_nivel = ".$grupo["id_n1"]." order by ordem"; + $sql = "select id_raiz,i3geoadmin_raiz.id_tema,nome_tema,tipoa_tema,kml_tema,kmz_tema,codigo_tema FROM i3geoadmin_raiz LEFT JOIN i3geoadmin_temas ON i3geoadmin_temas.id_tema = i3geoadmin_raiz.id_tema where lower(i3geoadmin_temas.tipoa_tema) != 'wms' and lower(i3geoadmin_temas.kml_tema) != 'nao' and i3geoadmin_temas.tipoa_tema != 'WMS' and i3geoadmin_temas.kml_tema != 'nao' and i3geoadmin_raiz.id_menu='$id_menu' and i3geoadmin_raiz.nivel = 1 and i3geoadmin_raiz.id_nivel = ".$grupo["id_n1"]." order by ordem"; $temas = pegaDados($sql); if(count($temas) > 0) { @@ -139,7 +139,7 @@ if($menutemas == "") foreach ($subgrupos as $subgrupo) { $id_n2 = $subgrupo["id_n2"]; - $sql = "select t.codigo_tema,t.nome_tema,t.link_tema, t.desc_tema from i3geoadmin_n3 as n3,i3geoadmin_temas as t where "; + $sql = "select t.codigo_tema,t.nome_tema,t.link_tema, t.desc_tema, t.kmz_tema from i3geoadmin_n3 as n3,i3geoadmin_temas as t where "; $sql .= "n3.id_n2='$id_n2' "; $sql .= "and n3.id_tema = t.id_tema "; $sql .= "and n3_perfil = '' "; @@ -164,14 +164,31 @@ echo "\n"; function kml_tema_bd($tema) { global $urli3geo; + $teste = array_keys($tema); + if(in_array("link_tema",$teste)) $fonte = $tema["link_tema"]; + else + $fonte = ""; + $nome = $tema["nome_tema"]; $id = $tema["codigo_tema"]; + + if(in_array("desc_tema",$teste)) $desc = $tema["desc_tema"]; + else + $desc = ""; + $fonte = "Fonte "; $legenda = "Legenda "; + $href = "$urli3geo/ogc.php?tema=$id&width=800&height=800&VERSION=1.1.1&REQUEST=GetMap&SRS=EPSG:4326&STYLES=&BGCOLOR=0xFFFFFF&FORMAT=image/png&TRANSPARENT=TRUE&layers=$id"; kml_servico($nome,$fonte,$legenda,$desc,$href); + + if(strtolower($tema["kmz_tema"]) != "nao") + { + $href = "$urli3geo/pacotes/kmlmapserver/kmlservice.php?request=kmz&map=$id&typename=$id"; + kml_networklink($nome." (vetorial)",$fonte,$legenda,$desc,$href); + } } function kml_cabecalho($nome,$desc) { @@ -202,8 +219,12 @@ function kml_tema($tema) {$kml = mb_convert_encoding($tema->KML,"auto","auto");} if(strtolower($kml) != "nao" && strtolower($tipoa) != "wms") { + if($fonte != "") $fonte = "Fonte "; - $legenda = "Legenda "; + else + $fonte = ""; + + $legenda = "Legenda "; $href = "$urli3geo/ogc.php?tema=$id&width=800&height=800&VERSION=1.1.1&REQUEST=GetMap&SRS=EPSG:4326&STYLES=&BGCOLOR=0xFFFFFF&FORMAT=image/png&TRANSPARENT=TRUE&layers=$id"; kml_servico($nome,$fonte,$legenda,$desc,$href); } @@ -221,4 +242,17 @@ function kml_servico($nome,$fonte,$legenda,$desc,$href) echo " 9.49014618085-39.3925604735-29.5851853-76.5125927\n"; echo " \n"; } +function kml_networklink($nome,$fonte,$legenda,$desc,$href) +{ + echo " \n"; + echo " ".str_replace("&","&",$nome)."\n"; + echo " \n"; + echo " 0\n"; + echo " \n"; + echo " never\n"; + echo " $href\n"; + echo " \n"; + echo " \n"; +} + ?> \ No newline at end of file -- libgit2 0.21.2