Struct BoundingBox

Source
pub struct BoundingBox { /* private fields */ }
Expand description

A geospatial instance has at least two coordinate dimensions: X and Y for 2D coordinates of each point. X represents longitude/easting and Y represents latitude/northing. A geospatial instance can optionally have Z and/or M values associated with each point.

The Z values introduce the third dimension coordinate, typically used to indicate height or elevation.

M values allow tracking a value in a fourth dimension. These can represent:

  • Linear reference values (e.g., highway milepost)
  • Timestamps
  • Other values defined by the CRS

The bounding box is defined as min/max value pairs of coordinates from each axis. X and Y values are always present, while Z and M are omitted for 2D geospatial instances.

When calculating a bounding box:

  • Null or NaN values in a coordinate dimension are skipped
  • If a dimension has only null/NaN values, that dimension is omitted
  • If either X or Y dimension is missing, no bounding box is produced
  • Example: POINT (1 NaN) contributes to X but not to Y, Z, or M dimensions

Special cases:

  • For X values only, xmin may exceed xmax. In this case, a point matches if x >= xmin OR x <= xmax
  • This wraparound can occur when the bounding box crosses the antimeridian line.
  • In geographic terms: xmin=westernmost, xmax=easternmost, ymin=southernmost, ymax=northernmost

For GEOGRAPHY types:

  • X values must be within [-180, 180] (longitude)
  • Y values must be within [-90, 90] (latitude)

Derived from the parquet format spec

§Examples

use parquet::geospatial::bounding_box::BoundingBox;

// 2D bounding box
let bbox_2d = BoundingBox::new(0.0, 0.0, 100.0, 100.0);

// 3D bounding box with elevation
let bbox_3d = BoundingBox::new(0.0, 0.0, 100.0, 100.0)
    .with_zrange(0.0, 1000.0);

// 3D bounding box with elevation and measured value
let bbox_3d_m = BoundingBox::new(0.0, 0.0, 100.0, 100.0)
    .with_zrange(0.0, 1000.0)
    .with_mrange(0.0, 1000.0);

Implementations§

Source§

impl BoundingBox

Source

pub fn new(xmin: f64, xmax: f64, ymin: f64, ymax: f64) -> Self

Creates a new bounding box with the specified coordinates.

Source

pub fn with_xrange(self, xmin: f64, xmax: f64) -> Self

Updates the bounding box with specified X-coordinate range.

Source

pub fn with_yrange(self, ymin: f64, ymax: f64) -> Self

Updates the bounding box with specified Y-coordinate range.

Source

pub fn with_zrange(self, zmin: f64, zmax: f64) -> Self

Creates a new bounding box with the specified Z-coordinate range.

Source

pub fn with_mrange(self, mmin: f64, mmax: f64) -> Self

Creates a new bounding box with the specified M-coordinate range.

Source

pub fn get_xmin(&self) -> f64

Returns the minimum x-coordinate.

Source

pub fn get_xmax(&self) -> f64

Returns the maximum x-coordinate.

Source

pub fn get_ymin(&self) -> f64

Returns the minimum y-coordinate.

Source

pub fn get_ymax(&self) -> f64

Returns the maximum y-coordinate.

Source

pub fn get_zmin(&self) -> Option<f64>

Returns the minimum z-coordinate, if present.

Source

pub fn get_zmax(&self) -> Option<f64>

Returns the maximum z-coordinate, if present.

Source

pub fn get_mmin(&self) -> Option<f64>

Returns the minimum m-value (measure), if present.

Source

pub fn get_mmax(&self) -> Option<f64>

Returns the maximum m-value (measure), if present.

Source

pub fn is_z_valid(&self) -> bool

Returns true if both zmin and zmax are present.

Source

pub fn is_m_valid(&self) -> bool

Returns true if both mmin and mmax are present.

Trait Implementations§

Source§

impl Clone for BoundingBox

Source§

fn clone(&self) -> BoundingBox

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for BoundingBox

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for BoundingBox

Source§

fn eq(&self, other: &BoundingBox) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for BoundingBox

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> Allocation for T
where T: RefUnwindSafe + Send + Sync,