From d80bc604afc111ade59aa32ef2ae202a77b6a59a Mon Sep 17 00:00:00 2001
From: Edmar Moretti
Date: Wed, 4 Sep 2013 04:33:11 +0000
Subject: [PATCH] suporte a TMS em ogc.php
---
exemplos/index.html | 3 +++
interface/googlemapsdebug.phtml | 2 ++
ogc.php | 49 +++++++++++++++++++++++++++++++++++++++++++++----
temas/_lbiomashp.map | 2 +-
temas/_llocali.map | 2 +-
5 files changed, 52 insertions(+), 6 deletions(-)
diff --git a/exemplos/index.html b/exemplos/index.html
index 3d021a4..7097ac2 100644
--- a/exemplos/index.html
+++ b/exemplos/index.html
@@ -240,6 +240,9 @@ body,td {
Guias do tipo
sanfona
+
+ Como adicionar uma camada WMS do i3Geo em um mapa normal do Google Maps
+
Configuração de janelas, árvores de
camadas e adição de temas
diff --git a/interface/googlemapsdebug.phtml b/interface/googlemapsdebug.phtml
index 944d8c5..2b1913d 100644
--- a/interface/googlemapsdebug.phtml
+++ b/interface/googlemapsdebug.phtml
@@ -179,6 +179,8 @@ i3GEO.eventos.MOUSECLIQUEPERM = [i3GEO.configura.funcaoTip];
//alternativo (janela de identificacao
//i3GEO.eventos.MOUSECLIQUEPERM = [i3GEO.configura.funcaoIdentifica];
//
+i3GEO.finalizaAPI = function(){
+};
i3GEO.inicia();
diff --git a/ogc.php b/ogc.php
index 6249978..d4014f0 100644
--- a/ogc.php
+++ b/ogc.php
@@ -76,7 +76,7 @@ if(isset($id_medida_variavel)){
}
if(!isset($temas) && isset($tema)){
$temas = $tema;
-}
+}
//
//para operar como o Geoserver
//
@@ -124,7 +124,7 @@ if(isset($lista) && $lista == "temaswfs"){
}
//
//cria o web service
-//
+//
include(dirname(__FILE__)."/classesphp/funcoes_gerais.php");
error_reporting(0);
$versao = versao();
@@ -474,7 +474,7 @@ else{
}
$oMap->setSymbolSet($locaplic."/symbols/".basename($oMap->symbolsetfilename));
$oMap->setFontSet($locaplic."/symbols/".basename($oMap->fontsetfilename));
- $oMap->save($nomeMapfileTmp);
+ $oMap->save($nomeMapfileTmp);
$oMap = ms_newMapobj($nomeMapfileTmp);
if(ob_get_contents ()){
ob_end_clean();
@@ -488,7 +488,7 @@ else{
//quando for do tipo tms $_GET["tms"] contem os parametros do tile
//essa rotina faz um exit ao final
//o cache tms so fucniona se houver apenas uma camada no mapa
-//tms e usado basicamente por mashup
+//tms e usado basicamente por mashup ou openlayers
//
if(isset($_GET["tms"])){
$temp = explode("/",$_GET["tms"]);
@@ -514,6 +514,47 @@ if(isset($_GET["tms"])){
}
salvaCacheImagem($cachedir,$nomeMapfileTmp,$_GET["tms"]);
}
+//
+//verifica se a chamada do servico e do tipo TILE no padrao do Google
+//
+if(isset($_GET["Z"]) && isset($_GET["X"])){
+ $x = $_GET["X"];
+ $y = $_GET["Y"];
+ $z = $_GET["Z"];
+ if($_GET["cache"] == "sim" && $_GET["DESLIGACACHE"] != "sim"){
+ //carregaCacheImagem();
+ }
+ $n = pow(2,$z);
+ $lon1 = $x / $n * 360.0 - 180.0;
+ $lat2 = rad2deg(atan(sinh(pi() * (1 - 2 * $y / $n))));
+ $x++;
+ $y++;
+ $lon2 = $x / $n * 360.0 - 180.0;
+ $lat1 = rad2deg(atan(sinh(pi() * (1 - 2 * $y / $n))));
+ $x--;
+ $y--;
+
+ $projInObj = ms_newprojectionobj("proj=latlong,a=6378137,b=6378137");
+ $projOutObj = ms_newprojectionobj("proj=merc,a=6378137,b=6378137,lat_ts=0.0,lon_0=0.0,x_0=0.0,y_0=0,k=1.0,units=m");
+
+ $poPoint1 = ms_newpointobj();
+ $poPoint1->setXY($lon1, $lat1);
+ $poPoint1->project($projInObj, $projOutObj);
+ $poPoint2 = ms_newpointobj();
+ $poPoint2->setXY($lon2, $lat2);
+ $poPoint2->project($projInObj, $projOutObj);
+ $oMap->setExtent($poPoint1->x,$poPoint1->y,$poPoint2->x,$poPoint2->y);
+ $oMap->setsize(256,256);
+ $oMap->getlayer(0)->set("status",MS_DEFAULT);
+ $oMap->setProjection("proj=merc,a=6378137,b=6378137,lat_ts=0.0,lon_0=0.0,x_0=0.0,y_0=0,k=1.0,units=m");
+ $oMap->getlayer(0)->setProjection("proj=latlong,a=6378137,b=6378137");
+ $oMap->save($nomeMapfileTmp);
+ $img = $oMap->draw();
+ if($img->imagepath == ""){
+ exit;
+ }
+ salvaCacheImagem($cachedir,$nomeMapfileTmp,$_GET["tms"]);
+}
if(strtolower($req->getValueByName("REQUEST")) == "getlegendgraphic"){
$l = $oMap->getlayer(0);
if($req->getValueByName("LAYER") == ""){
diff --git a/temas/_lbiomashp.map b/temas/_lbiomashp.map
index 9c451bb..0ea9f61 100644
--- a/temas/_lbiomashp.map
+++ b/temas/_lbiomashp.map
@@ -21,7 +21,7 @@ MAP
PROCESSING "ITEMS=CD_LEGENDA"
STATUS OFF
TEMPLATE "none.htm"
- MAXSCALEDENOM 5000000
+ #MAXSCALEDENOM 5000000
TILEITEM "location"
OPACITY 50
TYPE POLYGON
diff --git a/temas/_llocali.map b/temas/_llocali.map
index 8016ae3..c9753fa 100644
--- a/temas/_llocali.map
+++ b/temas/_llocali.map
@@ -4,7 +4,7 @@ MAP
LAYER
CONNECTION ""
DATA "/var/www/i3geo/aplicmap/dados/locali.shp"
- FILTER (('[ESTADO]' = 'GO'))
+ #FILTER (('[ESTADO]' = 'GO'))
METADATA
"METAESTAT_ID_MEDIDA_VARIAVEL" ""
"cache" "nao"
--
libgit2 0.21.2