params

package
v0.0.0-...-3a2a10c Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 7, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CatsDir        = "cats"
	CatSnapsSubdir = "snaps"

	MasterTracksGZFileName = "master.geojson.gz"
	TracksGZFileName       = "tracks.geojson.gz"
	TracksLastGZFileName   = "last_tracks.geojson.gz"
	SnapsGZFileName        = "snaps.geojson.gz"
	LapsGZFileName         = "laps.geojson.gz"
	NapsGZFileName         = "naps.geojson.gz"
)

Variables

View Source
var (
	CacheLastPushTTL  = 1 * 24 * time.Hour
	CacheLastKnownTTL = 7 * 24 * time.Hour
)
View Source
var (
	TippeCommonArgs = CLIFlagsT{
		"--single-precision",

		"--generate-ids",

		"--read-parallel",
		"--json-progress",
		"--progress-interval", "5",
		"--temporary-directory", "/tmp",
		"--layer", "${LAYER_NAME}",
		"--name", "${TILESET_NAME}",
		"--output", "${OUTPUT_FILE}",
		"--force",
	}
	TippeLapsArgs = CLIFlagsT{
		"--maximum-tile-bytes", "750000",
		"--drop-smallest-as-needed",
		"--minimum-zoom", "3",
		"--maximum-zoom", "18",

		"--include", "Name",
		"--include", "UUID",
		"--include", "Activity",
		"--include", "RawPointCount",

		"--include", "Accuracy_Mean",

		"--include", "Time_Start_Unix",
		"--include", "Duration",

		"--include", "Speed_Reported_Mean",
		"--include", "Speed_Calculated_Mean",

		"--include", "Distance_Traversed",
		"--include", "Distance_Absolute",

		"--include", "Elevation_Mean",
		"--include", "Elevation_Gain",
		"--include", "Elevation_Loss",

		"--order-by", "Time_Start_Unix",
	}
	TippeNapsArgs = CLIFlagsT{
		"--maximum-tile-bytes", "5000000",
		"--cluster-densest-as-needed",
		"--cluster-distance", "1",
		"--calculate-feature-density",
		"--drop-rate", "1",
		"--minimum-zoom", "3",
		"--maximum-zoom", "18",
		"--include", "Name",
		"--include", "UUID",
		"--include", "Time_Start_Unix",
		"--include", "Duration",
		"-EDuration:sum",
		"--include", "Accuracy_Mean",
		"--include", "Elevation_Mean",
		"--include", "Area",
		"--include", "RawPointCount",
		"-ERawPointCount:sum",
	}
	// TippeTracksArgs taken from V1 CatTracks procedge, procmaster.
	TippeTracksArgs = CLIFlagsT{
		"--maximum-tile-bytes", "500000",
		"--minimum-zoom", "3",
		"--maximum-zoom", "18",
		"--cluster-densest-as-needed",
		"--calculate-feature-density",
		"--cluster-distance", "1",
		"--drop-rate", "1",
		"--include", "Alias",
		"--include", "UUID",
		"--include", "Name",
		"--include", "Activity",
		"--include", "Elevation",
		"--include", "Speed",
		"--include", "Accuracy",
		"--include", "Heading",
		"--include", "UnixTime",
		"-EUnixTime:max",
		"-EElevation:max",
		"-ESpeed:max",
		"-EAccuracy:mean",
	}
	TippeSnapsArgs = CLIFlagsT{
		"--maximum-tile-bytes", "330000",
		"--minimum-zoom", "3",
		"--maximum-zoom", "18",
		"--cluster-densest-as-needed",
		"--calculate-feature-density",
		"--cluster-distance", "1",
		"--drop-rate", "1",

		"--include", "Alias",
		"--include", "UUID",
		"--include", "Name",
		"--include", "Activity",
		"--include", "Elevation",
		"--include", "Speed",
		"--include", "Accuracy",
		"--include", "S3URL",
		"--include", "Heading",
		"--include", "UnixTime",
		"--include", "imgS3",

		"-EUnixTime:max",
		"-EElevation:max",
		"-ESpeed:max",
		"-EAccuracy:mean",
	}
	// TippeCellsArgs are for S2 cell polygons.
	TippeCellsArgs = CLIFlagsT{
		"--maximum-tile-bytes", "500000",

		"--minimum-zoom", "3",
		"--maximum-zoom", "18",

		"--coalesce-densest-as-needed",

		"--drop-rate", "1",

		"--extend-zooms-if-still-dropping",

		"--no-simplification-of-shared-nodes",

		"--simplification", "10",

		"--include", "Alias",
		"--include", "UUID",
		"--include", "Name",
		"--include", "Activity",
		"--include", "Elevation",
		"--include", "Speed",
		"--include", "Accuracy",
		"--include", "Time",

		"--include", "Count",
		"--include", "VisitCount",
		"--include", "FirstTime",
		"--include", "LastTime",
		"--include", "TotalTimeOffset",
		"--include", "ActivityMode.Unknown",
		"--include", "ActivityMode.Stationary",
		"--include", "ActivityMode.Walking",
		"--include", "ActivityMode.Running",
		"--include", "ActivityMode.Bike",
		"--include", "ActivityMode.Automotive",
		"--include", "ActivityMode.Fly",
	}
)
View Source
var AWS_BUCKETNAME = os.Getenv("AWS_BUCKETNAME")

