From 2578568e02001a6209fa1e5a02c5c000d2159a19 Mon Sep 17 00:00:00 2001 From: Edmar Moretti Date: Wed, 19 Aug 2009 14:53:06 +0000 Subject: [PATCH] Inclusão de mapfile de testes com banco postgis em UTF-8 --- admin/js/editormapfile.js | 20 +++++++++++--------- aplicmap/estadoslwindows.map | 4 ++-- aplicmap/meumapa.htm | 574 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- exemplos/mashup7.htm | 84 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ imagens/visual/default/sprite.png | Bin 27314 -> 0 bytes kml.php | 45 ++++++++++++++++++++++++--------------------- menutemas/admin.db | Bin 53248 -> 0 bytes ms_criamapa.php | 1 + temas/testeutf8postgis.map | 81 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 9 files changed, 360 insertions(+), 449 deletions(-) create mode 100644 exemplos/mashup7.htm create mode 100644 temas/testeutf8postgis.map diff --git a/admin/js/editormapfile.js b/admin/js/editormapfile.js index 80e6dcd..2401871 100644 --- a/admin/js/editormapfile.js +++ b/admin/js/editormapfile.js @@ -733,9 +733,9 @@ function montaEditorConexao(dados) "linhas":[ {ajuda:"Type of connection. Default is local.", titulo:"Connectiontype",id:"",value:"",div:"
",tipo:"text"}, - {ajuda:"Database connection string to retrieve remote data.An SDE connection string consists of a hostname, instance name, database name, username and password separated by commas.A PostGIS connection string is basically a regular PostgreSQL connection string, it takes the form of 'user=nobody password=****** dbname=dbname host=localhost port=5432' An Oracle connection string: user/pass[@db]", + {ajuda:"Database connection string to retrieve remote data.An SDE connection string consists of a hostname, instance name, database name, username and password separated by commas.A PostGIS connection string is basically a regular PostgreSQL connection string, it takes the form of 'user=nobody password=****** dbname=dbname host=localhost port=5432' An Oracle connection string: user/pass[@db] . Se vc tiver problemas com acentuação, experimente algo como: user=postgres password=postgres dbname=pgutf8 host=localhost port=5432 options='-c client_encoding=LATIN1'", titulo:"Connection",id:"connection",value:dados.connection,tipo:"text"}, - {ajuda:"Full filename of the spatial data to process. No file extension is necessary for shapefiles. Can be specified relative to the SHAPEPATH option from the Map Object.If this is an SDE layer, the parameter should include the name of the layer as well as the geometry column, i.e. 'mylayer,shape,myversion'.If this is a PostGIS layer, the parameter should be in the form of ' from ', where 'columnname' is the name of the column containing the geometry objects and 'tablename' is the name of the table from which the geometry data will be read.For Oracle, use 'shape FROM table' or 'shape FROM (SELECT statement)' or even more complex Oracle compliant queries! Note that there are important performance impacts when using spatial subqueries however. Try using MapServer's FILTER whenever possible instead. You can also see the SQL submitted by forcing an error, for instance by submitting a DATA parameter you know won't work, using for example a bad column name.", + {ajuda:"Full filename of the spatial data to process. No file extension is necessary for shapefiles. Can be specified relative to the SHAPEPATH option from the Map Object.If this is an SDE layer, the parameter should include the name of the layer as well as the geometry column, i.e. 'mylayer,shape,myversion'.If this is a PostGIS layer, the parameter should be in the form of ' from ', where 'columnname' is the name of the column containing the geometry objects and 'tablename' is the name of the table from which the geometry data will be read.For Oracle, use 'shape FROM table' or 'shape FROM (SELECT statement)' or even more complex Oracle compliant queries! Note that there are important performance impacts when using spatial subqueries however. Try using MapServer's FILTER whenever possible instead. You can also see the SQL submitted by forcing an error, for instance by submitting a DATA parameter you know won't work, using for example a bad column name. Exemplo postgis: the_geom FROM (select * FROM biomas) as foo USING UNIQUE gid USING SRID=4291 ", titulo:"Data",id:"data",value:dados.data,tipo:"text"}, {ajuda:"Item that contains the location of an individual tile, default is 'location'.", titulo:"tileitem",id:"tileitem",value:dados.tileitem,tipo:"text"}, @@ -1123,13 +1123,15 @@ function salvarDadosEditor(tipo,codigoMap,codigoLayer,indiceClasse,indiceEstilo, //validação // var valorTeste = $i("extensao").value - var teste1 = valorTeste.split(" "); - if(teste1.length != 4) - {alert("Sao necessarios 4 valores em extensao");return;} - if(teste1[0]*1 > teste1[2]*1) - {alert("xmin maior que xmax em extensao");return;} - if(teste1[1]*1 > teste1[3]*1) - {alert("ymin maior que ymax em extensao");return;} + if(valorTeste != ""){ + var teste1 = valorTeste.split(" "); + if(teste1.length != 4) + {alert("Sao necessarios 4 valores em extensao");return;} + if(teste1[0]*1 > teste1[2]*1) + {alert("xmin maior que xmax em extensao");return;} + if(teste1[1]*1 > teste1[3]*1) + {alert("ymin maior que ymax em extensao");return;} + } var valorTeste = $i("escala").value if(valorTeste != ""){ var teste1 = valorTeste * 1; diff --git a/aplicmap/estadoslwindows.map b/aplicmap/estadoslwindows.map index 8ddb185..c928960 100644 --- a/aplicmap/estadoslwindows.map +++ b/aplicmap/estadoslwindows.map @@ -10,8 +10,8 @@ LAYER ITENS "ESTADO" TIP "ESTADO" ITENSDESC "Estado" - #ITEMIMG "ESTADO" - #IMGLOC "imagens/bandeiras" + ITEMIMG "ESTADO" + IMGLOC "../imagens/bandeiras" TEMA "Limite Estadual" ESCALA "250000" CLASSE "SIM" diff --git a/aplicmap/meumapa.htm b/aplicmap/meumapa.htm index a309027..acb0eb9 100644 --- a/aplicmap/meumapa.htm +++ b/aplicmap/meumapa.htm @@ -9,24 +9,27 @@ Os códigos do i3geo são compactados para tornar o carregamento mais rápido. Se vc alterar os códigos originais, não se esqueça de compactá-los com classesjs/compactajs.php. Para depurar o código sem ter de compactá-los, substitua na linha abaixo - o arquivo i3geo.js por i3geonaocompacto.js + o arquivo i3geo.js por i3geo.js --> - + - -
- + + + + - + + - + @@ -59,6 +64,7 @@ + + @@ -86,8 +93,10 @@
+
@@ -100,118 +109,182 @@ Mostra as coordenadas conforme o mouse é movimentado - + - + + -
+ + +
+ - - + + -
Aguarde...
+ +
Aguarde...
+
+ +
+
+ + + - + + + +geoprocessamento@mma.gov.br -
+ +
+

+ + + + + +
+ + + + \ No newline at end of file diff --git a/exemplos/mashup7.htm b/exemplos/mashup7.htm new file mode 100644 index 0000000..2c31b33 --- /dev/null +++ b/exemplos/mashup7.htm @@ -0,0 +1,84 @@ + + + + + +MMA - Mapa interativo + + + + +
+

Você pode chamar o I3Geo de dentro de uma outra página criando o DIV com id=i3geo

+

Para chamar a página não é necessário rodar o i3geo/ms_criamapa.php.

+

Nem todos os elementos precisam estar no mapa.

+

Você pode esconder ou mudar as ferramentas de lugar.

+

+
+ +
+ +

Este é um exemplo de inclusão do I3Geo dentro de uma página qualquer.

+ + + + + + + + + + + + + + + +Críticas e sugestões +

+ + + + + + \ No newline at end of file diff --git a/imagens/visual/default/sprite.png b/imagens/visual/default/sprite.png index 7d08210..8899b1a 100644 Binary files a/imagens/visual/default/sprite.png and b/imagens/visual/default/sprite.png differ diff --git a/kml.php b/kml.php index c3d6978..b6d0590 100644 --- a/kml.php +++ b/kml.php @@ -78,32 +78,14 @@ if ($menutemas != "" || is_array($menutemas)) $nome = mb_convert_encoding($grupo->GTIPO,"auto","auto"); $desc = mb_convert_encoding($grupo->DTIPO,"auto","auto"); kml_cabecalho($nome,$desc); + foreach($grupo->TEMA as $tema) + {kml_tema($tema);} foreach($grupo->SGRUPO as $sgrupo) { $nome = mb_convert_encoding($sgrupo->SDTIPO,"auto","auto"); kml_folder($nome); foreach($sgrupo->TEMA as $tema) - { - $nome = mb_convert_encoding($tema->TNOME,"auto","auto"); - $desc = mb_convert_encoding($tema->TDESC,"auto","auto"); - $id = mb_convert_encoding($tema->TID,"auto","auto"); - $fonte = mb_convert_encoding($tema->TLINK,"auto","auto"); - $tipoa = ""; - if($tema->TIPOA) - $tipoa = mb_convert_encoding($tema->TIPOA,"auto","auto"); - $ogc = sim; - if($tema->TID) - { - $kml = mb_convert_encoding($tema->KML,"auto","auto"); - } - if(strtolower($kml) != "nao" && strtolower($tipoa) != "wms") - { - $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); - } - } + {kml_tema($tema);} echo "\n"; } echo "\n"; @@ -178,6 +160,27 @@ function kml_folder($nome) echo " \n"; echo " 00\n"; } +function kml_tema($tema) +{ + global $urli3geo; + $nome = mb_convert_encoding($tema->TNOME,"auto","auto"); + $desc = mb_convert_encoding($tema->TDESC,"auto","auto"); + $id = mb_convert_encoding($tema->TID,"auto","auto"); + $fonte = mb_convert_encoding($tema->TLINK,"auto","auto"); + $tipoa = ""; + if($tema->TIPOA) + $tipoa = mb_convert_encoding($tema->TIPOA,"auto","auto"); + $ogc = sim; + if($tema->TID) + {$kml = mb_convert_encoding($tema->KML,"auto","auto");} + if(strtolower($kml) != "nao" && strtolower($tipoa) != "wms") + { + $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); + } +} function kml_servico($nome,$fonte,$legenda,$desc,$href) { echo " \n"; diff --git a/menutemas/admin.db b/menutemas/admin.db index dacdd1f..564194e 100644 Binary files a/menutemas/admin.db and b/menutemas/admin.db differ diff --git a/ms_criamapa.php b/ms_criamapa.php index fe12e28..b203264 100644 --- a/ms_criamapa.php +++ b/ms_criamapa.php @@ -185,6 +185,7 @@ if (!isset($debug)) {error_reporting(0);$debug="nao";} else {error_reporting(E_ALL);$debug="sim";} + /* Define o cookie para o idioma da interface */ diff --git a/temas/testeutf8postgis.map b/temas/testeutf8postgis.map new file mode 100644 index 0000000..89daddd --- /dev/null +++ b/temas/testeutf8postgis.map @@ -0,0 +1,81 @@ +MAP +SYMBOLSET ../symbols/simbolos.sym +FONTSET "../symbols/fontes.txt" + LAYER + CONNECTION "user=postgres password=postgres dbname=pgutf8 host=localhost port=5432 options='-c client_encoding=LATIN1'" + CONNECTIONTYPE POSTGIS + DATA "the_geom FROM (select * FROM biomas) as foo USING UNIQUE gid USING SRID=4291" + METADATA + "CLASSE" "SIM" + "download" "SIM" + "TEMA" "Teste UTF8 Postgis" + END + NAME "testeutf8postgis" + STATUS OFF + TEMPLATE "none.htm" + TYPE POLYGON + UNITS METERS + CLASS + NAME "Pantanal" + EXPRESSION ('[id]'eq'6') + STYLE + ANGLE 360 + COLOR 196 185 103 + OPACITY 100 + SYMBOL 0 + END + END + CLASS + NAME "Pampa" + EXPRESSION ('[id]'eq'5') + STYLE + ANGLE 360 + COLOR 88 104 151 + OPACITY 100 + SYMBOL 0 + END + END + CLASS + NAME "Mata atlântica" + EXPRESSION ('[id]'eq'4') + STYLE + ANGLE 360 + COLOR 26 106 246 + OPACITY 100 + SYMBOL 0 + END + END + CLASS + NAME "Cerrado" + EXPRESSION ('[id]'eq'3') + STYLE + ANGLE 360 + COLOR 192 99 154 + OPACITY 100 + SYMBOL 0 + END + END + CLASS + NAME "Caatinga" + EXPRESSION ('[id]'eq'2') + STYLE + ANGLE 360 + COLOR 150 18 194 + OPACITY 100 + SYMBOL 0 + END + END + CLASS + NAME "Amazônia" + EXPRESSION ('[id]'eq'1') + STYLE + ANGLE 360 + COLOR 155 8 136 + OPACITY 100 + SYMBOL 0 + END + END + END + +END + -- libgit2 0.21.2