Class MvtGeometry
- Namespace
- SpatialNET.IO
- Assembly
- SpatialNET.IO.dll
The MVT geometry encoding (spec section 4.3): command integers (id & 0x7) | (count << 3) with
MoveTo = 1, LineTo = 2 and ClosePath = 7, followed by zigzag-encoded coordinate deltas relative to a cursor that
persists across the parts of a feature.
public static class MvtGeometryInheritance
Inherited Members
Fields
ClosePath
The ClosePath command id.
public const int ClosePath = 7Field Value
LineTo
The LineTo command id.
public const int LineTo = 2Field Value
MoveTo
The MoveTo command id.
public const int MoveTo = 1Field Value
Methods
Command(int, int)
A command integer.
public static uint Command(int id, int count)Parameters
idint-
The command id: SpatialNET.IO.MvtGeometry.MoveTo, SpatialNET.IO.MvtGeometry.LineTo or SpatialNET.IO.MvtGeometry.ClosePath.
countint-
The repeat count, 0 ≤ count < 2^29.
Returns
Exceptions
- ArgumentOutOfRangeException
-
countis out of range.
Decode(MvtGeometryType, IReadOnlyList<uint>, IGeometryFactory?, MvtTileTransform?)
Decodes command integers into a geometry (see SpatialNET.IO.MvtFeature.ToGeometry(SpatialNET.IGeometryFactory,SpatialNET.IO.MvtTileTransform)). Polygon rings are classified by the sign of their area in tile coordinates (positive = exterior); a ring with zero area is dropped, an interior ring before any exterior ring is read as an exterior ring (lenient towards version 1 tiles).
public static IGeometry2D Decode(MvtGeometryType type, IReadOnlyList<uint> commands, IGeometryFactory? factory = null, MvtTileTransform? transform = null)Parameters
typeMvtGeometryType-
The geometry type.
commandsIReadOnlyList<uint>-
The command integers.
factoryIGeometryFactory?-
The factory;
null= SpatialNET.GeometryFactory.Default. transformMvtTileTransform?-
If given, coordinates are converted from tile to world coordinates.
Returns
Exceptions
- ArgumentNullException
-
commandsisnull. - FormatException
-
The commands are invalid for the type, or the type is SpatialNET.IO.MvtGeometryType.Unknown.
- InvalidOperationException
-
No factory available.
Encode(IGeometry2D)
Encodes a geometry that is in tile coordinates (see SpatialNET.IO.MvtFeature.Create(SpatialNET.IGeometry2D,System.Collections.Generic.IEnumerable{System.Collections.Generic.KeyValuePair{System.String,System.Object}},System.Nullable{System.UInt64}) for the rounding and cleaning rules).
public static (MvtGeometryType Type, uint[] Commands) Encode(IGeometry2D tileGeometry)Parameters
tileGeometryIGeometry2D-
The geometry in tile coordinates.
Returns
- (MvtGeometryType Type, uint[] Commands)
-
The geometry type and the command integers; SpatialNET.IO.MvtGeometryType.Unknown and none if nothing is left.
Exceptions
- ArgumentNullException
-
tileGeometryisnull. - ArgumentException
-
A coordinate is not finite or outside ±2^30.
UnZigZag(uint)
The inverse of SpatialNET.IO.MvtGeometry.ZigZag(System.Int32).
public static int UnZigZag(uint value)Parameters
valueuint-
The encoded value.
Returns
ZigZag(int)
The zigzag encoding of a parameter integer: (n << 1) ^ (n >> 31).
public static uint ZigZag(int value)Parameters
valueint-
The value.