# GDALDimension C++ API

## Include file

gdal_multidim.h

## GDALDimension class

class GDALDimension

  Class modeling a a dimension / axis used to index multidimensional arrays.

  It has a name, a size (that is the number of values that can be indexed along the dimension), a type (see GDALDimension::GetType()), a direction (see GDALDimension::GetDirection()), a unit and can optionally point to a GDALMDArray variable, typically one-dimensional, describing the values taken by the dimension. For a georeferenced GDALMDArray and its X dimension, this will be typically the values of the easting/longitude for each grid point.

  Since

    GDAL 3.1

  Public Functions

  inline const std::string &GetName() const

    Return the name.

    This is the same as the C function GDALDimensionGetName()

  inline const std::string &GetFullName() const

    Return the full name.

    This is the same as the C function GDALDimensionGetFullName()

  inline const std::string &GetType() const

    Return the axis type.

    Predefined values are: HORIZONTAL_X, HORIZONTAL_Y, VERTICAL, TEMPORAL, PARAMETRIC Other values might be returned. Empty value means unknown.

    This is the same as the C function GDALDimensionGetType()

  inline const std::string &GetDirection() const

    Return the axis direction.

    Predefined values are: EAST, WEST, SOUTH, NORTH, UP, DOWN, FUTURE, PAST Other values might be returned. Empty value means unknown.

    This is the same as the C function GDALDimensionGetDirection()

  inline GUInt64 GetSize() const

    Return the size, that is the number of values along the dimension.

    This is the same as the C function GDALDimensionGetSize()

  virtual std::shared_ptr<GDALMDArray> GetIndexingVariable() const

    Return the variable that is used to index the dimension (if there is one).

    This is the array, typically one-dimensional, describing the values taken by the dimension.

  virtual bool SetIndexingVariable(std::shared_ptr<GDALMDArray> poIndexingVariable)

    Set the variable that is used to index the dimension.

    This is the array, typically one-dimensional, describing the values taken by the dimension.

    Optionally implemented by drivers.

    Drivers known to implement it: MEM.

    Parameters:

      poArray -- Variable to use to index the dimension.

    Returns:

      true in case of success.

  virtual bool Rename(const std::string &osNewName)

    Rename the dimension.

    This is not implemented by all drivers.

    Drivers known to implement it: MEM, netCDF, ZARR.

    This is the same as the C function GDALDimensionRename().

    Since

      GDAL 3.8

    Parameters:

      osNewName -- New name.

    Returns:

      true in case of success