Backend: Remove OLC code

Signed-off-by: Michael Mayer <michael@liquidbytes.net>
This commit is contained in:
Michael Mayer 2020-01-12 17:23:41 +01:00
parent 9c767dbf39
commit 106e9c3e1e
2 changed files with 0 additions and 49 deletions

View file

@ -1,19 +0,0 @@
package maps
import olc "github.com/google/open-location-code/go"
var OlcLength = 8
func OlcEncode(lat, lng float64) string {
if lat < -90 || lat > 90 {
log.Warnf("olc: latitude out of range (%f)", lat)
return ""
}
if lng < -180 || lng > 180 {
log.Warnf("olc: longitude out of range (%f)", lng)
return ""
}
return olc.Encode(lat, lng, OlcLength)
}

View file

@ -1,30 +0,0 @@
package maps
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestOlcEncode(t *testing.T) {
t.Run("Wildgehege", func(t *testing.T) {
plusCode := OlcEncode(48.56344833333333, 8.996878333333333)
expected := "8FWCHX7W+"
assert.Equal(t, expected, plusCode)
})
t.Run("LatOverflow", func(t *testing.T) {
plusCode := OlcEncode(548.56344833333333, 8.996878333333333)
expected := ""
assert.Equal(t, expected, plusCode)
})
t.Run("LongOverflow", func(t *testing.T) {
plusCode := OlcEncode(48.56344833333333, 258.996878333333333)
expected := ""
assert.Equal(t, expected, plusCode)
})
}