mirror of https://github.com/tidwall/tile38.git
parent
9fb312b3cc
commit
2945479321
|
@ -1,6 +1,8 @@
|
|||
package collection
|
||||
|
||||
import (
|
||||
"math"
|
||||
|
||||
"github.com/tidwall/btree"
|
||||
"github.com/tidwall/tile38/geojson"
|
||||
"github.com/tidwall/tile38/index"
|
||||
|
@ -384,6 +386,12 @@ func (c *Collection) Within(cursor uint64, sparse uint8, obj geojson.Object, min
|
|||
var bbox geojson.BBox
|
||||
if obj != nil {
|
||||
bbox = obj.CalculatedBBox()
|
||||
if minZ == math.Inf(-1) && maxZ == math.Inf(+1) {
|
||||
if bbox.Min.Z == 0 && bbox.Max.Z == 0 {
|
||||
bbox.Min.Z = minZ
|
||||
bbox.Max.Z = maxZ
|
||||
}
|
||||
}
|
||||
} else {
|
||||
bbox = geojson.BBox{Min: geojson.Position{X: minLon, Y: minLat, Z: minZ}, Max: geojson.Position{X: maxLon, Y: maxLat, Z: maxZ}}
|
||||
}
|
||||
|
@ -432,6 +440,12 @@ func (c *Collection) Intersects(cursor uint64, sparse uint8, obj geojson.Object,
|
|||
var bbox geojson.BBox
|
||||
if obj != nil {
|
||||
bbox = obj.CalculatedBBox()
|
||||
if minZ == math.Inf(-1) && maxZ == math.Inf(+1) {
|
||||
if bbox.Min.Z == 0 && bbox.Max.Z == 0 {
|
||||
bbox.Min.Z = minZ
|
||||
bbox.Max.Z = maxZ
|
||||
}
|
||||
}
|
||||
} else {
|
||||
bbox = geojson.BBox{Min: geojson.Position{X: minLon, Y: minLat, Z: minZ}, Max: geojson.Position{X: maxLon, Y: maxLat, Z: maxZ}}
|
||||
}
|
||||
|
|
|
@ -298,9 +298,9 @@ func (c *Controller) cmdNearby(msg *server.Message) (res string, err error) {
|
|||
}
|
||||
|
||||
return sw.writeObject(ScanWriterParams{
|
||||
id: id,
|
||||
o: o,
|
||||
fields: fields,
|
||||
id: id,
|
||||
o: o,
|
||||
fields: fields,
|
||||
distance: distance,
|
||||
})
|
||||
})
|
||||
|
@ -349,8 +349,8 @@ func (c *Controller) cmdWithinOrIntersects(cmd string, msg *server.Message) (res
|
|||
s.cursor = sw.col.Within(s.cursor, s.sparse, s.o, s.minLat, s.minLon, s.maxLat, s.maxLon, minZ, maxZ,
|
||||
func(id string, o geojson.Object, fields []float64) bool {
|
||||
return sw.writeObject(ScanWriterParams{
|
||||
id: id,
|
||||
o: o,
|
||||
id: id,
|
||||
o: o,
|
||||
fields: fields,
|
||||
})
|
||||
},
|
||||
|
@ -359,8 +359,8 @@ func (c *Controller) cmdWithinOrIntersects(cmd string, msg *server.Message) (res
|
|||
s.cursor = sw.col.Intersects(s.cursor, s.sparse, s.o, s.minLat, s.minLon, s.maxLat, s.maxLon, minZ, maxZ,
|
||||
func(id string, o geojson.Object, fields []float64) bool {
|
||||
return sw.writeObject(ScanWriterParams{
|
||||
id: id,
|
||||
o: o,
|
||||
id: id,
|
||||
o: o,
|
||||
fields: fields,
|
||||
})
|
||||
},
|
||||
|
@ -414,8 +414,8 @@ func (c *Controller) cmdSearch(msg *server.Message) (res string, err error) {
|
|||
s.cursor = sw.col.SearchValues(s.cursor, s.desc,
|
||||
func(id string, o geojson.Object, fields []float64) bool {
|
||||
return sw.writeObject(ScanWriterParams{
|
||||
id: id,
|
||||
o: o,
|
||||
id: id,
|
||||
o: o,
|
||||
fields: fields,
|
||||
})
|
||||
},
|
||||
|
@ -428,8 +428,8 @@ func (c *Controller) cmdSearch(msg *server.Message) (res string, err error) {
|
|||
s.cursor, g.Limits[0], g.Limits[1], s.desc,
|
||||
func(id string, o geojson.Object, fields []float64) bool {
|
||||
return sw.writeObject(ScanWriterParams{
|
||||
id: id,
|
||||
o: o,
|
||||
id: id,
|
||||
o: o,
|
||||
fields: fields,
|
||||
})
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue