phplatitude-longitudeutm

Open source PHP function for converting UTM coordinates to latitude and longitude?


I'm making a PHP application involving Google Maps. Maps only accepts lat&lng pairs, and the data I want to display comes only with UTM style coordinates. Is there an open-source PHP function to convert from one to the other?

Something like this would be great:

$UTM_ZONE = '32';
$UTMX = '60329834,34';
$UTMY = '67382984,9';

$latlng = convert($UTM_ZONE, $UTMX, $UTMY);

// $latlng = now looks like
// array('lat' => '59.4472917501', 'lng' => '5.3928572425')

Solution

  • I've found sort of a dirty class that does the job. By dirty I mean that the function names are wonky and the code isn't very prettily formatted, but it does indeed do the job.

    I'll be sure to update this answer if I find any better classes