Documentation ¶
Index ¶
Constants ¶
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 ¶
var ( CacheLastPushTTL = 1 * 24 * time.Hour CacheLastKnownTTL = 7 * 24 * time.Hour )
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", } )
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}}
var CatSnapBucket = []byte("snaps")
var CatStateBucket = []byte("state")
var CatStateDBName = "state.db"
var DatadirRoot = func() string { home, err := os.UserHomeDir() if err != nil { panic(err) } return filepath.Join(home, ".catd") }()
var DefaultActDiscretionConfigTripDetector = &ActDiscretionConfig{ Interval: 2 * time.Minute, Distance: 50, SpeedThreshold: 0.5, }
DefaultActDiscretionConfigTripDetector is DEPRECATED.
var DefaultActImproverConfig = &ActDiscretionConfig{ Interval: 20 * time.Second, ResetInterval: time.Minute, SpeedThreshold: common.SpeedOfWalkingMin, }
var DefaultBatchSize = 100_000
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, }
var DefaultGZipCompressionLevel = gzip.BestCompression
var DefaultLapConfig = &ActDiscretionConfig{ Interval: 2 * time.Minute, Distance: 50.0, SpeedThreshold: common.SpeedOfWalkingSlow, }
var DefaultLineStringSimplificationConfig = &LineStringSimplificationConfig{
DouglasPeuckerThreshold: 0.00008,
}
var DefaultNapConfig = &ActDiscretionConfig{ Interval: 24 * time.Hour, Distance: 100.0, }
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...) }, }
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.
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) MustSetPair ¶
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