pub struct Supercluster {
    pub points: Vec<Feature>,
    /* private fields */
}
Expand description

A spatial clustering configuration and data structure.

Fields§

§points: Vec<Feature>

Input data points.

Implementations§

source§

impl Supercluster

source

pub fn new(options: Options) -> Self

Create a new instance of Supercluster with the specified configuration settings.

§Arguments
  • options: The configuration options for Supercluster.
§Returns

A new Supercluster instance with the given configuration.

source

pub fn load(&mut self, points: Vec<Feature>) -> &mut Self

Load the FeatureCollection Object into the Supercluster instance, performing clustering at various zoom levels.

§Arguments
  • points: A vector of GeoJSON features representing input points to be clustered.
§Returns

A mutable reference to the updated Supercluster instance.

source

pub fn get_clusters(&self, bbox: [f64; 4], zoom: u8) -> Vec<Feature>

Retrieve clustered features within the specified bounding box and zoom level.

§Arguments
  • bbox: The bounding box as an array of four coordinates [min_lng, min_lat, max_lng, max_lat].
  • zoom: The zoom level at which to retrieve clusters.
§Returns

A vector of GeoJSON features representing the clusters within the specified bounding box and zoom level.

source

pub fn get_children( &self, cluster_id: usize ) -> Result<Vec<Feature>, &'static str>

Retrieve the cluster features for a specified cluster ID.

§Arguments
  • cluster_id: The unique identifier of the cluster.
§Returns

A Result containing a vector of GeoJSON features representing the children of the specified cluster if successful, or an error message if the cluster is not found.

source

pub fn get_leaves( &self, cluster_id: usize, limit: usize, offset: usize ) -> Vec<Feature>

Retrieve individual leaf features within a cluster.

§Arguments
  • cluster_id: The unique identifier of the cluster.
  • limit: The maximum number of leaf features to retrieve.
  • offset: The offset to start retrieving leaf features.
§Returns

A vector of GeoJSON features representing the individual leaf features within the cluster.

source

pub fn get_tile(&self, z: u8, x: f64, y: f64) -> Option<FeatureCollection>

Retrieve a vector of features within a tile at the given zoom level and tile coordinates.

§Arguments
  • z: The zoom level of the tile.
  • x: The X coordinate of the tile.
  • y: The Y coordinate of the tile.
§Returns

An optional Tile containing a vector of GeoJSON features within the specified tile, or None if there are no features.

source

pub fn get_cluster_expansion_zoom(&self, cluster_id: usize) -> usize

Determine the zoom level at which a specific cluster expands.

§Arguments
  • cluster_id: The unique identifier of the cluster.
§Returns

The zoom level at which the cluster expands.

Trait Implementations§

source§

impl Clone for Supercluster

source§

fn clone(&self) -> Supercluster

Returns a copy 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 Supercluster

source§

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

Formats the value using the given formatter. Read more

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> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

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,

§

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>,

§

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>,

§

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.