From 3c8b9b411046c9433660d0128d2056dd855487cb Mon Sep 17 00:00:00 2001 From: Josh Baker Date: Tue, 6 Dec 2016 06:20:47 -0700 Subject: [PATCH] Allow for INTERSECTS command for points Thanks to @rbastian for finding this bug. fixes #26 --- geojson/object.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/geojson/object.go b/geojson/object.go index 4a3755f7..5414b100 100644 --- a/geojson/object.go +++ b/geojson/object.go @@ -224,6 +224,10 @@ func withinObjectShared(g Object, o Object, pin func(v Polygon) bool, mpin func( switch v := o.(type) { default: return false + case Point: + return g.WithinBBox(v.CalculatedBBox()) + case SimplePoint: + return g.WithinBBox(v.CalculatedBBox()) case Polygon: if len(v.Coordinates) == 0 { return false @@ -267,6 +271,10 @@ func intersectsObjectShared(g Object, o Object, pin func(v Polygon) bool, mpin f switch v := o.(type) { default: return false + case Point: + return g.IntersectsBBox(v.CalculatedBBox()) + case SimplePoint: + return g.IntersectsBBox(v.CalculatedBBox()) case Polygon: if len(v.Coordinates) == 0 { return false