Skip to main content

index

Objects

Options

@dataclass
class Options()

Wrapper data class around the GDAL optionas.

Attributes:

  • compression Literal["DEFLATE", "LZW"] - compression algorithm to use. Defaults to DEFLATE.
  • tiled Literal["YES", "NO"] - use internal tiling. Defaults to YES
  • window List[float | int], optional - a GDAL search window.

generate_options

def generate_options(raster: gdal.Dataset) -> gdal.GDALTranslateOptions

Wrapper around the gdal.TranslateOptions() function.

Arguments:

  • raster gdal.Dataset - input raster data.

Returns:

  • gdal.GDALTranslateOptions - a GDAL options object.

Tile

@dataclass
class Tile()

Representation of a tile by filename and origin and tilesize.

Attributes:

  • key str - an object name.
  • bbox List[float | int] - bounding box information in the format of origin_x, origin_y, tilesize_x, tilesize_y. Mostly tilesize_x and tilesize_y are equal.

BaseInput

@dataclass
class BaseInput()

Input for running the main lambda handler.

Attributes:

  • item Tile | dict - input tile information.
  • options - (Options | str, optional): Input GDAL options for writing tiles.
  • prefix str - Input source raster data Raster data (GTiff) to read the search window from.
  • bucket str, optional - Input bucket name S3 to read source data from. Defaults to SOURCE_BUCKET
  • target_bucket str, optional - Output bucket name. Defaults to TARGET_BUCKET

Functions

lambda_handler

@tracer.capture_lambda_handler
@logger.inject_lambda_context()
def lambda_handler(event: dict, context: dict)

Lambda event handler to generate a tile

Arguments:

  • event dict - a BaseInput object.
  • context dict - lambda context object.

Examples:

{
"item": {
"key": "some-filename.tiff",
"bbox": [0, 0 , 500, 500]
},
"options": {
"compression": "LZW",
"tiled": "NO",
"window": [25, 25, 50, 50]
},
"prefix": "some-filename.tiff",
"bucket": "some-bucket",
"target_bucket": "some-target-bucket"
}