ArcGIS Pro 3.7 API Reference Guide
ArcGIS.Core.Geometry Namespace / IGeometryEngine Interface / GetWKBSize Method
A combination of WkbExportFlags which determines how the geometry is exported.
The geometry to export.
Example

In This Topic
    GetWKBSize Method (IGeometryEngine)
    In This Topic
    Returns the size of the buffer in bytes that will be required to hold the OGC well-known binary version of the input geometry.
    Syntax

    Parameters

    exportFlags
    A combination of WkbExportFlags which determines how the geometry is exported.
    geometry
    The geometry to export.

    Return Value

    The size of the buffer.
    Exceptions
    ExceptionDescription
    Geometry is null or empty.
    The method is not implemented for GeometryBag or Multipatch.
    The method is not implemented for geometry with curves.
    Remarks
    Does not support curves.
    Example
    Import and Export Geometries to well-known Binary
    {
      // create a polyline
      List<Coordinate2D> coords = new List<Coordinate2D>
      {
        new Coordinate2D(0, 0),
        new Coordinate2D(0, 1),
        new Coordinate2D(1, 1),
        new Coordinate2D(1, 0)
      };
    
      polyline = PolylineBuilderEx.CreatePolyline(
                  coords, SpatialReferences.WGS84);
    
      WkbExportFlags wkbExportFlags = WkbExportFlags.WkbExportDefaults;
      WkbImportFlags wkbImportFlags = WkbImportFlags.WkbImportDefaults;
    
      // export and import
      byte[] buffer = GeometryEngine.Instance.ExportToWKB(wkbExportFlags, polyline);
      geometry = GeometryEngine.Instance.ImportFromWKB(
                     wkbImportFlags, buffer, SpatialReferences.WGS84);
      Polyline importPolyline = geometry as Polyline;
    
    
      // alternatively, determine the size for the buffer
      int bufferSize = GeometryEngine.Instance.GetWKBSize(wkbExportFlags, polyline);
      buffer = new byte[bufferSize];
      // export
      bufferSize = GeometryEngine.Instance.ExportToWKB(
                      wkbExportFlags, polyline, ref buffer);
      // import
      importPolyline = GeometryEngine.Instance.ImportFromWKB(
               wkbImportFlags, buffer, SpatialReferences.WGS84) as Polyline;
    }
    Requirements

    Target Platforms: Windows 11 Home, Pro, Enterprise (64 bit)

    ArcGIS Pro version: 3.0 or higher.
    See Also