-
-
Save johnteee/dcb682fdc942af35983cb00aaac07734 to your computer and use it in GitHub Desktop.
Revisions
-
will83 revised this gist
Dec 14, 2017 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -15,7 +15,7 @@ function WGS84toGPS($lat, $lng){ $sec = ($decimals * .6) - $min; // (6.52584) - 6 // 0.52584 $sec = round($sec*60, 1); // round(31.5504, 1) // 31.6 $min = ($min >= 10) ? $min : '0'.$min; $sec = ($sec >= 10) ? $sec : '0'.$sec; $gps_lat = $whole.'°'.$min.'\''.$sec.'"'.$lat_card; @@ -28,7 +28,7 @@ function WGS84toGPS($lat, $lng){ $sec = ($decimals * .6) - $min; // (6.52584) - 6 // 0.52584 $sec = round($sec*60, 1); // round(31.5504, 1) // 31.6 $min = ($min >= 10) ? $min : '0'.$min; $sec = ($sec >= 10) ? $sec : '0'.$sec; $gps_lng = $whole.'°'.$min.'\''.$sec.'"'.$lng_card; -
will83 revised this gist
Dec 12, 2017 . 1 changed file with 11 additions and 9 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -8,25 +8,27 @@ function WGS84toGPS($lat, $lng){ // define latitude coordinate with minutes and seconds $lat_card = ($lat > 0) ? 'N' : 'S'; $whole = ($lat > 0) ? abs(floor($lat)) : abs(ceil($lat)); // x digits before coma // 24 $decimals = (abs($lat) - $whole) * 100; // 6 digits after coma // 108764 $min = floor($decimals * .6); // floor(6.52584) // 6 $sec = ($decimals * .6) - $min; // (6.52584) - 6 // 0.52584 $sec = round($sec*60, 1); // round(31.5504, 1) // 31.6 $min = ($min >= 10) ? $min : '0'.$min; $sec = ($sec >= 1) ? $sec : '0'.$sec; $gps_lat = $whole.'°'.$min.'\''.$sec.'"'.$lat_card; // define longitude coordinate with minutes and seconds $lng_card = ($lng > 0) ? 'E' : 'W'; $whole = ($lng > 0) ? abs(floor($lng)) : abs(ceil($lng)); // x digits before coma // 16 $decimals = (abs($lng) - $whole) * 100; // 6 digits after coma // 500156 $min = floor($decimals * .6); // floor(6.52584) // 6 $sec = ($decimals * .6) - $min; // (6.52584) - 6 // 0.52584 $sec = round($sec*60, 1); // round(31.5504, 1) // 31.6 $min = ($min >= 10) ? $min : '0'.$min; $sec = ($sec >= 1) ? $sec : '0'.$sec; $gps_lng = $whole.'°'.$min.'\''.$sec.'"'.$lng_card; -
will83 revised this gist
Dec 12, 2017 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -30,5 +30,5 @@ function WGS84toGPS($lat, $lng){ $gps_lng = $whole.'°'.$min.'\''.$sec.'"'.$lng_card; return $gps_lat.' '.$gps_lng; } -
will83 revised this gist
Dec 12, 2017 . 1 changed file with 32 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,34 @@ <?php $lat = -24.108764; $lng = 16.500156; function WGS84toGPS($lat, $lng){ $lat = number_format($lat, 6); $lng = number_format($lng, 6); // define latitude coordinate with minutes and seconds $lat_card = ($lat > 0) ? 'N' : 'S'; $whole = abs(floor($lat)); // x digits before coma // 24 $decimals = $lat - $whole; // 6 digits after coma // 108764 $min = floor($decimals * .00006); // floor(6.52584) // 6 $sec = ($decimals * .00006) - $min; // (6.52584) - 6 // 0.52584 $sec = round($sec*60, 1); // round(31.5504, 1) // 31.6 $min = ($min >= 10) ? $min : '0'.$min; $gps_lat = $whole.'°'.$min.'\''.$sec.'"'.$lat_card; // define longitude coordinate with minutes and seconds $lng_card = ($lng > 0) ? 'W' : 'E'; $whole = abs(floor($lng)); // x digits before coma // 16 $decimals = $lng - $whole; // 6 digits after coma // 500156 $min = floor($decimals * .00006); // floor(6.52584) // 6 $sec = ($decimals * .00006) - $min; // (6.52584) - 6 // 0.52584 $sec = round($sec*60, 1); // round(31.5504, 1) // 31.6 $min = ($min >= 10) ? $min : '0'.$min; $gps_lng = $whole.'°'.$min.'\''.$sec.'"'.$lng_card; } -
will83 revised this gist
Dec 12, 2017 . 1 changed file with 4 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,2 +1,5 @@ <?php $lat = 43.1166700; $long = 5.9333300;
-
will83 revised this gist
Dec 12, 2017 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,2 +1,2 @@ <?php $lat -
will83 created this gist
Dec 12, 2017 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,2 @@ $lat