From f50c8d9cce4ce1f70d890d5829160633f85bd8ab Mon Sep 17 00:00:00 2001 From: Edmar Moretti Date: Fri, 6 Jun 2008 19:34:18 +0000 Subject: [PATCH] Inclusão das funções de identificação da zona utm de um ponto em coordenadas geográficas e conversão de geo para utm --- classesphp/funcoes_gerais.php | 41 +++++++++++++++++++++++++++++++++++++++++ classesphp/mapa_controle.php | 9 +++++++++ 2 files changed, 50 insertions(+), 0 deletions(-) diff --git a/classesphp/funcoes_gerais.php b/classesphp/funcoes_gerais.php index 7994eaa..262ade4 100644 --- a/classesphp/funcoes_gerais.php +++ b/classesphp/funcoes_gerais.php @@ -1338,6 +1338,47 @@ function xy2wkt($xy) return array("ponto"=>$shppt->toWkt(),"linha"=>$shplin->toWkt(),"poligono"=>$shppol->toWkt()); } /* +function: geo2zonaUTM + +Calcula a zona utm de um par de coordenadas geográficas + +Parameters: + +$x - longitude + +*/ +function geo2zonaUTM($x) +{ + $x = $x + 180; + $x = $x / 6; + return intval($x) + 1; +} +/* +function: geo2utm + +Converte coordenadas geográficas para UTM + +parameters: + +$x - longitude + +$y - latitude + +$zona - zona UTM +*/ +function geo2utm($x,$y,$zona) +{ + $projInObj = ms_newprojectionobj("proj=latlong"); + if($y < 0){$ns = "south";} + else + {$ns = "north";} + $projOutObj = ms_newprojectionobj("proj=utm,zone=$zona,$ns,ellps=GRS67,units=m,no_defs"); + $poPoint = ms_newpointobj(); + $poPoint->setXY($x, $y); + $poPoint->project($projInObj, $projOutObj); + return array("x"=>$poPoint->x,"y"=>$poPoint->y,"zona"=>$zona); +} +/* Section: web services */ /* diff --git a/classesphp/mapa_controle.php b/classesphp/mapa_controle.php index 28e1403..7eb6aa9 100644 --- a/classesphp/mapa_controle.php +++ b/classesphp/mapa_controle.php @@ -1889,6 +1889,15 @@ Section: Navegação Altera a extensão geográfica do mapa. */ /* +Property: geo2utm + +Retorna coordenadas utm a partir de coordenadas geo +*/ + case "geo2utm": + $zona = geo2zonaUTM($x); + $cp->set_data(geo2utm($x,$y,$zona)); + break; +/* Property: desativacgi Desativa o modo cgi. -- libgit2 0.21.2