Skip to main content

sql_queries

CameraColumn Objects

class CameraColumn()

Convert the name and type to an sql.Identifier

format_db_entry

def format_db_entry(event: dict, polys: List[str]) -> list

Specific function to match incoming flight data with polygons as a DB INSERT query

Parameters

event : dict containing keys coords (list of camera references) and flight (information about the flight) polys : List[str] list of the WKT representation of the polygons representing camera coverage

Returns

list a matched list between flight information, camera references and WKT

update_flight_cameras

def update_flight_cameras(image_list: list, crs: Optional[int])

Query wrapper to insert the image references into the cameras table

Parameters

image_list : list list of image names crs : Optional[int] EPSG code, defaults to 4326

index

CameraReference Objects

class CameraReference()

A Camera georeference object

Returns

type The camera reference object

is_unprojected

def is_unprojected() -> bool

Checks if coordinate pair is projected or not

Returns

bool True if data is unprojected

get_user_crs

def get_user_crs(job: str) -> Optional[int]

Function to get specific CRS user data from dynamo job records table

Parameters

job : str The Job ID

Returns

Optional[int] The CRS ID

reproject_point

def reproject_point(latitude: float, longitude: float,
crs: Optional[Union[int, str]]) -> tuple

Function reprojects to 4326

Parameters

latitude : float projected latitude coordinate longitude : float projected longitude coordinate crs : Union[int, str] source EPSG code

Returns

tuple Reproject coordinate based on EPSG code to 4326, will return unprojected when input CRS is 4326.

get_polygon_from_point

def get_polygon_from_point(input_list: list,
dem: str,
crs: Optional[int] = None) -> List[str]

Function that uses image references to generate a list of polygon WKTs

Parameters

input_list : list list with coordinates and time if not ordered. The input of the list always needs the same structure. Label, time, latitude, longitude, altitude as provided by dictionaries.rosetta. There are other values that will be parsed into the database. dem : str a digital elevation model

Returns

List[str] polygon WKTs

Raises

IndexError raised when wrong number of columns are injected IndexError raised when there is no overlap with existing DEM