Skip to main content

GeoEngine

Struct GeoEngine 

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

Multi-collection geospatial engine.

Implementations§

Source§

impl GeoEngine

Source

pub fn new() -> Self

Source

pub fn create_collection(&self, name: impl Into<String>) -> Result<(), GeoError>

Source

pub fn drop_collection(&self, name: &str) -> Result<(), GeoError>

Source

pub fn list_collections(&self) -> Vec<String>

Source

pub fn collection_exists(&self, name: &str) -> bool

Source

pub fn collection_stats(&self, name: &str) -> Option<CollectionStats>

Source

pub fn upsert( &self, collection: &str, id: impl Into<String>, lat: f64, lon: f64, metadata: Value, ) -> Result<(), GeoError>

Upsert a feature. The collection is created on demand if it does not yet exist (the coordinate is validated first, so a bad write never creates an empty collection).

Source

pub fn get( &self, collection: &str, id: &str, ) -> Result<Option<GeoFeature>, GeoError>

Source

pub fn delete(&self, collection: &str, id: &str) -> Result<bool, GeoError>

Source

pub fn within_radius( &self, collection: &str, lat: f64, lon: f64, radius_m: f64, filter: &Value, ) -> Result<Vec<GeoHit>, GeoError>

Features within radius_m of (lat, lon), nearest first.

Source

pub fn within_bbox( &self, collection: &str, min_lat: f64, min_lon: f64, max_lat: f64, max_lon: f64, filter: &Value, ) -> Result<Vec<GeoHit>, GeoError>

Features inside a bounding box.

Source

pub fn nearest( &self, collection: &str, lat: f64, lon: f64, k: usize, filter: &Value, ) -> Result<Vec<GeoHit>, GeoError>

The k nearest features to (lat, lon).

Source

pub fn snapshot(&self) -> EngineSnapshot

Source

pub fn load_snapshot(&self, snap: EngineSnapshot)

Trait Implementations§

Source§

impl Default for GeoEngine

Source§

fn default() -> Self

Returns the “default value” for a type. 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, 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.