Skip to main content

index

Functions

get_tiff_bounds

def get_tiff_bounds(tile: str, bucket: str) -> dict

Function to collect the tile bounds in a format specific for geojson ingestion.

Arguments:

  • tile str - Input gdal dataset object or str of .tiff tile
  • bucket str - Input bucket for tile location

Returns:

  • dict - Output dictionary in geojson specific format

Examples:

get_tiff_bounds(
tile="/some/tile.tiff"
bucket="some-bucket"
)

get_crs

def get_crs(tile: Union[gdal.Dataset, str], bucket: str) -> int

Function to get CRS integer using GDAL only libraries

Arguments:

  • tile Union[gdal.Dataset, str] - Input gdal dataset object or str of .tiff tile
  • bucket str - Input bucket for tile location

Returns:

  • int - Integer of EPSG

Examples:

get_crs(
tile="some/tile.tiff",
bucket="some-bucket"
)

write_tile_scheme

def write_tile_scheme(prefix: str,
bucket: str | None = SOURCE_BUCKET,
output: str | None = "",
cog: bool = False,
metadata: bool = True) -> str

Function to read all the tiles within the prefix, clean any unwanted objects from the list, generate the geojson and upload this geojson to the metadata directory.

Arguments:

  • prefix str - Input s3 key which holds all the tiles to be referenced.
  • bucket str | None, optional - Input bucket for tile location. Defaults to SOURCE_BUCKET.
  • output str, optional - Write to file to a specific output otherwise default to prefix metadata location. Defaults to "".
  • cog bool, optional - Switch to select a COG, default behaviour skips COG files. Defaults to False.
  • metadata bool, optional - Switch to write to metadata folder (true) or prefix location (false). Defaults to True.

Returns:

  • str - Ouput location of tile scheme geojson

Examples:

write_tile_scheme(
prefix="some/tile.tiff",
bucket="some-bucket",
output="bounds.json"
)

lambda_handler

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

Lambda event handler to generate tile scheme geojson for lookup purposes.

Arguments:

  • event dict - Input event json/dictionary.
  • context dict - lambda context object.

Returns:

  • dict - source event with key "output" holding the output geojson path.

Examples:

{
"prefix": "some/tiled/data/path/",
"bucket": "some-bucket",
"output": "some/output/path/",
"cog": false,
"metadata": true
}