ArcGIS Pro 3.0 API Reference Guide
ArcGIS.Core.Geometry Namespace / EsriShapeExportFlags Enumeration
Example Example

In This Topic
    EsriShapeExportFlags Enumeration
    In This Topic
    Specifies the flags that control the behavior of the GeometryEngine.ExportToEsriShape and GeometryEngine.ExportToEsriShape methods.
    Syntax
    Members
    MemberDescription
    EsriShapeExportAngularDensify Exports densified versions of non-linear segments. Generates new vertices at constant angles along those segments.
    EsriShapeExportDefaults Exports curves, Z-values, and M-values. Performs byte swapping if the current platform architecture is big-endian.
    EsriShapeExportDistanceDensify Exports densified versions of non-linear segments. Generates new vertices using a Douglas-Peucker style algorithm.
    EsriShapeExportNoCompress Does not compress the output shapefile buffer.
    EsriShapeExportNoSwap Does not perform byte swapping on the output shapefile buffer.
    EsriShapeExportStripMaterials Removes materials attributes from exported multipatch.
    EsriShapeExportStripMs Removes M values from exported shape.
    EsriShapeExportStripNormals Removes normals from exported multipatch.
    EsriShapeExportStripTextures Removes textures from exported multipatch.
    EsriShapeExportStripZs Removes Z values from exported shape.
    EsriShapeExportTrueNaNs Exports undefined double precision values as true NaNs (IEEE Non-A-Number). The default is to use large, negative values.
    Example
    Import and Export Geometries to EsriShape
    // create an envelope
    List<MapPoint> coordsZM = new List<MapPoint>
    {
      MapPointBuilderEx.CreateMapPoint(1001, 1002, 1003, 1004),
      MapPointBuilderEx.CreateMapPoint(2001, 2002, Double.NaN, 2004),
      MapPointBuilderEx.CreateMapPoint(3001, -3002, 3003, 3004),
      MapPointBuilderEx.CreateMapPoint(1001, -4002, 4003, 4004)
    };
    
    Envelope envelope = EnvelopeBuilderEx.CreateEnvelope(
               coordsZM[0], coordsZM[2], SpatialReferences.WGS84);
    
    // export and import
    EsriShapeExportFlags exportFlags = EsriShapeExportFlags.EsriShapeExportDefaults;
    EsriShapeImportFlags importFlags = EsriShapeImportFlags.EsriShapeImportDefaults;
    byte[] buffer = GeometryEngine.Instance.ExportToEsriShape(exportFlags, envelope);
    Polygon importedPolygon = GeometryEngine.Instance.ImportFromEsriShape(
                   importFlags, buffer, envelope.SpatialReference) as Polygon;
    Envelope importedEnvelope = importedPolygon.Extent;
    
    // export without z,m
    buffer = GeometryEngine.Instance.ExportToEsriShape(
            EsriShapeExportFlags.EsriShapeExportStripZs | 
            EsriShapeExportFlags.EsriShapeExportStripMs, envelope);
    importedPolygon = GeometryEngine.Instance.ImportFromEsriShape(
            importFlags, buffer, SpatialReferences.WGS84) as Polygon;
    importedEnvelope = importedPolygon.Extent;
    
    bool hasZ = importedEnvelope.HasZ;      // hasZ = false
    bool hasM = importedEnvelope.HasM;      // hasM = false
    
    // export with shapeSize
    int bufferSize = GeometryEngine.Instance.GetEsriShapeSize(
                                           exportFlags, envelope);
    buffer = new byte[bufferSize];
    
    bufferSize = GeometryEngine.Instance.ExportToEsriShape(
                                 exportFlags, envelope, ref buffer);
    importedPolygon = GeometryEngine.Instance.ImportFromEsriShape(
                        importFlags, buffer, envelope.SpatialReference) as Polygon;
    importedEnvelope = importedPolygon.Extent;
    
    
    // or use the envelope and envelopeBuilderEx classes
    buffer = envelope.ToEsriShape();
    // buffer represents a polygon as there is not an envelope Esri shape buffer
    // EnvelopeBuilderEx.FromEsriShape takes a polygon Esri shape buffer and returns the extent of the polygon.
    importedEnvelope = EnvelopeBuilderEx.FromEsriShape(buffer);
    
    Inheritance Hierarchy

    System.Object
       System.ValueType
          System.Enum
             ArcGIS.Core.Geometry.EsriShapeExportFlags

    Requirements

    Target Platforms: Windows 11, Windows 10, Windows 8.1

    See Also