Class Unit

  • Direct Known Subclasses:
    AngularUnit, AreaUnit, LinearUnit

    public class Unit
    extends Object
    Represents a specific unit of measurement. Unit is a base class inherited by different types of unit class, each representing a different system of measurement - for example, linear, area, and angular units.

    Instances of Unit representing the most commonly used units of measurement can be created by using the constructors found on the subclasses LinearUnit, AngularUnit, and AreaUnit. Alternatively call the fromUnitId(int) factory method on this class, passing in a well-known ID of a specific unit of measurement. Instances of Unit are immutable. They are used in measurement functions and spatial references.

    Different units of measurement have different ID numbers, often known as Well-Known IDs (WKIDs). The WKID of a Unit is returned by the getUnitId() method. The supported WKIDs for angular, linear, and area units are documented in the 'Geographic coordinate systems' and 'Projected coordinate systems' tables in the developer Guide.

    All unit names and abbreviations are returned in English.

    Since:
    100.0.0
    See Also:
    SpatialReference.getUnit()
    • Method Detail

      • getUnitId

        public int getUnitId()
        Gets the well-known ID (WKID) of this unit of measurement.

        WKIDs are defined by standards bodies or organizations. ArcGIS supports a variety of WKIDs, typically those defined by the European Petroleum Survey Group (EPSG) or Esri, as well as a few other commonly used IDs. Unit WKIDs are unique across all subclasses - AngularUnit, LinearUnit, and AreaUnit. The supported WKIDs for angular, linear, and area units are documented in the 'Geographic coordinate systems' and 'Projected coordinate systems' tables in the developer Guide.

        Returns:
        the well-known ID of this Unit instance
        Since:
        100.0.0
      • getAbbreviation

        public String getAbbreviation()
        Gets the common abbreviation of the English name of this unit of measurement, for example 'm' for meters.
        Returns:
        the abbreviation of the name of this Unit
        Since:
        100.0.0
        See Also:
        getDisplayName()
      • getDisplayName

        public String getDisplayName()
        Gets the English display name of the unit, suitable for displaying in a user interface. Alternatively, use the getPluralDisplayName() method to return the correct display name for the plural of the unit. Use the getAbbreviation() method to return the standard abbreviated form of this name.
        Returns:
        the display name of this Unit
        Since:
        100.0.0
      • getUnitType

        public UnitType getUnitType()
        Gets the type of this unit of measurement, linear, area, or angular. Different types of Unit are used in different measurement functions.
        Returns:
        the type of this Unit
        Since:
        100.0.0
      • getPluralDisplayName

        public String getPluralDisplayName()
        Gets the English display name for the plural of this unit of measurement, suitable for displaying in a user interface when the number of units is greater than one. Alternatively, use the getDisplayName() method to return the correct display name for the singular of this unit.
        Returns:
        the plural display name of this Unit
        Since:
        100.0.0
      • fromUnitId

        public static Unit fromUnitId​(int unitId)
        Creates a new Unit instance with the given well-known ID (WKID). Call getUnitType() on the returned Unit to determine the specific UnitType (angular, area, or linear). The supported WKIDs for angular, linear, and area units are documented in the 'Geographic coordinate systems' and 'Projected coordinate system' tables in the developer Guide.
        Parameters:
        unitId - the ID of the new Unit
        Returns:
        a new Unit instance representing the unit of measurement defined by the given ID
        Since:
        100.0.0