mirror of
https://github.com/photoprism/photoprism.git
synced 2025-12-12 00:34:13 +01:00
17 lines
455 B
Go
17 lines
455 B
Go
package latlng
|
|
|
|
import "math"
|
|
|
|
// RoundDecimals defines the precision used when rounding coordinates.
|
|
var RoundDecimals = float64(10000000)
|
|
|
|
// Round rounds the given coordinate to six decimal places.
|
|
func Round(c float64) float64 {
|
|
return math.Round(c*RoundDecimals) / RoundDecimals
|
|
}
|
|
|
|
// RoundCoords rounds the given latitude and longitude to six decimal places.
|
|
func RoundCoords(lat, lng float64) (float64, float64) {
|
|
return Round(lat), Round(lng)
|
|
}
|