| 591 | } |
| 592 | |
| 593 | func locationPredicate(ctx context.Context, rects []geocode.Rect) (*Constraint, error) { |
| 594 | var c *Constraint |
| 595 | for i, rect := range rects { |
| 596 | loc := &LocationConstraint{ |
| 597 | West: rect.SouthWest.Long, |
| 598 | East: rect.NorthEast.Long, |
| 599 | North: rect.NorthEast.Lat, |
| 600 | South: rect.SouthWest.Lat, |
| 601 | } |
| 602 | permLoc := &Constraint{ |
| 603 | Permanode: &PermanodeConstraint{ |
| 604 | Location: loc, |
| 605 | }, |
| 606 | } |
| 607 | if i == 0 { |
| 608 | c = permLoc |
| 609 | } else { |
| 610 | c = orConst(c, permLoc) |
| 611 | } |
| 612 | } |
| 613 | return c, nil |
| 614 | } |
| 615 | |
| 616 | func (l namedLocation) Predicate(ctx context.Context, args []string) (*Constraint, error) { |
| 617 | where := args[0] |