AWS_BUCKETNAME is the fallbak AWS_BUCKETNAME value for cat snaps for the purpose of running catd _without_ an S3 config. Example catsnap: {"id":0,"type":"Feature","bbox":[-114.0877518,46.9292804,-114.0877518,46.9292804],"geometry":{"type":"Point","coordinates":[-114.0877518,46.9292804]},"properties":{"AccelerometerX":null,"AccelerometerY":null,"AccelerometerZ":null,"Accuracy":3,"Activity":"Walking","ActivityConfidence":100,"AmbientTemp":null,"BatteryLevel":0.95,"BatteryStatus":"unplugged","CurrentTripStart":null,"Distance":0,"Elevation":965.6,"GyroscopeX":null,"GyroscopeY":null,"GyroscopeZ":null,"Heading":-1,"Lightmeter":null,"Name":"ranga-moto-act3","NumberOfSteps":97647,"Pressure":null,"Speed":0.08,"Time":"2024-11-18T17:54:27.293Z","UUID":"76170e959f967f40","UnixTime":1731952467,"UserAccelerometerX":null,"UserAccelerometerY":null,"UserAccelerometerZ":null,"Version":"gcps/v0.0.0+4","heading_accuracy":-1,"imgS3":"rotblauercatsnaps/ia_76170e959f967f40_1731952467","speed_accuracy":0.1,"vAccuracy":1}}

View Source
var CatSnapBucket = []byte("snaps")
View Source
var CatStateBucket = []byte("state")
View Source
var CatStateDBName = "state.db"
View Source
var DatadirRoot = func() string {
	home, err := os.UserHomeDir()
	if err != nil {
		panic(err)
	}
	return filepath.Join(home, ".catd")
}()
View Source
var DefaultActDiscretionConfigTripDetector = &ActDiscretionConfig{
	Interval:       2 * time.Minute,
	Distance:       50,
	SpeedThreshold: 0.5,
}

DefaultActDiscretionConfigTripDetector is DEPRECATED.

View Source
var DefaultActImproverConfig = &ActDiscretionConfig{
	Interval:       20 * time.Second,
	ResetInterval:  time.Minute,
	SpeedThreshold: common.SpeedOfWalkingMin,
}
View Source
var DefaultBatchSize = 100_000
View Source
var DefaultCleanConfig = &TrackCleaningConfig{
	AccuracyThreshold:                   100.0,
	WangUrbanCanyonMinDistance:          200.0,
	WangUrbanCanyonDistanceFromSpeedMul: 10.0,
	WangUrbanCanyonWindow:               60 * time.Second,
	TeleportSpeedFactor:                 10.0,
	TeleportWindow:                      60 * time.Second,
	TeleportMinDistance:                 25.0,
}
View Source
var DefaultGZipCompressionLevel = gzip.BestCompression
View Source
var DefaultLapConfig = &ActDiscretionConfig{
	Interval:       2 * time.Minute,
	Distance:       50.0,
	SpeedThreshold: common.SpeedOfWalkingSlow,
}
View Source
var DefaultLineStringSimplificationConfig = &LineStringSimplificationConfig{
	DouglasPeuckerThreshold: 0.00008,
}
View Source
var DefaultNapConfig = &ActDiscretionConfig{
	Interval: 24 * time.Hour,
	Distance: 100.0,
}
View Source
var DefaultTippeConfigs = &struct {
	Tracks func() CLIFlagsT
	Snaps  func() CLIFlagsT
	Laps   func() CLIFlagsT
	Naps   func() CLIFlagsT
	Cells  func() CLIFlagsT
}{
	Tracks: func() CLIFlagsT {
		return append(TippeTracksArgs, TippeCommonArgs...)
	},
	Snaps: func() CLIFlagsT {
		return append(TippeSnapsArgs, TippeCommonArgs...)
	},
	Laps: func() CLIFlagsT {
		return append(TippeLapsArgs, TippeCommonArgs...)
	},
	Naps: func() CLIFlagsT {
		return append(TippeNapsArgs, TippeCommonArgs...)
	},
	Cells: func() CLIFlagsT {
		return append(TippeCellsArgs, TippeCommonArgs...)
	},
}
View Source
var S2DefaultVisitThreshold = time.Hour

S2DefaultVisitThreshold is the default time threshold for considering a cat as having left a cell; it is the threshold difference between the last visit and the current time.

View Source
var TippecanoeCommand = "/usr/local/bin/tippecanoe"

Functions

This section is empty.

Types

type ActDiscretionConfig

