OT: decimal degree conversion

MapServer User mms at GNETCONSULTING.COM
Thu Jan 13 08:46:48 EST 2005


MapServer Users:

I could use some quick help in diagnosing the problem I have with
plotting issues.  I use the following PHP to convert a lat/long
(xx:xx:xx) to decimal degrees.

If anyone could point out the flaws, I would appreciate it.  Some
plot fine.  Others appear to be off.  I'm assuming this is the culprit.

Thanks.

// our plotting function to specify degrees
    function plot_degrees($location) {
        // create an array of our data
        $arrCoords = explode(":", $location);

        // set our data
        $long = $arrCoords[0];
        $longdiv1 = round((($arrCoords[1] / 60) * 100));
        $longdiv2 = round((($arrCoords[2] / 3600) * 100000));

        // create our plotting location
        $plot = $long .= "." . $longdiv1 . $longdiv2;

        // return our appended string
        return $plot;
    }

Joel



More information about the mapserver-users mailing list