Table of Contents

Class PolylineEncodingOptions

Namespace
PolylineAlgorithm
Assembly
PolylineAlgorithm.dll

Provides configuration options for polyline encoding operations.

public sealed class PolylineEncodingOptions

Inheritance

Inherited Members

Remarks

This class allows you to configure various aspects of polyline encoding, including:

  • The PolylineAlgorithm.PolylineEncodingOptions.Precision level for coordinate encoding
  • The PolylineAlgorithm.PolylineEncodingOptions.StackAllocLimit for memory allocation strategy
  • The PolylineAlgorithm.PolylineEncodingOptions.LoggerFactory for diagnostic logging

All properties have internal setters and should be configured through a builder or factory pattern.

Properties

LoggerFactory

Gets the logger factory used for diagnostic logging during encoding operations.

public ILoggerFactory LoggerFactory { get; }

Property Value

ILoggerFactory

Remarks

The default logger factory is NullLoggerFactory, which does not log any messages. To enable logging, provide a custom ILoggerFactory implementation.

Precision

Gets the precision level used for encoding coordinate values.

public uint Precision { get; }

Property Value

uint

Remarks

The precision determines the number of decimal places to which each coordinate value (latitude or longitude) is multiplied and truncated (not rounded) before encoding. For example, a precision of 5 means each coordinate is multiplied by 10^5 and truncated to an integer before encoding.

This setting does not directly correspond to a physical distance or accuracy in meters, but rather controls the granularity of the encoded values.

StackAllocLimit

Gets the maximum buffer size (in characters) that can be allocated on the stack for encoding operations.

public int StackAllocLimit { get; }

Property Value

int

Remarks

When the required buffer size for encoding exceeds this limit, memory will be allocated on the heap instead of the stack. This setting specifically applies to stack allocation of character arrays (stackalloc char[]) used during polyline encoding, balancing performance and stack safety.