Search Results for

    Show / Hide Table of Contents

    Class WKBWriter

    Writes a Well-Known Binary byte data representation of a Geometry.

    Inheritance
    object
    WKBWriter
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: NetTopologySuite.IO
    Assembly: NetTopologySuite.dll
    Syntax
    public class WKBWriter
    Remarks

    There are a few cases which are not specified in the standard. The implementation uses a representation which is compatible with other common spatial systems (notably, PostGIS).

    • LinearRingsare written as LineStrings.
    • Empty geometries are output as follows
      • PointA WKBPoint with double.NaN ordinate values
      • LineStringA WKBLineString with zero points
      • Polygoncurrently output as a WKBPolygon with one LinearRing with zero points. Note: This is different to other systems. It will change to a WKBPolygon with zero LinearRings.
      • Multi geometriesA WKBMulti with zero elements
      • GeometryCollectionA WKBGeometryCollection with zero elements

    This implementation supports the Extended WKB standard. Extended WKB allows writing 3-dimensional coordinates and the geometry SRID value. The presence of 3D coordinates is indicated by setting the high bit of the wkbType word. The presence of a SRID is indicated by setting the third bit of the wkbType word. EWKB format is upward-compatible with the original SFS WKB format.

    SRID output is optimized, if specified. The top-level geometry has the SRID included. Child geometries have it included if their value differs from its parent.

    This class supports reuse of a single instance to read multiple geometries. This class is not thread - safe; each thread should create its own instance.

    Constructors

    | Edit this page View Source

    WKBWriter()

    Initializes writer with LittleIndian byte order.

    Declaration
    public WKBWriter()
    | Edit this page View Source

    WKBWriter(ByteOrder)

    Initializes writer with the specified byte order.

    Declaration
    public WKBWriter(ByteOrder encodingType)
    Parameters
    Type Name Description
    ByteOrder encodingType

    Encoding type

    | Edit this page View Source

    WKBWriter(ByteOrder, bool)

    Initializes writer with the specified byte order.

    Declaration
    public WKBWriter(ByteOrder encodingType, bool handleSRID)
    Parameters
    Type Name Description
    ByteOrder encodingType

    Encoding type

    bool handleSRID

    SRID values, present or not, should be emitted.

    | Edit this page View Source

    WKBWriter(ByteOrder, bool, bool)

    Initializes writer with the specified byte order.

    Declaration
    public WKBWriter(ByteOrder encodingType, bool handleSRID, bool emitZ)
    Parameters
    Type Name Description
    ByteOrder encodingType

    Encoding type

    bool handleSRID

    SRID values, present or not, should be emitted.

    bool emitZ

    Z values, present or not, should be emitted

    | Edit this page View Source

    WKBWriter(ByteOrder, bool, bool, bool)

    Initializes writer with the specified byte order.

    Declaration
    public WKBWriter(ByteOrder encodingType, bool handleSRID, bool emitZ, bool emitM)
    Parameters
    Type Name Description
    ByteOrder encodingType

    Encoding type

    bool handleSRID

    SRID values, present or not, should be emitted.

    bool emitZ

    Z values, present or not, should be emitted

    bool emitM

    M values, present or not, should be emitted

    Fields

    | Edit this page View Source

    AllowedOrdinates

    Gets the Ordinates that this class can write.

    Declaration
    public static readonly Ordinates AllowedOrdinates
    Field Value
    Type Description
    Ordinates

    Properties

    | Edit this page View Source

    EncodingType

    Gets or sets the binary encoding type

    Declaration
    public ByteOrder EncodingType { get; protected set; }
    Property Value
    Type Description
    ByteOrder
    | Edit this page View Source

    HandleOrdinates

    Gets or sets the maximum Ordinates to write out. The default is equivalent to AllowedOrdinates.

    Declaration
    public Ordinates HandleOrdinates { get; set; }
    Property Value
    Type Description
    Ordinates
    Remarks

    The purpose of this property is to restrict what gets written out to ensure that, e.g., Z values are never written out even if present on a geometry instance. Ordinates that are not present on a geometry instance will be omitted regardless of this value.

    Flags not present in AllowedOrdinates are silently ignored.

    X and Y are always present.

    | Edit this page View Source

    HandleSRID

    Gets or sets a value indicating if an encoded SRID value should be handled or ignored.

    Declaration
    public bool HandleSRID { get; set; }
    Property Value
    Type Description
    bool
    | Edit this page View Source

    InitCount

    Standard byte size for each complex point. Each complex point (LineString, Polygon, ...) contains: 1 byte for ByteOrder and 4 bytes for WKBType. 4 bytes for SRID value

    Declaration
    [Obsolete("Will be removed in a future version")]
    protected int InitCount { get; }
    Property Value
    Type Description
    int
    | Edit this page View Source

    Strict

    Gets a value indicating if only original WKT elements should be handled

    Declaration
    public bool Strict { get; set; }
    Property Value
    Type Description
    bool

    Methods

    | Edit this page View Source

    GetBytes(Geometry)

    Gets a buffer for the MemoryStream to write geometry to.

    Declaration
    [Obsolete("Will be removed in a future version.")]
    protected byte[] GetBytes(Geometry geometry)
    Parameters
    Type Name Description
    Geometry geometry

    The geometry to write

    Returns
    Type Description
    byte[]

    A buffer

    | Edit this page View Source

    SetByteStream(Geometry)

    Computes the length of a buffer to write geometry in its WKB format.

    Declaration
    [Obsolete("Will be removed in a future version.")]
    protected virtual int SetByteStream(Geometry geometry)
    Parameters
    Type Name Description
    Geometry geometry

    The geometry

    Returns
    Type Description
    int

    The number of bytes required to store geometry in its WKB format.

    | Edit this page View Source

    SetByteStream(GeometryCollection)

    Computes the length of a buffer to write the GeometryCollection geometry in its WKB format.

    Declaration
    [Obsolete("Will be removed in a future version.")]
    protected int SetByteStream(GeometryCollection geometry)
    Parameters
    Type Name Description
    GeometryCollection geometry

    The geometry

    Returns
    Type Description
    int

    The number of bytes required to store geometry in its WKB format.

    | Edit this page View Source

    SetByteStream(LineString)

    Computes the length of a buffer to write the LineString geometry in its WKB format.

    Declaration
    [Obsolete("Will be removed in a future version.")]
    protected int SetByteStream(LineString geometry)
    Parameters
    Type Name Description
    LineString geometry

    The geometry

    Returns
    Type Description
    int

    The number of bytes required to store geometry in its WKB format.

    | Edit this page View Source

    SetByteStream(MultiLineString)

    Computes the length of a buffer to write the MultiLineString geometry in its WKB format.

    Declaration
    [Obsolete("Will be removed in a future version.")]
    protected int SetByteStream(MultiLineString geometry)
    Parameters
    Type Name Description
    MultiLineString geometry

    The geometry

    Returns
    Type Description
    int

    The number of bytes required to store geometry in its WKB format.

    | Edit this page View Source

    SetByteStream(MultiPoint)

    Computes the length of a buffer to write the MultiPoint geometry in its WKB format.

    Declaration
    [Obsolete("Will be removed in a future version.")]
    protected int SetByteStream(MultiPoint geometry)
    Parameters
    Type Name Description
    MultiPoint geometry

    The geometry

    Returns
    Type Description
    int

    The number of bytes required to store geometry in its WKB format.

    | Edit this page View Source

    SetByteStream(MultiPolygon)

    Computes the length of a buffer to write the MultiPolygon geometry in its WKB format.

    Declaration
    [Obsolete("Will be removed in a future version.")]
    protected int SetByteStream(MultiPolygon geometry)
    Parameters
    Type Name Description
    MultiPolygon geometry

    The geometry

    Returns
    Type Description
    int

    The number of bytes required to store geometry in its WKB format.

    | Edit this page View Source

    SetByteStream(Point)

    Computes the length of a buffer to write the Point geometry in its WKB format.

    Declaration
    [Obsolete("Will be removed in a future version.")]
    protected int SetByteStream(Point geometry)
    Parameters
    Type Name Description
    Point geometry

    The geometry

    Returns
    Type Description
    int

    The number of bytes required to store geometry in its WKB format.

    | Edit this page View Source

    SetByteStream(Polygon)

    Computes the length of a buffer to write the Polygon geometry in its WKB format.

    Declaration
    [Obsolete("Will be removed in a future version.")]
    protected int SetByteStream(Polygon geometry)
    Parameters
    Type Name Description
    Polygon geometry

    The geometry

    Returns
    Type Description
    int

    The number of bytes required to store geometry in its WKB format.

    | Edit this page View Source

    ToHex(byte[])

    Converts a byte array to a hexadecimal string.

    Declaration
    public static string ToHex(byte[] bytes)
    Parameters
    Type Name Description
    byte[] bytes

    A byte array

    Returns
    Type Description
    string
    | Edit this page View Source

    Write(Coordinate, BinaryWriter)

    Write a Coordinate.

    Declaration
    [Obsolete("Will be removed in a future version")]
    protected void Write(Coordinate coordinate, BinaryWriter writer)
    Parameters
    Type Name Description
    Coordinate coordinate

    The coordinate

    BinaryWriter writer

    The writer.

    | Edit this page View Source

    Write(CoordinateSequence, bool, BinaryWriter)

    Write a CoordinateSequence.

    Declaration
    [Obsolete("Will be made private in a future version.")]
    protected void Write(CoordinateSequence sequence, bool emitSize, BinaryWriter writer)
    Parameters
    Type Name Description
    CoordinateSequence sequence

    The coordinate sequence to write

    bool emitSize

    A flag indicating if the size of sequence should be written, too.

    BinaryWriter writer

    The writer.

    | Edit this page View Source

    Write(Geometry)

    Writes a WKB representation of a given point.

    Declaration
    public virtual byte[] Write(Geometry geometry)
    Parameters
    Type Name Description
    Geometry geometry
    Returns
    Type Description
    byte[]
    | Edit this page View Source

    Write(Geometry, BinaryWriter)

    Declaration
    protected void Write(Geometry geometry, BinaryWriter writer)
    Parameters
    Type Name Description
    Geometry geometry
    BinaryWriter writer
    | Edit this page View Source

    Write(Geometry, Stream)

    Writes a WKB representation of a given point.

    Declaration
    public virtual void Write(Geometry geometry, Stream stream)
    Parameters
    Type Name Description
    Geometry geometry
    Stream stream
    | Edit this page View Source

    Write(GeometryCollection, BinaryWriter)

    Write a GeometryCollection in its WKB format

    Declaration
    [Obsolete("Will be removed in a future version.")]
    protected void Write(GeometryCollection geomCollection, BinaryWriter writer)
    Parameters
    Type Name Description
    GeometryCollection geomCollection

    The GeometryCollection

    BinaryWriter writer

    The writer

    | Edit this page View Source

    Write(LineString, BinaryWriter)

    Write a LineString in its WKB format

    Declaration
    [Obsolete("Will be removed in a future version.")]
    protected void Write(LineString lineString, BinaryWriter writer)
    Parameters
    Type Name Description
    LineString lineString

    The LineString

    BinaryWriter writer

    The writer

    | Edit this page View Source

    Write(LinearRing, BinaryWriter)

    Write LinearRing information

    Declaration
    [Obsolete("Will be removed in a future version.")]
    protected void Write(LinearRing ring, BinaryWriter writer)
    Parameters
    Type Name Description
    LinearRing ring

    The linear ring

    BinaryWriter writer

    The writer

    | Edit this page View Source

    Write(MultiLineString, BinaryWriter)

    Write a MultiLineString in its WKB format

    Declaration
    [Obsolete("Will be removed in a future version.")]
    protected void Write(MultiLineString multiLineString, BinaryWriter writer)
    Parameters
    Type Name Description
    MultiLineString multiLineString

    The MultiLineString

    BinaryWriter writer

    The writer

    | Edit this page View Source

    Write(MultiPoint, BinaryWriter)

    Write a MultiPoint in its WKB format

    Declaration
    [Obsolete("Will be removed in a future version.")]
    protected void Write(MultiPoint multiPoint, BinaryWriter writer)
    Parameters
    Type Name Description
    MultiPoint multiPoint

    The MultiPoint

    BinaryWriter writer

    The writer

    | Edit this page View Source

    Write(MultiPolygon, BinaryWriter)

    Write a MultiPolygon in its WKB format

    Declaration
    [Obsolete("Will be removed in a future version.")]
    protected void Write(MultiPolygon multiPolygon, BinaryWriter writer)
    Parameters
    Type Name Description
    MultiPolygon multiPolygon

    The MultiPolygon

    BinaryWriter writer

    The writer

    | Edit this page View Source

    Write(Point, BinaryWriter)

    Write a point in its WKB format

    Declaration
    [Obsolete("Will be removed in a future version.")]
    protected void Write(Point point, BinaryWriter writer)
    Parameters
    Type Name Description
    Point point

    The point

    BinaryWriter writer

    The writer

    | Edit this page View Source

    Write(Polygon, BinaryWriter)

    Write a Polygon in its WKB format

    Declaration
    [Obsolete("Will be removed in a future version.")]
    protected void Write(Polygon polygon, BinaryWriter writer)
    Parameters
    Type Name Description
    Polygon polygon

    The Polygon

    BinaryWriter writer

    The writer

    | Edit this page View Source

    WriteByteOrder(BinaryWriter)

    Writes the ByteOrder defined in EncodingType.

    Declaration
    [Obsolete("Will be made private in a future version.")]
    protected void WriteByteOrder(BinaryWriter writer)
    Parameters
    Type Name Description
    BinaryWriter writer

    The writer to use

    • Edit this page
    • View Source
    In this article
    Back to top Generated by DocFX