Check that the start point is within the bounding box of its nearest neighbour
This commit is contained in:
parent
340612e566
commit
617b12ff64
3 changed files with 80 additions and 1 deletions
|
@ -1,6 +1,7 @@
|
|||
package placenames
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io"
|
||||
"math"
|
||||
"strings"
|
||||
|
@ -124,6 +125,9 @@ func (gs *GPXSummarizer) SummarizeTrack(r io.Reader, stops *rtreego.Rtree) (*Tra
|
|||
thisPoint := rtreego.Point{ngCoord.Easting, ngCoord.Northing}
|
||||
nn, _ := gs.poi.NearestNeighbor(thisPoint).(*NamedBoundary)
|
||||
if init {
|
||||
if !nn.Contains(thisPoint) {
|
||||
return nil, fmt.Errorf("start point out of range")
|
||||
}
|
||||
start = thisPoint
|
||||
s.Start = nn.Name
|
||||
prevPlace = nn.Name
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue