MCPcopy Create free account
hub / github.com/dbProjectRED/redimo.go / setCellIDString

Method setCellIDString

geo.go:36–42  ·  view source on GitHub ↗
(cellIDStr string)

Source from the content-addressed store, hash-verified

34}
35
36func (l *GLocation) setCellIDString(cellIDStr string) {
37 cellID, _ := strconv.ParseUint(cellIDStr, 10, 64)
38 s2Cell := s2.CellID(cellID)
39 s2LatLon := s2Cell.LatLng()
40 l.Lat = s2LatLon.Lat.Degrees()
41 l.Lon = s2LatLon.Lng.Degrees()
42}
43
44func (l GLocation) DistanceTo(other GLocation, unit GUnit) (distance float64) {
45 return Meters.To(unit, l.s2LatLng().Distance(other.s2LatLng()).Radians()*earthRadiusMeters)

Callers 1

fromCellIDStringFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected