exportToFiles

suspend fun exportToFiles(outputDirectory: String, filenamesPrefix: String): Result<List<String>>

Export the DiscreteField to files in geoTIFF format. 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.

To read a DiscreteField from files created by this method, use DiscreteField.createFromFiles with the paths returned from this method and a band identifier of 0.

An error is returned if file export is unsuccessful.

Return

A Result containing the paths of saved geoTIFF files, or an error if file export is unsuccessful.

Since

300.0.0

Parameters

outputDirectory

The location of the exported files.

filenamesPrefix

The filename prefix of the exported files.

See also