ArcGIS Pro 3.2 API Reference Guide
ArcGIS.Core.Geometry Namespace / MapPoint Class / IsEmpty Property
Example

In This Topic
    IsEmpty Property (MapPoint)
    In This Topic
    Gets a value indicating whether or not the geometry is empty.
    Syntax
    public override bool IsEmpty {get;}
    Public Overrides NotOverridable ReadOnly Property IsEmpty As Boolean
    Example
    MapPoint Builder Properties
    // MapPointBuilderEx constructors can run on any thread.
    
    MapPoint point1 = null;
    MapPoint point2 = null;
    
    SpatialReference spatialReference = SpatialReferenceBuilder.CreateSpatialReference(54004);
            
    MapPointBuilderEx mapPointBuilder = new MapPointBuilderEx(100, 200, spatialReference);
    SpatialReference sr = mapPointBuilder.SpatialReference; // sr != null
    int wkid = sr.Wkid; // wkid = 54004
    bool hasZ = mapPointBuilder.HasZ;   // hasZ = false
    bool hasM = mapPointBuilder.HasM;   // hasM = false
    bool hasID = mapPointBuilder.HasID; // hasID = false
    bool isEmpty = mapPointBuilder.IsEmpty; // isEmpty = false
    double x = mapPointBuilder.X;   // x = 100
    double y = mapPointBuilder.Y;   // y = 200
    double z = mapPointBuilder.Z;   // z = 0, default value
    double m = mapPointBuilder.M;   // m is NaN, default value
    double id = mapPointBuilder.ID; // id = 0, default value
    
    // Do something with the builder
    mapPointBuilder.Z = 12; // Setting the z-value automatically sets HasZ property to true
    
    point1 = mapPointBuilder.ToGeometry();
    sr = point1.SpatialReference; // sr != null
    wkid = sr.Wkid; // wkid = 54004
    hasZ = point1.HasZ;   // hasZ = true
    hasM = point1.HasM;   // hasM = false
    hasID = point1.HasID; // hasID = false
    x = point1.X;   // x = 100
    y = point1.Y;   // y = 200
    z = point1.Z;   // z = 12
    m = point1.M;   // m is NaN, default value
    id = point1.ID; // id = 0, default value
    
    // Change some of the builder properties
    mapPointBuilder.SetValues(11, 22);
    mapPointBuilder.HasZ = false;
    mapPointBuilder.HasM = true;
    mapPointBuilder.M = 44;
            
    // Create another point
    point2 = mapPointBuilder.ToGeometry();
    
    bool isEqual = point1.IsEqual(point2); // isEqual = false
    
    // Set the builder to empty
    // Sets X and Y to NaN. Sets other attributes to the default values.
    // Does not change the attribute awareness.
    mapPointBuilder.SetEmpty();
    
    MapPoint point3 = mapPointBuilder.ToGeometry();
    sr = point3.SpatialReference; // sr != null
    wkid = sr.Wkid; // wkid = 54004
    hasZ = point3.HasZ;        // hasZ = false
    hasM = point3.HasM;        // hasM = true
    hasID = point3.HasID;      // hasID = false
    isEmpty = point3.IsEmpty;  // isEmpty = true
    x = point3.X;              // x is NaN
    y = point3.Y;              // y is NaN
    z = point3.Z;              // z = 0, default value
    m = point3.M;              // m is NaN, default value
    id = point3.ID;            // ID = 0, default value
    
    // Create a builder from a point
    mapPointBuilder = new MapPointBuilderEx(point2); // point1 = (11, 22, 0, 44, 0)
    sr = mapPointBuilder.SpatialReference; // sr != null
    wkid = sr.Wkid; // wkid = 54004
    hasZ = mapPointBuilder.HasZ;        // hasZ = false
    hasM = mapPointBuilder.HasM;        // hasM = true
    hasID = mapPointBuilder.HasID;      // hasID = false
    isEmpty = mapPointBuilder.IsEmpty;  // isEmpty = false
    x = mapPointBuilder.X;              // x = 11
    y = mapPointBuilder.Y;              // y = 22
    z = mapPointBuilder.Z;              // z = 0, default value
    m = mapPointBuilder.M;              // m = 44
    id = mapPointBuilder.ID;            // ID = 0, default value
    
    // Setting attribute values automatically sets the corresponding flag to true
    mapPointBuilder.Z = 150;
    mapPointBuilder.ID = 2;
    
    // Remove the spatial reference
    mapPointBuilder.SpatialReference = null;
            
    MapPoint point4 = mapPointBuilder.ToGeometry() as MapPoint;
    sr = point3.SpatialReference; // sr = null
    hasZ = point3.HasZ;        // hasZ = true
    hasM = point3.HasM;        // hasM = true
    hasID = point3.HasID;      // hasID = true
    isEmpty = point3.IsEmpty;  // isEmpty = false
    x = point3.X;              // x = 11
    y = point3.Y;              // y = 22
    z = point3.Z;              // z = 150
    m = point3.M;              // m = 44
    id = point3.ID;            // ID = 2
    
    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3 or higher.
    See Also