Bounds#
- class silvimetric.resources.bounds.Bounds(minx: float, miny: float, maxx: float, maxy: float)#
Simple class to represent a 2 or 3-dimensional bounding box that can be generated from both JSON or PDAL bounds form.
- adjust_to_cell_lines(resolution)#
- bisect()#
Bisects the current Bounds
- Yield:
4 child bounds
- disjoint(other)#
Determine if two bounds are disjointed
- Parameters:
other – Bounds this object is being compared to
- Returns:
True if this box shares no point with the other box, otherwise False
- static from_string(bbox_str: str)#
Create Bounds object from a PDAL bounds string in the form:
“([1,101],[2,102],[3,103])” “{“minx”: 1,”miny”: 2,”maxx”: 101,”maxy”: 102}” “[1,2,101,102]” “[1,2,3,101,102,103]”
- Parameters:
bbox_str – Bounds string
- Raises:
Exception – Unable to load Bounds via json or PDAL bounds type
Exception – Bounding boxes must have either 4 or 6 elements
- Returns:
Bounds object
- get() list[float] #
Return Bounds as a list of floats
- Returns:
list of floats in form [minx, miny, maxx, maxy]
- maxx#
maximum X plane
- maxy#
maximum Y plane
- minx#
minimum X Plane
- miny#
minimum Y plane
Find the Bounds that is shared between two Bounds.
- Parameters:
first – First Bounds object for comparison.
second – Second Bounds object for comparison.
- Returns:
None if there is no overlap, otherwise the shared Bounds
- to_json() list[float] #
Return object as a json serializable list
- Returns:
list of floats in form [minx, miny, maxx, maxy]
- to_string() str #
Return string representation of Bounds
- Returns:
string of a list of floats in form [minx, miny, maxx, maxy]