BoundingBox
dataclass
Bases: Iterable[Coordinate]
A bounding box specifies the spatial extent of an area of interest.
ATTRIBUTE | DESCRIPTION |
---|---|
x_min |
minimum x coordinate
TYPE:
|
y_min |
minimum y coordinate
TYPE:
|
x_max |
maximum x coordinate
TYPE:
|
y_max |
maximum y coordinate
TYPE:
|
x_min: Coordinate
property
writable
RETURNS | DESCRIPTION |
---|---|
Coordinate
|
minimum x coordinate |
y_min: Coordinate
property
writable
RETURNS | DESCRIPTION |
---|---|
Coordinate
|
minimum y coordinate |
x_max: Coordinate
property
writable
RETURNS | DESCRIPTION |
---|---|
Coordinate
|
maximum x coordinate |
y_max: Coordinate
property
writable
RETURNS | DESCRIPTION |
---|---|
Coordinate
|
maximum y coordinate |
from_gdf
classmethod
Creates a bounding box from a geodataframe.
PARAMETER | DESCRIPTION |
---|---|
gdf
|
geodataframe
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
BoundingBox
|
bounding box |
buffer
Buffers the bounding box.
Examples:
Assume the area of interest is specified by x_min
=363084, y_min
=5715326, x_max
=363340 and
y_max
=5715582.
You can expand the area of interest by buffering the bounding box.
>>> bounding_box = BoundingBox(
... x_min=363084,
... y_min=5715326,
... x_max=363340,
... y_max=5715582,
... )
>>> bounding_box.buffer(buffer_size=64)
BoundingBox(x_min=363020, y_min=5715262, x_max=363404, y_max=5715646)
PARAMETER | DESCRIPTION |
---|---|
buffer_size
|
buffer size in meters
TYPE:
|
inplace
|
if True, the bounding box is buffered inplace
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
BoundingBox
|
buffered bounding box |
RAISES | DESCRIPTION |
---|---|
AviaryUserError
|
Invalid buffer size (abs( |
quantize
Quantizes the coordinates to the specified value.
Examples:
Assume the area of interest is specified by x_min
=363084, y_min
=5715326, x_max
=363340 and
y_max
=5715582.
You can align the area of interest to a grid by quantizing the bounding box.
>>> bounding_box = BoundingBox(
... x_min=363084,
... y_min=5715326,
... x_max=363340,
... y_max=5715582,
... )
>>> bounding_box.quantize(value=128)
BoundingBox(x_min=363008, y_min=5715200, x_max=363392, y_max=5715584)
PARAMETER | DESCRIPTION |
---|---|
value
|
value to quantize the coordinates to in meters
TYPE:
|
inplace
|
if True, the bounding box is quantized inplace
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
BoundingBox
|
quantized bounding box |
RAISES | DESCRIPTION |
---|---|
AviaryUserError
|
Invalid value ( |
to_gdf
Converts the bounding box to a geodataframe.
PARAMETER | DESCRIPTION |
---|---|
epsg_code
|
EPSG code
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
gpd.GeoDataFrame
|
bounding box |