go-pb-jubilee/utils/utils.go
Martin Donnelly 9b11de7902 init
2024-08-28 00:24:33 +01:00

41 lines
824 B
Go

package utils
import (
"jubilee-server/structs"
"strconv"
"strings"
)
func ParseLL(ll structs.LL) *structs.LatLong {
splitll := strings.Split(ll.Ll, ",")
latFloat, _ := strconv.ParseFloat(splitll[0], 32)
longFloat, _ := strconv.ParseFloat(splitll[1], 32)
return &structs.LatLong{
Lat: latFloat,
Long: longFloat,
}
}
func LLfromStrings64(latitude string, longitude string) *structs.LatLong {
latFloat, _ := strconv.ParseFloat(latitude, 64)
longFloat, _ := strconv.ParseFloat(longitude, 64)
return &structs.LatLong{
Lat: latFloat,
Long: longFloat,
}
}
func LLfromStrings32(latitude string, longitude string) *structs.LatLong {
latFloat, _ := strconv.ParseFloat(latitude, 32)
longFloat, _ := strconv.ParseFloat(longitude, 32)
return &structs.LatLong{
Lat: latFloat,
Long: longFloat,
}
}