diff --git a/inc/spot.php b/inc/spot.php index 9054380..aad5a9e 100755 --- a/inc/spot.php +++ b/inc/spot.php @@ -258,6 +258,8 @@ class Spot extends Main $asMessage['unix_timestamp'] = (int) $asMessage['unix_timestamp']; $asMessage['latitude'] = floatval($asMessage['latitude']); $asMessage['longitude'] = floatval($asMessage['longitude']); + $asMessage['lat_dms'] = self::DecToDMS($asMessage['latitude'], 'lat'); + $asMessage['lon_dms'] = self::DecToDMS($asMessage['longitude'], 'lon'); $asMessage['relative_time'] = Toolbox::getDateTimeDesc($asMessage['unix_timestamp'], 'fr'); $asMessage['formatted_time'] = date(self::FORMAT_TIME, $asMessage['unix_timestamp']); $asAllFeedMessages[] = $asMessage; @@ -477,6 +479,26 @@ class Spot extends Main return ($asThumbInfo['error']=='')?$asThumbInfo['out']:$sPicPath; } + + public static function DecToDMS($dValue, $sType='lat') { + if($sType=='lat') $sDirection = ($dValue >= 0)?'N':'S'; + else $sDirection = ($dValue >= 0)?'E':'W'; + + $dAbsValue = abs($dValue); + + //Degrees + $iDegree = floor($dAbsValue); + $dLeft = $dAbsValue - $iDegree; + + //Minutes + $iMinute = floor($dLeft * 60); + $dLeft -= $iMinute / 60; + + //Seconds + $fSecond = round($dLeft * 3600, 1); + + return $iDegree.'°'.$iMinute.'\''.$fSecond.'"'.$sDirection; + } } ?> \ No newline at end of file diff --git a/masks/project.html b/masks/project.html index 257b49b..b5fbc72 100755 --- a/masks/project.html +++ b/masks/project.html @@ -370,7 +370,7 @@ function getPost(asPost) { { case 'message': $Body = $('
') - .append($('

').addIcon('fa-message', true).append('Latitude '+asPost.latitude+', Longitude '+asPost.longitude)) + .append($('

').addIcon('fa-message', true).append(asPost.lat_dms+' '+asPost.lon_dms)) .append($('

').addIcon('fa-time', true).append(sAbsTime)) .append( $('', {'class':'staticmap', title: 'Click pour zoomer', src: getStaticMapUrl(asPost.latitude, asPost.longitude)})