Improvements to duplicate suppression, cafe stop search, and configurability.
When suppressing duplicate cafes and place names, look back a certain distance along the route rather than just the previous point of interest. When searching for cafes, use SearchIntersect() to return all entries in the bounding rectangle, not just the nearest. Remove (most) hard-coded constants and allow these to be overriden by options to the NewGPXSummarizer() constructor.
This commit is contained in:
parent
4de001c867
commit
bd7eb246d5
3 changed files with 118 additions and 36 deletions
|
@ -19,8 +19,11 @@ import (
|
|||
func main() {
|
||||
log.SetFlags(0)
|
||||
stopNames := flag.String("stops", "", "Source for refreshment stops")
|
||||
minDist := flag.Float64("min-dist", 0.2, "Minimum distance (km) between points of interest")
|
||||
minSettlement := flag.String("min-settlement", "Other Settlement", "Exclude populated places smaller than this (City, Town, Village, Hamlet, Other Settlement)")
|
||||
stopRect := flag.Float64("sr", placenames.DefaultGPXSummarizerConfig.CoffeeStopSearchRectangleSize, "Size (m) of the rectangle we search for coffee stops near the route")
|
||||
stopDupDist := flag.Float64("sdd", placenames.DefaultGPXSummarizerConfig.CoffeeStopDuplicateDistance, "Suppress recurrences of coffee stops within this distance (km)")
|
||||
dupDist := flag.Float64("dd", placenames.DefaultGPXSummarizerConfig.PointOfInterestDuplicateDistance, "Suppress recurrences of points of interest within this distance (km)")
|
||||
minDist := flag.Float64("md", placenames.DefaultGPXSummarizerConfig.PointOfInterestMinimumDistance, "Minimum distance (km) between points of interest")
|
||||
minSettlement := flag.String("ms", "Other Settlement", "Exclude populated places smaller than this (City, Town, Village, Hamlet, Other Settlement)")
|
||||
flag.Parse()
|
||||
if flag.NArg() != 1 {
|
||||
log.Fatal("Usage: %s [--stops=ctccambridge|cyclingmaps] [--min-dist X] [--min-settlement S] GPX_FILE_OR_DIRECTORY")
|
||||
|
@ -38,12 +41,16 @@ func main() {
|
|||
log.Fatal(err)
|
||||
}
|
||||
}
|
||||
gs, err := placenames.NewGPXSummarizer()
|
||||
gs, err := placenames.NewGPXSummarizer(
|
||||
placenames.WithMinimumSettlement(*minSettlement),
|
||||
placenames.WithPointOfInterestMinimumDistance(*minDist),
|
||||
placenames.WithPointOfInterestDuplicateDistance(*dupDist),
|
||||
placenames.WithCoffeeStopSearchRectangleSize(*stopRect),
|
||||
placenames.WithCoffeeStopDuplicateDistance(*stopDupDist),
|
||||
)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
gs.SetMinDistance(*minDist)
|
||||
gs.SetMinSettlement(*minSettlement)
|
||||
if info.IsDir() {
|
||||
err = summarizeDirectory(gs, stops, inFile)
|
||||
} else {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue