go-pb-jubilee/utils/utils.go

41 lines
824 B
Go
Raw Normal View History

2024-08-27 23:24:33 +00:00
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,
}
}