Re: Coordenates latitude / longitude on PHP - SOLVED

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



It wasn't so hard!
I ll post the solution, so everyone ll be able to do it

function getlocationcoords($lat, $lon, $width, $height)
{
$lat=$lat*20; $lon=$lon*28; $x = (($lon + 180) * ($width / 360)); $y = ((($lat * -1) + 90) * ($height / 180));
  return array("x"=>round($x),"y"=>round($y+3500));
}

$lat -> Latitude
$lon -> Longitude
$width -> Image's width (Where u are going to represent the data)
$height -> Image's height (Where u are going to represent the data)


This is the zoom of the data
$lat=$lat*20; $lon=$lon*28; If the data is lo flat (for example), u can fix it writting bigger values on the data that is multiplying.

$x = (($lon + 180) * ($width / 360)); $y = ((($lat * -1) + 90) * ($height / 180));
This translates lat / lon to cardinal data. I found it on the net.


return array("x"=>round($x+VALUEONE),"y"=>round($y+3500));
If u puts the rights values on VALUEONE or 3500, u will be able to center the coordenates on the image.

Done!
:)

By Tk421

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux