(cellIDStr string)
| 34 | } |
| 35 | |
| 36 | func (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 | |
| 44 | func (l GLocation) DistanceTo(other GLocation, unit GUnit) (distance float64) { |
| 45 | return Meters.To(unit, l.s2LatLng().Distance(other.s2LatLng()).Radians()*earthRadiusMeters) |