Szukam jak najprostszego skryptu na przeliczanie współrzędnych ze Stopni Minut i Sekund na same Stopnie i na odwrót.
Z góry dziękuję.
function DMStoDEC($deg,$min,$sec) { // Converts DMS ( Degrees / minutes / seconds ) // to decimal format longitude / latitude return $deg+((($min*60)+($sec))/3600); } function DECtoDMS($dec) { // Converts decimal longitude / latitude to DMS // ( Degrees / minutes / seconds ) // This is the piece of code which may appear to // be inefficient, but to avoid issues with floating // point math we extract the integer part and the float // part by using a string function. $deg = $vars[0]; $tempma = "0.".$vars[1]; $tempma = $tempma * 3600; $sec = $tempma - ($min*60); }
<style type="text/css"> <!-- #glowny{ width: 500px; margin: 0 auto; padding-left: 20px; border: 1px solid black; -webkit-box-shadow: 7px 7px 5px rgba(50, 50, 50, 0.75); -moz-box-shadow: 7px 7px 5px rgba(50, 50, 50, 0.75); box-shadow: 7px 7px 5px rgba(50, 50, 50, 0.75); } .sub{ margin-left: 80px; } .wynik{ padding-top: 30px; text-align: center; } --> </style> </head> <body> <div id = "glowny"> <h1> Wprowadz współrzędne:</h1> <form action="ws1.php" method="post"> <h2>Stopnie:</h2> <form action="dwa.php" method="post"> <input type="text" name = "deg" size="5"/> ° <h2>Minuty:</h2> <form action="dwa.php" method="post"> <input type="text" name = "min" size="5"/> ' <h2>Sekundy:</h2> <form action="dwa.php" method="post"> <input type="text" name = "sec" size="5"/> " <input type="submit" class="sub" value="Przelicz"/> </form> </div> <p style=\"padding-left: 20px; text-align: right\">