Online Latitude/Longitude Conversion


Data Entry

Convert Decimal Format to Degree Format

West East of Prime Meridian
North South of the Equator

Convert Degree Format to Decimal Format

Enter Longitude: West East of Prime Meridian
Enter Latitude: North South of the Equator

Clear Page


Code:


##########################################################
# LATITUDE/LONGITUDE CONVERSION ROUTINES
#
# Original Source:
# http://www.web-max.ca/PHP/misc_6.php
#
##########################################################
# Convert Degrees Minutes Seconds to 
# Decimal format

function DMStoDEC($deg,$min,$sec) {
    return $deg+((($min*60)+($sec))/3600);
}    

# Convert Decimal Format to Degrees
# Minutes Seconds...

function DECtoDMS($dec) {

    $vars = explode(".",$dec);
    $deg = $vars[0];
    $tempma = "0.".$vars[1];
    
    $tempma = $tempma * 3600;
    $min = floor($tempma / 60);
    $sec = $tempma - ($min*60);
    
    return array("deg"=>$deg,"min"=>$min,"sec"=>$sec);
}


Return to WDWorldMap Site