X-Git-Url: https://git.rapsys.eu/packbundle/blobdiff_plain/29d552c341c632e185c043037923319a0527be39..12c80d9163f63c86e2720f00a1c5036d1f413161:/Util/MapUtil.php diff --git a/Util/MapUtil.php b/Util/MapUtil.php index 9bd8acd..62e6b30 100644 --- a/Util/MapUtil.php +++ b/Util/MapUtil.php @@ -410,13 +410,14 @@ class MapUtil { */ public static function latitudeToSexagesimal(float $latitude): string { //Set degree - $degree = $latitude % 60; + //TODO: see if round or intval is better suited to fix the Deprecated: Implicit conversion from float to int loses precision + $degree = round($latitude) % 60; //Set minute - $minute = ($latitude - $degree) * 60 % 60; + $minute = round(($latitude - $degree) * 60) % 60; //Set second - $second = ($latitude - $degree - $minute / 60) * 3600 % 3600; + $second = round(($latitude - $degree - $minute / 60) * 3600) % 3600; //Return sexagesimal longitude return $degree.'°'.$minute.'\''.$second.'"'.($latitude >= 0 ? 'N' : 'S'); @@ -431,13 +432,14 @@ class MapUtil { */ public static function longitudeToSexagesimal(float $longitude): string { //Set degree - $degree = $longitude % 60; + //TODO: see if round or intval is better suited to fix the Deprecated: Implicit conversion from float to int loses precision + $degree = round($longitude) % 60; //Set minute - $minute = ($longitude - $degree) * 60 % 60; + $minute = round(($longitude - $degree) * 60) % 60; //Set second - $second = ($longitude - $degree - $minute / 60) * 3600 % 3600; + $second = round(($longitude - $degree - $minute / 60) * 3600) % 3600; //Return sexagesimal longitude return $degree.'°'.$minute.'\''.$second.'"'.($longitude >= 0 ? 'E' : 'W');