Add type to points of interest.
This commit is contained in:
parent
2f9e0e66e3
commit
a51a3634bd
4 changed files with 7 additions and 4 deletions
|
@ -25,6 +25,7 @@ func main() {
|
|||
func(r *openname.Record) error {
|
||||
b := placenames.NamedBoundary{
|
||||
Name: r.Name,
|
||||
Type: r.LocalType,
|
||||
Xmin: r.MbrXMin,
|
||||
Ymin: r.MbrYMin,
|
||||
Xmax: r.MbrXMax,
|
||||
|
|
BIN
pkg/placenames/placenames.bin
(Stored with Git LFS)
BIN
pkg/placenames/placenames.bin
(Stored with Git LFS)
Binary file not shown.
|
@ -13,6 +13,7 @@ import (
|
|||
|
||||
type NamedBoundary struct {
|
||||
Name string
|
||||
Type string
|
||||
Xmin float64
|
||||
Ymin float64
|
||||
Xmax float64
|
||||
|
|
|
@ -42,6 +42,7 @@ func distance(p1, p2 rtreego.Point) float64 {
|
|||
|
||||
type POI struct {
|
||||
Name string
|
||||
Type string
|
||||
Distance float64
|
||||
}
|
||||
|
||||
|
@ -94,7 +95,7 @@ func (gs *GPXSummarizer) SummarizeTrack(r io.Reader) (*TrackSummary, error) {
|
|||
prevPlacePoint = thisPoint
|
||||
prevPoint = thisPoint
|
||||
prevHeight = thisHeight
|
||||
s.PointsOfInterest = append(s.PointsOfInterest, POI{nn.Name, 0.0})
|
||||
s.PointsOfInterest = append(s.PointsOfInterest, POI{Name: nn.Name, Type: nn.Type, Distance: 0.0})
|
||||
init = false
|
||||
continue
|
||||
}
|
||||
|
@ -103,7 +104,7 @@ func (gs *GPXSummarizer) SummarizeTrack(r io.Reader) (*TrackSummary, error) {
|
|||
s.Ascent += ascent
|
||||
}
|
||||
if nn.Contains(thisPoint) && nn.Name != prevPlace && distance(thisPoint, prevPlacePoint) > 0.2 {
|
||||
s.PointsOfInterest = append(s.PointsOfInterest, POI{nn.Name, s.Distance})
|
||||
s.PointsOfInterest = append(s.PointsOfInterest, POI{Name: nn.Name, Type: nn.Type, Distance: s.Distance})
|
||||
prevPlace = nn.Name
|
||||
prevPlacePoint = thisPoint
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue