Class MvtFeature
- Namespace
- SpatialNET.IO
- Assembly
- SpatialNET.IO.dll
A feature of a vector tile layer: optional id, geometry type, the geometry as MVT command integers in tile coordinates and the attributes. Build it from a tile-coordinate geometry with SpatialNET.IO.MvtFeature.Create(SpatialNET.IGeometry2D,System.Collections.Generic.IEnumerable{System.Collections.Generic.KeyValuePair{System.String,System.Object}},System.Nullable{System.UInt64}) or let SpatialNET.IO.MvtTileBuilder do the transform from world coordinates.
public sealed class MvtFeatureInheritance
Inherited Members
Properties
Attributes
The attributes in order; keys and values are deduplicated per layer on encoding.
public IReadOnlyList<KeyValuePair<string, MvtValue>> Attributes { get; init; }Property Value
Geometry
The geometry as command integers (MoveTo/LineTo/ClosePath with zigzag-encoded deltas), see SpatialNET.IO.MvtGeometry.
public IReadOnlyList<uint> Geometry { get; init; }Property Value
GeometryType
The geometry type.
public MvtGeometryType GeometryType { get; init; }Property Value
Id
The feature id (id, field 1); null = not written. Hosts typically use the object id.
public ulong? Id { get; init; }Property Value
Methods
Create(IGeometry2D, IEnumerable<KeyValuePair<string, object?>>?, ulong?)
Creates a feature from a geometry that is already in tile coordinates (y down, 0..extent): coordinates are rounded to integers, repeated points and degenerate parts dropped and polygon rings oriented as MVT requires.
public static MvtFeature? Create(IGeometry2D tileGeometry, IEnumerable<KeyValuePair<string, object?>>? attributes = null, ulong? id = null)Parameters
tileGeometryIGeometry2D-
The geometry in tile coordinates.
attributesIEnumerable<KeyValuePair<string, object?>>?-
The attributes;
nullvalues are skipped (MVT has no null), a repeated key keeps its first value. idulong?-
The feature id or
null.
Returns
- MvtFeature?
-
The feature, or
nullif nothing is left of the geometry.
Exceptions
- ArgumentNullException
-
tileGeometryisnull. - ArgumentException
-
A coordinate is not finite or outside the 32-bit range.
ToGeometry(IGeometryFactory?, MvtTileTransform?)
Decodes the geometry: points → SpatialNET.IPoint2D (one) or SpatialNET.IMultiPoint2D, lines → SpatialNET.IPolyline2D, polygons → SpatialNET.IPolygon2D (exterior rings by positive area in tile coordinates, interior rings by negative area).
public IGeometry2D ToGeometry(IGeometryFactory? factory = null, MvtTileTransform? transform = null)Parameters
factoryIGeometryFactory?-
The factory;
null= SpatialNET.GeometryFactory.Default. transformMvtTileTransform?-
If given, coordinates are converted from tile to world coordinates; otherwise they stay tile coordinates.
Returns
Exceptions
- FormatException
-
The command integers are invalid or the geometry type is SpatialNET.IO.MvtGeometryType.Unknown.
- InvalidOperationException
-
No factory available.