Use new Meters() function.

This commit is contained in:
Alex Roitman 2018-10-25 17:00:19 -07:00
parent 7c803f355b
commit 33530075a4
3 changed files with 11 additions and 3 deletions

4
Gopkg.lock generated
View File

@ -227,7 +227,7 @@
[[projects]] [[projects]]
branch = "master" branch = "master"
digest = "1:6fc1b77dedecd24d417a38c4ffc580c0c4de1540b60453efee44f1a41b205d27" digest = "1:4be7626fb8f801eb85aa7494ce3a504c9b4121a07f4ec19d7d204185bd6397d5"
name = "github.com/tidwall/geojson" name = "github.com/tidwall/geojson"
packages = [ packages = [
".", ".",
@ -235,7 +235,7 @@
"geometry", "geometry",
] ]
pruneopts = "" pruneopts = ""
revision = "581e33d25c96a70d4006cbeca5fcd716caad7766" revision = "928ede3da18d831dea0af0bb26adeb025145c23b"
[[projects]] [[projects]]
digest = "1:3ddca2bd5496c6922a2a9e636530e178a43c2a534ea6634211acdc7d10222794" digest = "1:3ddca2bd5496c6922a2a9e636530e178a43c2a534ea6634211acdc7d10222794"

View File

@ -425,7 +425,7 @@ func (c *Controller) nearestNeighbors(
return true return true
} }
dist := o.Distance(target) dist := o.Distance(target)
if s.obj.(*geojson.Circle).Meters > 0 && dist > s.obj.(*geojson.Circle).Meters { if target.(*geojson.Circle).Meters() > 0 && dist > target.(*geojson.Circle).Meters() {
return false return false
} }
items = append(items, iterItem{id: id, o: o, fields: fields, dist: dist}) items = append(items, iterItem{id: id, o: o, fields: fields, dist: dist})

View File

@ -70,3 +70,11 @@ func (g *Circle) JSON() string {
func (g *Circle) String() string { func (g *Circle) String() string {
return string(g.AppendJSON(nil)) return string(g.AppendJSON(nil))
} }
func (g *Circle) Meters() float64 {
return g.meters
}
func (g *Circle) Center() geometry.Point {
return g.center
}