Skip to content

Commit 6b8211c

Browse files
committed
Fixed invalid BOUNDS result
This commit ensures that BOUNDS always returns Polygon.
1 parent ee2237d commit 6b8211c

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ require (
2020
github.com/tidwall/btree v1.5.0
2121
github.com/tidwall/buntdb v1.2.9
2222
github.com/tidwall/expr v0.8.3
23-
github.com/tidwall/geojson v1.4.2
23+
github.com/tidwall/geojson v1.4.3
2424
github.com/tidwall/gjson v1.14.3
2525
github.com/tidwall/hashmap v1.6.1
2626
github.com/tidwall/limiter v0.4.0

go.sum

+2-2
Original file line numberDiff line numberDiff line change
@@ -361,8 +361,8 @@ github.com/tidwall/expr v0.8.3/go.mod h1:GnVpaS2R9wWV9Ft2u5TPDypJ+iQNxhAt9ISTUaU
361361
github.com/tidwall/geoindex v1.4.4/go.mod h1:rvVVNEFfkJVWGUdEfU8QaoOg/9zFX0h9ofWzA60mz1I=
362362
github.com/tidwall/geoindex v1.7.0 h1:jtk41sfgwIt8MEDyC3xyKSj75iXXf6rjReJGDNPtR5o=
363363
github.com/tidwall/geoindex v1.7.0/go.mod h1:rvVVNEFfkJVWGUdEfU8QaoOg/9zFX0h9ofWzA60mz1I=
364-
github.com/tidwall/geojson v1.4.2 h1:foR+7MWweUPLcFI8oWMTHp22Qkc7XHRJo15e9rCnv64=
365-
github.com/tidwall/geojson v1.4.2/go.mod h1:1cn3UWfSYCJOq53NZoQ9rirdw89+DM0vw+ZOAVvuReg=
364+
github.com/tidwall/geojson v1.4.3 h1:yae/k/DhJdc9psaTJQ3pNOdbol70eH+nCijy6O7TxBw=
365+
github.com/tidwall/geojson v1.4.3/go.mod h1:1cn3UWfSYCJOq53NZoQ9rirdw89+DM0vw+ZOAVvuReg=
366366
github.com/tidwall/gjson v1.12.1/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk=
367367
github.com/tidwall/gjson v1.14.3 h1:9jvXn7olKEHU1S9vwoMGliaT8jq1vJ7IH/n9zD9Dnlw=
368368
github.com/tidwall/gjson v1.14.3/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk=

internal/buffer/buffer.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ func Simple(g geojson.Object, meters float64) (geojson.Object, error) {
4747
}
4848
return geojson.NewFeature(bg, g.Members()), nil
4949
case *geojson.Circle:
50-
return Simple(g.Primative(), meters)
50+
return Simple(g.Polygon(), meters)
5151
case nil:
5252
return nil, errors.New("cannot buffer nil object")
5353
default:

tests/keys_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ func keys_BOUNDS_test(mc *mockServer) error {
4343
Do("BOUNDS", "mykey").JSON().Err("key not found"),
4444
Do("SET", "mykey", "myid1", "POINT", 33, -115).OK(),
4545
Do("BOUNDS", "mykey").Str("[[-115 33] [-115 33]]"),
46-
Do("BOUNDS", "mykey").JSON().Str(`{"ok":true,"bounds":{"type":"Point","coordinates":[-115,33]}}`),
46+
Do("BOUNDS", "mykey").JSON().Str(`{"ok":true,"bounds":{"type":"Polygon","coordinates":[[[-115,33],[-115,33],[-115,33],[-115,33],[-115,33]]]}}`),
4747
Do("SET", "mykey", "myid2", "POINT", 34, -112).OK(),
4848
Do("BOUNDS", "mykey").Str("[[-115 33] [-112 34]]"),
4949
Do("DEL", "mykey", "myid2").Str("1"),
@@ -293,7 +293,7 @@ func keys_SET_test(mc *mockServer) error {
293293
Do("SET", "mykey", "myid", "BOUNDS", 33, -115, 33, -115).OK(),
294294
Do("GET", "mykey", "myid", "POINT").Str("[33 -115]"),
295295
Do("GET", "mykey", "myid", "BOUNDS").Str("[[33 -115] [33 -115]]"),
296-
Do("GET", "mykey", "myid", "OBJECT").Str(`{"type":"Point","coordinates":[-115,33]}`),
296+
Do("GET", "mykey", "myid", "OBJECT").Str(`{"type":"Polygon","coordinates":[[[-115,33],[-115,33],[-115,33],[-115,33],[-115,33]]]}`),
297297
Do("GET", "mykey", "myid", "HASH", 7).Str("9my5xp7"),
298298
Do("DEL", "mykey", "myid").Str("1"),
299299
Do("GET", "mykey", "myid").Str("<nil>"),

0 commit comments

Comments
 (0)