Skip to main content

index

Objects

BaseInput

@dataclass
class BaseInput()

Base input event.

Attributes:

  • layername str - name of the layer.
  • prefix str - object path to the file.
  • api_id int, optional - a geoserver ID. Can be neglected when legacy is True.
  • bucket str, optional - the data bucket. Defaults to SOURCE_BUCKET.
  • date str, datetime.date, optional - date in YYYYmmDD or YYYY-mm-DD format. Can be generated from setting order_id.
  • force_upload bool - switch to force an upload. This negates the DynamoDB status and layer requirements. Defaults to False.
  • geoserver_url dict | str, optional - a Geoserver url. Can be neglected when legacy is True.
  • job_id str - the job ID. Defaults to "".
  • legacy bool - switch to set the layer build to a Legacy solution. Defaults to False.
  • order_id int, optional - the order ID.
  • preserve_data bool, optional - preserve the attribute/properties of a geometry file. Defaults to False.
  • status bool - update the status in the Job record. Defaults to True.
  • validate bool - run a geometry validation. These results are written to the logs. Defaults to False.
  • workspace str, optional - name of the workspace.

Raises:

  • HTTPError - raised when a Geoserver cannot be found.

Functions

lambda_handler

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

Lambda handler to build vectors in target database

Arguments:

  • event dict - Input event, should fit BaseInput.
  • context dict - Request context used for authentication.

Raises:

  • ReferenceError - Server location cannot be found from internal system.
  • HTTPError - Server url cannot be found.
  • IndexError - Caught but followed by a FileNotFoundError.
  • FileNotFoundError - Input geometry files were not found in file storage or databases.
  • ShapelyError - Geometry specific errors
  • e - Generic output exception.

Returns:

  • dict - source event with any appended information.

Examples:

{
"layername": "some-layer",
"prefix": "path/to/the/object.shp",
"api_id": 1337,
"bucket": "some-bucket",
"date": "20120110",
"force_upload": false,
"geoserver_url": "https://some-geoserver-url/geoserver",
"job_id": "2389u93h3-1337-f3948hf394bf3874gf",
"legacy": false,
"order_id": 1337,
"preserve_date": true,
"status": true,
"validate": false,
"workspace": "some-workspace"
}