Commit f50c8d9cce4ce1f70d890d5829160633f85bd8ab

Authored by Edmar Moretti
1 parent 5455f152

Inclusão das funções de identificação da zona utm de um ponto em coordenadas geo…

…gráficas e conversão de geo para utm
classesphp/funcoes_gerais.php
... ... @@ -1338,6 +1338,47 @@ function xy2wkt($xy)
1338 1338 return array("ponto"=>$shppt->toWkt(),"linha"=>$shplin->toWkt(),"poligono"=>$shppol->toWkt());
1339 1339 }
1340 1340 /*
  1341 +function: geo2zonaUTM
  1342 +
  1343 +Calcula a zona utm de um par de coordenadas geográficas
  1344 +
  1345 +Parameters:
  1346 +
  1347 +$x - longitude
  1348 +
  1349 +*/
  1350 +function geo2zonaUTM($x)
  1351 +{
  1352 + $x = $x + 180;
  1353 + $x = $x / 6;
  1354 + return intval($x) + 1;
  1355 +}
  1356 +/*
  1357 +function: geo2utm
  1358 +
  1359 +Converte coordenadas geográficas para UTM
  1360 +
  1361 +parameters:
  1362 +
  1363 +$x - longitude
  1364 +
  1365 +$y - latitude
  1366 +
  1367 +$zona - zona UTM
  1368 +*/
  1369 +function geo2utm($x,$y,$zona)
  1370 +{
  1371 + $projInObj = ms_newprojectionobj("proj=latlong");
  1372 + if($y < 0){$ns = "south";}
  1373 + else
  1374 + {$ns = "north";}
  1375 + $projOutObj = ms_newprojectionobj("proj=utm,zone=$zona,$ns,ellps=GRS67,units=m,no_defs");
  1376 + $poPoint = ms_newpointobj();
  1377 + $poPoint->setXY($x, $y);
  1378 + $poPoint->project($projInObj, $projOutObj);
  1379 + return array("x"=>$poPoint->x,"y"=>$poPoint->y,"zona"=>$zona);
  1380 +}
  1381 +/*
1341 1382 Section: web services
1342 1383 */
1343 1384 /*
... ...
classesphp/mapa_controle.php
... ... @@ -1889,6 +1889,15 @@ Section: Navegação
1889 1889 Altera a extensão geográfica do mapa.
1890 1890 */
1891 1891 /*
  1892 +Property: geo2utm
  1893 +
  1894 +Retorna coordenadas utm a partir de coordenadas geo
  1895 +*/
  1896 + case "geo2utm":
  1897 + $zona = geo2zonaUTM($x);
  1898 + $cp->set_data(geo2utm($x,$y,$zona));
  1899 + break;
  1900 +/*
1892 1901 Property: desativacgi
1893 1902  
1894 1903 Desativa o modo cgi.
... ...