Skip to content
  • DiscreteField
  • class Esri::ArcGISRuntime::DiscreteField

    Discrete integer values associated with each point across a two-dimensional (x, y) extent. More...

    Header: #include <DiscreteField.h>
    Since: Esri::ArcGISRuntime 300.0
    Inherits: Esri::ArcGISRuntime::Object

    Public Functions

    virtual ~DiscreteField() override
    QFuture<QStringList> exportToFilesAsync(const QString &outputDirectory, const QString &filenamesPrefix)
    Esri::ArcGISRuntime::Envelope extent() const

    Static Public Members

    QFuture<Esri::ArcGISRuntime::DiscreteField *> createFromFilesAsync(const QStringList &filePaths, int band, QObject *parent = nullptr)
    QFuture<Esri::ArcGISRuntime::DiscreteField *> createFromFilesAsync(const QStringList &filePaths, int band, const Esri::ArcGISRuntime::SpatialReference &spatialReference, QObject *parent = nullptr)

    Detailed Description

    Discrete fields are sometimes called thematic, categorical, or discontinuous data. They most often represent objects with known and definable boundaries. A lake is a discrete object within the surrounding landscape. Where the water’s edge meets the land can be definitively established. Other examples of discrete objects include buildings, roads, and parcels. Discrete objects are usually nouns.

    Examples of discrete fields:

    • Land classification
    • Boundaries
    • Parcels

    Relevant samples:

    • Apply map algebra: Apply map algebra to an elevation raster to floor, mask, and categorize the elevation values into discrete integer-based categories.

    See also BooleanField, ContinuousField, DiscreteFieldFunction, and DiscreteFieldFunction::evaluateAsync.

    Member Function Documentation

    [override virtual noexcept] DiscreteField::~DiscreteField()

    Destructor.

    [static] QFuture<Esri::ArcGISRuntime::DiscreteField *> DiscreteField::createFromFilesAsync(const QStringList &filePaths, int band, QObject *parent = nullptr)

    Create a discrete field from one or more raster files.

    • filePaths - One or more raster file paths.
    • band - Zero-based index identifying a raster band.
    • parent - The optional parent.

    The field will be in the spatial reference of the first raster file.

    The field extent is the union of the raster file extents.

    There will be an error if creation of a DiscreteField is unsuccessful.

    This method returns a QFuture for the asynchronous operation. Use future.then() to continue processing when the operation completes. Use future.onFailed() to handle exceptions of type ErrorException.

    See Working with QFuture for further details.

    See also exportToFilesAsync(const QString&, const QString&) and TransformationCatalog::transformationsBySuitability.

    [static] QFuture<Esri::ArcGISRuntime::DiscreteField *> DiscreteField::createFromFilesAsync(const QStringList &filePaths, int band, const Esri::ArcGISRuntime::SpatialReference &spatialReference, QObject *parent = nullptr)

    Creates a discrete field from one or more raster files.

    • filePaths - One or more raster file paths.
    • band - Zero-based index identifying a raster band.
    • spatialReference - The spatial reference into which to project the raster content.
    • parent - The optional parent.

    If no spatial reference is given, the spatial reference of the first raster file is used.

    If a spatial reference is given, the raster content is projected into that spatial reference using the most suitable transformation available. Projection transforms only the horizontal coordinate system, not the field values.

    The field extent is the union of the raster file extents.

    Supports reading of all raster pixel types except float (32-bit or 64-bit). 32-bit signed integer data is supported for rasters that don't contain values greater than 2147483647. If values exceed this, creation of the field will fail. Returns an error if creation of a DiscreteField is unsuccessful.

    This method returns a QFuture for the asynchronous operation. Use future.then() to continue processing when the operation completes. Use future.onFailed() to handle exceptions of type ErrorException.

    See Working with QFuture for further details.

    See also exportToFilesAsync(const QString&, const QString&) and TransformationCatalog::transformationsBySuitability.

    QFuture<QStringList> DiscreteField::exportToFilesAsync(const QString &outputDirectory, const QString &filenamesPrefix)

    Export the DiscreteField to files in geoTIFF format.

    • outputDirectory - The location of the exported files.
    • filenamesPrefix - The filename prefix of the exported files.

    This enables a DiscreteField to be saved, persisted, and shared.

    Regardless of the original data format:

    • A DiscreteField is always exported as 32-bit signed integer data
    • A value of -2147483647 is used to represent NoData in the exported files

    Small spatial fields are saved as a single file named outputDirectory/filenamesPrefix.tiff. Large spatial fields will be saved as multiple files using the following naming convention: outputDirectory/filenamesPrefix_0.tiff, outputDirectory/filenamesPrefix_1.tiff, ..., outputDirectory/filenamesPrefix_N.tiff. The decision to save a field as multiple files is automatic, and depends on the amount of information contained within the field, and the memory resources available on the host device. The .tiff extension is automatically appended to each file name.

    The output directory is expected to exist and have appropriate write permissions. There should be no existing files at the export location(s).

    To read a DiscreteField from files created by this method, use createFromFilesAsync(const QStringList&, int, const Esri::ArcGISRuntime::SpatialReference&, QObject*) with the paths returned from this method and a band identifier of 0.

    An error is returned if file export is unsuccessful.

    This method returns a QFuture for the asynchronous operation. Use future.then() to continue processing when the operation completes. Use future.onFailed() to handle exceptions of type ErrorException.

    See Working with QFuture for further details.

    See also createFromFilesAsync(const QStringList&, int, const Esri::ArcGISRuntime::SpatialReference&, QObject*).

    Esri::ArcGISRuntime::Envelope DiscreteField::extent() const

    Returns the geographic extent of the discrete field.

    An extent may be empty, indicating there is no data across the two-dimensional space. This may occur when performing operations on two spatial fields that do not intersect.

    See also Geometry::isEmpty.

    Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.