Commit d80bc604afc111ade59aa32ef2ae202a77b6a59a
1 parent
fbeb4059
Exists in
master
and in
7 other branches
suporte a TMS em ogc.php
Showing
5 changed files
with
52 additions
and
6 deletions
Show diff stats
exemplos/index.html
| ... | ... | @@ -240,6 +240,9 @@ body,td { |
| 240 | 240 | <a href="googlemapssanfona.phtml" target="_blank">Guias do tipo |
| 241 | 241 | sanfona</a> |
| 242 | 242 | </p> |
| 243 | + <p> | |
| 244 | + <a href="googlemapscomogc.php" target="_blank">Como adicionar uma camada WMS do i3Geo em um mapa normal do Google Maps</a> | |
| 245 | + </p> | |
| 243 | 246 | </fieldset> |
| 244 | 247 | <h2>Configuração de janelas, árvores de |
| 245 | 248 | camadas e adição de temas</h2> | ... | ... |
interface/googlemapsdebug.phtml
| ... | ... | @@ -179,6 +179,8 @@ i3GEO.eventos.MOUSECLIQUEPERM = [i3GEO.configura.funcaoTip]; |
| 179 | 179 | //alternativo (janela de identificacao |
| 180 | 180 | //i3GEO.eventos.MOUSECLIQUEPERM = [i3GEO.configura.funcaoIdentifica]; |
| 181 | 181 | // |
| 182 | +i3GEO.finalizaAPI = function(){ | |
| 183 | +}; | |
| 182 | 184 | |
| 183 | 185 | i3GEO.inicia(); |
| 184 | 186 | </script> | ... | ... |
ogc.php
| ... | ... | @@ -76,7 +76,7 @@ if(isset($id_medida_variavel)){ |
| 76 | 76 | } |
| 77 | 77 | if(!isset($temas) && isset($tema)){ |
| 78 | 78 | $temas = $tema; |
| 79 | -} | |
| 79 | +} | |
| 80 | 80 | // |
| 81 | 81 | //para operar como o Geoserver |
| 82 | 82 | // |
| ... | ... | @@ -124,7 +124,7 @@ if(isset($lista) && $lista == "temaswfs"){ |
| 124 | 124 | } |
| 125 | 125 | // |
| 126 | 126 | //cria o web service |
| 127 | -// | |
| 127 | +// | |
| 128 | 128 | include(dirname(__FILE__)."/classesphp/funcoes_gerais.php"); |
| 129 | 129 | error_reporting(0); |
| 130 | 130 | $versao = versao(); |
| ... | ... | @@ -474,7 +474,7 @@ else{ |
| 474 | 474 | } |
| 475 | 475 | $oMap->setSymbolSet($locaplic."/symbols/".basename($oMap->symbolsetfilename)); |
| 476 | 476 | $oMap->setFontSet($locaplic."/symbols/".basename($oMap->fontsetfilename)); |
| 477 | - $oMap->save($nomeMapfileTmp); | |
| 477 | + $oMap->save($nomeMapfileTmp); | |
| 478 | 478 | $oMap = ms_newMapobj($nomeMapfileTmp); |
| 479 | 479 | if(ob_get_contents ()){ |
| 480 | 480 | ob_end_clean(); |
| ... | ... | @@ -488,7 +488,7 @@ else{ |
| 488 | 488 | //quando for do tipo tms $_GET["tms"] contem os parametros do tile |
| 489 | 489 | //essa rotina faz um exit ao final |
| 490 | 490 | //o cache tms so fucniona se houver apenas uma camada no mapa |
| 491 | -//tms e usado basicamente por mashup | |
| 491 | +//tms e usado basicamente por mashup ou openlayers | |
| 492 | 492 | // |
| 493 | 493 | if(isset($_GET["tms"])){ |
| 494 | 494 | $temp = explode("/",$_GET["tms"]); |
| ... | ... | @@ -514,6 +514,47 @@ if(isset($_GET["tms"])){ |
| 514 | 514 | } |
| 515 | 515 | salvaCacheImagem($cachedir,$nomeMapfileTmp,$_GET["tms"]); |
| 516 | 516 | } |
| 517 | +// | |
| 518 | +//verifica se a chamada do servico e do tipo TILE no padrao do Google | |
| 519 | +// | |
| 520 | +if(isset($_GET["Z"]) && isset($_GET["X"])){ | |
| 521 | + $x = $_GET["X"]; | |
| 522 | + $y = $_GET["Y"]; | |
| 523 | + $z = $_GET["Z"]; | |
| 524 | + if($_GET["cache"] == "sim" && $_GET["DESLIGACACHE"] != "sim"){ | |
| 525 | + //carregaCacheImagem(); | |
| 526 | + } | |
| 527 | + $n = pow(2,$z); | |
| 528 | + $lon1 = $x / $n * 360.0 - 180.0; | |
| 529 | + $lat2 = rad2deg(atan(sinh(pi() * (1 - 2 * $y / $n)))); | |
| 530 | + $x++; | |
| 531 | + $y++; | |
| 532 | + $lon2 = $x / $n * 360.0 - 180.0; | |
| 533 | + $lat1 = rad2deg(atan(sinh(pi() * (1 - 2 * $y / $n)))); | |
| 534 | + $x--; | |
| 535 | + $y--; | |
| 536 | + | |
| 537 | + $projInObj = ms_newprojectionobj("proj=latlong,a=6378137,b=6378137"); | |
| 538 | + $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"); | |
| 539 | + | |
| 540 | + $poPoint1 = ms_newpointobj(); | |
| 541 | + $poPoint1->setXY($lon1, $lat1); | |
| 542 | + $poPoint1->project($projInObj, $projOutObj); | |
| 543 | + $poPoint2 = ms_newpointobj(); | |
| 544 | + $poPoint2->setXY($lon2, $lat2); | |
| 545 | + $poPoint2->project($projInObj, $projOutObj); | |
| 546 | + $oMap->setExtent($poPoint1->x,$poPoint1->y,$poPoint2->x,$poPoint2->y); | |
| 547 | + $oMap->setsize(256,256); | |
| 548 | + $oMap->getlayer(0)->set("status",MS_DEFAULT); | |
| 549 | + $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"); | |
| 550 | + $oMap->getlayer(0)->setProjection("proj=latlong,a=6378137,b=6378137"); | |
| 551 | + $oMap->save($nomeMapfileTmp); | |
| 552 | + $img = $oMap->draw(); | |
| 553 | + if($img->imagepath == ""){ | |
| 554 | + exit; | |
| 555 | + } | |
| 556 | + salvaCacheImagem($cachedir,$nomeMapfileTmp,$_GET["tms"]); | |
| 557 | +} | |
| 517 | 558 | if(strtolower($req->getValueByName("REQUEST")) == "getlegendgraphic"){ |
| 518 | 559 | $l = $oMap->getlayer(0); |
| 519 | 560 | if($req->getValueByName("LAYER") == ""){ | ... | ... |
temas/_lbiomashp.map
temas/_llocali.map