type ActDiscretionConfig struct {
	// Interval separates acts by time.
	Interval time.Duration

	// ResetInterval is the time to reset the act inference machine.
	ResetInterval time.Duration

	// Distance separates acts by distance.
	Distance float64

	// SpeedThreshold separates acts by speed.
	// Generally, speeds lower than this are Stationary, and higher are Moving.
	SpeedThreshold float64

	// SplitActivities is a flag to split acts on activities.
	SplitActivities bool
}

ActDiscretionConfig is a generic type for configuring the discretion of cat acts.

type CLIFlagsT

type CLIFlagsT []string

func LookupTippeConfig

func LookupTippeConfig(name TippeConfigName, raw CLIFlagsT) (config CLIFlagsT, ok bool)

func (CLIFlagsT) Add

func (c CLIFlagsT) Add(flag ...string) CLIFlagsT

func (CLIFlagsT) Copy

func (c CLIFlagsT) Copy() CLIFlagsT

func (CLIFlagsT) MustSetPair

func (c CLIFlagsT) MustSetPair(key, value string) CLIFlagsT

func (CLIFlagsT) Remove

func (c CLIFlagsT) Remove(key string, vN int) (next CLIFlagsT, ok bool)

func (CLIFlagsT) SetPair

func (c CLIFlagsT) SetPair(key, value string) (next CLIFlagsT, ok bool)

type LineStringSimplificationConfig

type LineStringSimplificationConfig struct {
	DouglasPeuckerThreshold float64
}

type TileDaemonConfig

type TileDaemonConfig struct {
	// RootDir is the parent directory for source and tile data.
	// Source data is stored in rootdir/source/, tile data in rootdir/tiles/.
	RootDir string

	// SkipEdge will skip edge tiling.
	// All PushFeature requests will be treated as canonical.
	// This is useful for development and initial runs,
	// where long-deferred edge tiling would amass large numbers
	// of deferred edge files needlessly.
	SkipEdge bool

	// TilingPendingExpiry is how long to "debounce" requests
	// made to the RequestTiling method.
	TilingPendingExpiry time.Duration

	// EdgeTilingRunThreshold is the time threshold for edge tiling to complete.
	// If edge tiling takes longer than this, edge will be rolled and
	// a tiling request for the canonical version will be triggered.
	EdgeTilingRunThreshold time.Duration

	RPCPath    string
	RPCNetwork string
	RPCAddress string

	// TilingTmpDir is the parent directory for temporary source and tile files.
	// Cleanup not guaranteed. Probably best somewhere in /tmp.
	TilingTmpDir string

	// AwaitPendingOnShutdown will cause the daemon to wait for all pending
	// tiling requests to complete (which may take a long time).
	AwaitPendingOnShutdown bool
}

func DefaultTileDaemonConfig

func DefaultTileDaemonConfig() *TileDaemonConfig

type TippeConfigName

type TippeConfigName string
const (
	TippeConfigNameTracks TippeConfigName = "tracks"
	TippeConfigNameSnaps  TippeConfigName = "snaps"
	TippeConfigNameLaps   TippeConfigName = "laps"
	TippeConfigNameNaps   TippeConfigName = "naps"
	TippeConfigNameCells  TippeConfigName = "cells"
)

type TrackCleaningConfig

type TrackCleaningConfig struct {
	// AccuracyThreshold is the threshold to determine if a point is accurate.
	// If the accuracy is greater than this value, it's considered inaccurate.
	AccuracyThreshold float64

	// WangUrbanCanyonMinDistance is the minimum distance threshold to determine if a point is in an urban canyon.
	// It is derived as the distance between the target point and the centroids of the 5 points before and after it.
	WangUrbanCanyonMinDistance float64

	// WangUrbanCanyonDistanceFromSpeedMul is the multiplier to determine the distance threshold for the Wang Urban Canyon test
	// using the speed of the target point.
	// Low speeds require a lower distance threshold.
	// Minimum distance is bounded by WangUrbanCanyonMinDistance.
	WangUrbanCanyonDistanceFromSpeedMul float64

	// WangUrbanCanyonWindow is the window of points to consider for the Wang Urban Canyon test.
	WangUrbanCanyonWindow time.Duration

	// TeleportSpeedFactor is the factor to determine teleportation.
	// If calculated speed is X times faster than reported speed, it's a teleportation.
	TeleportSpeedFactor float64

	// TeleportMinDistance is the minimum distance between two points to consider teleportation.
	// This helps remove spurious teleportations for small distances (e.g. speed=0.04, distance=10).
	TeleportMinDistance float64

	// Teleportations must happen within this window of time.
	// Otherwise, it'll be considered signal loss instead.
	TeleportWindow time.Duration
}

type WebDaemonConfig

type WebDaemonConfig struct {
	// TileDaemonConfig is the configuration for a running tiled instance.
	// When cats push tracks, we can optionally make requests
	// on their behalf to the tiling service.
	// If nil, no tiling requests will happen.
	TileDaemonConfig *TileDaemonConfig

	NetAddr string
	NetPort int
}

func DefaultWebDaemonConfig

func DefaultWebDaemonConfig() *WebDaemonConfig

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL