Images

In this section, we revisit the gdalworkshop/world.tif dataset.

dataset = ArchGDAL.read("gdalworkshop/world.tif")
GDAL Dataset (Driver: GTiff/GeoTIFF)
File(s): 

Dataset (width x height): 2048 x 1024 (pixels)
Number of raster bands: 3
  [GA_ReadOnly] Band 1 (Red): 2048 x 1024 (UInt8)
  [GA_ReadOnly] Band 2 (Green): 2048 x 1024 (UInt8)
  [GA_ReadOnly] Band 3 (Blue): 2048 x 1024 (UInt8)

A description of the display is available in Raster Datasets.

Reading from Datasets

We can construct an image from it in the following way:

ArchGDAL.imread(dataset)

Reading from Files

We can read the file as an image instead:

ArchGDAL.imread("gdalworkshop/world.tif")

Reading from Rasterbands

We can also read from individual raster bands:

ArchGDAL.imread(ArchGDAL.getband(dataset, 1))

Or equivalently,

ArchGDAL.imread(dataset, 1)

It will interpret the color channel (for RGB) correctly if there is one. E.g.

ArchGDAL.imread(dataset, 2)

and

ArchGDAL.imread(dataset, 3)

Working with Colors

Operations on colors behave as you think they might:

ArchGDAL.imread(dataset, 2) + ArchGDAL.imread(dataset, 3)

and

0.5 * ArchGDAL.imread(dataset, 1) + ArchGDAL.imread(dataset, 3)

See Colors.jl for more on what you can do.