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:
tilestr - Input gdal dataset object or str of .tiff tilebucketstr - 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:
tileUnion[gdal.Dataset, str] - Input gdal dataset object or str of .tiff tilebucketstr - 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:
prefixstr - Input s3 key which holds all the tiles to be referenced.bucketstr | None, optional - Input bucket for tile location. Defaults toSOURCE_BUCKET.outputstr, optional - Write to file to a specific output otherwise default to prefix metadata location. Defaults to"".cogbool, optional - Switch to select a COG, default behaviour skips COG files. Defaults toFalse.metadatabool, optional - Switch to write to metadata folder (true) or prefix location (false). Defaults toTrue.
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:
eventdict - Input event json/dictionary.contextdict - 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
}