// 십진법(DD)을 도분초(DMS)로 변환 export function decimalToDMS(decimal: number, isLatitude: boolean): string { const absolute = Math.abs(decimal) const degrees = Math.floor(absolute) const minutesDecimal = (absolute - degrees) * 60 const minutes = Math.floor(minutesDecimal) const seconds = ((minutesDecimal - minutes) * 60).toFixed(2) let direction = '' if (isLatitude) { direction = decimal >= 0 ? 'N' : 'S' } else { direction = decimal >= 0 ? 'E' : 'W' } return `${degrees}° ${minutes}' ${seconds}" ${direction}` } // 도분초를 십진법으로 변환 export function dmsToDecimal(degrees: number, minutes: number, seconds: number, direction: 'N' | 'S' | 'E' | 'W'): number { let decimal = degrees + minutes / 60 + seconds / 3600 if (direction === 'S' || direction === 'W') { decimal = -decimal } return decimal }