Track service list configuration

From Maria GDK Wiki
Jump to navigation Jump to search

Service-side list setup

List setup controls data held by the track service and affects all clients of the list. It is separate from the history limits and appearance in track styling, which control retrieval and display.

Create a list with ITrackServiceClient.AddTrackList(listId), or use AddTrackListEx(listId, TracklistOptions) for list options. Configure history separately with SetTrackHistoryOptions(listId, TrackHistorySettings). Apply these settings before writing tracks: changing history settings clears existing history.

List options (non-history)

TracklistOptions property Meaning
FieldTableCapacity Capacity of each field's value table, not a limit on tracks or field names. Negative means effectively unlimited. Plain AddTrackList uses 100; set this explicitly with AddTrackListEx, since an omitted integer is sent as zero.
IndexGridLatResolution Present in the contract for geographic indexing, but not applied by the current managed service implementation. Do not rely on it to change index resolution.

History settings

History is disabled unless configured for the list or inherited from service defaults. TrackHistoryUtils.CreateHistorySettings() provides the initial values below; an empty new TrackHistorySettings() does not.

TrackHistorySettings property Initial value / meaning
ChunkEntryCount Helper default: 128. Number of entries accumulated before a block is finalized and packed. Zero disables history; otherwise use a positive value.
PosResolutionCm Helper default: 100; zero is normalized to 1. Position-delta quantization. Despite its legacy name, the current codec applies this value to packed latitude/longitude units of 10-7 degree, not uniform centimeters on the ground.
TimeResolutionMs Helper default: 100 ms; zero is normalized to 1 ms. Quantization of timestamp deltas.
Thinning Default: false. Enables one-time Douglas-Peucker-like thinning when a block is finalized. Active-block queries and edits to finalized blocks do not trigger another thinning pass.
ThinningToleranceMeters Default: 0. Spatial tolerance in meters. Zero is valid and can remove exactly collinear points; negative values behave as zero. Only Thinning enables/disables thinning.
MaxThinningIntervalSeconds Default: 0. During thinning, retain a point when its time since the previous retained point is strictly greater than this many seconds. Zero disables the time constraint; negative values behave as zero. This cannot fill gaps in source data.
TrimHistoryOptions Optional block-retention settings, described below. Unset means no automatic trimming.
TrackFields Present in the contract, but not used to store field-value history by the current implementation; history stores positions and timestamps.

Thinning always retains each block's first and last point and preserves retained timestamps subject to existing time quantization. Intermediate path, speed and timing information is lost. Both double settings must be finite.

Use SetTrackHistoryOptions(listId, null) to disable history for a list. SetDefaultTrackHistoryOptions(settings) sets the default for subsequently created lists, not existing lists; passing null clears that default.

Retention and explicit trimming

Supply TrimHistoryOptions within history settings for automatic cleanup, or pass it to TrimHistory(listId, options) for an explicit cleanup operation.

TrimHistoryOptions property Meaning
MinimumRetainPointCount Point-count retention trigger. Values less than or equal to zero disable this criterion.
MinimumRetainAgeTicks Age retention trigger, expressed as a duration in .NET ticks (100 ns), for example TimeSpan.FromHours(24).Ticks. Values less than or equal to zero disable this criterion.
AgeTimeReference Optional reference time as a UTC file time, for example DateTime.UtcNow.ToFileTimeUtc(). Zero/unset uses the service host's current UTC time.

Cleanup removes whole blocks, never individual points, and always preserves the newest block. The current implementation starts deleting when either enabled count/age criterion is reached; they are not independent minimum guarantees. Age is evaluated from block start time, so a cutoff-spanning block may be removed. Automatic cleanup runs on block rollover/packing/splitting, not on a timer; use explicit cleanup for idle histories.

The higher-level TrackHistoryOptions exposes retention as MaxCount and MaxAge; here MaxAge is in milliseconds, unlike the styling MaxAge, which is in seconds.

Example

Assuming trackService is a connected ITrackServiceClient:

trackService.AddTrackListEx("vessels", new TracklistOptions
{
    FieldTableCapacity = 100
});

var history = TrackHistoryUtils.CreateHistorySettings();
history.Thinning = true; // Explicit opt-in; omit to keep all stored samples.
history.ThinningToleranceMeters = 25;
history.MaxThinningIntervalSeconds = 30;
history.TrimHistoryOptions = new TrimHistoryOptions
{
    MinimumRetainAgeTicks = TimeSpan.FromHours(24).Ticks
};
trackService.SetTrackHistoryOptions("vessels", history);

The example's tolerances and retention period are application choices, not service defaults. Thinning settings require a service version that supports them. See Track Editor: list management, Track Editor: history settings, and Track performance tips for related examples.