pub struct GeoEngine { /* private fields */ }Expand description
Multi-collection geospatial engine.
Implementations§
Source§impl GeoEngine
impl GeoEngine
pub fn new() -> Self
pub fn create_collection(&self, name: impl Into<String>) -> Result<(), GeoError>
pub fn drop_collection(&self, name: &str) -> Result<(), GeoError>
pub fn list_collections(&self) -> Vec<String>
pub fn collection_exists(&self, name: &str) -> bool
pub fn collection_stats(&self, name: &str) -> Option<CollectionStats>
Sourcepub fn upsert(
&self,
collection: &str,
id: impl Into<String>,
lat: f64,
lon: f64,
metadata: Value,
) -> Result<(), GeoError>
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).
pub fn get( &self, collection: &str, id: &str, ) -> Result<Option<GeoFeature>, GeoError>
pub fn delete(&self, collection: &str, id: &str) -> Result<bool, GeoError>
Sourcepub fn within_radius(
&self,
collection: &str,
lat: f64,
lon: f64,
radius_m: f64,
filter: &Value,
) -> Result<Vec<GeoHit>, GeoError>
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.
Sourcepub fn within_bbox(
&self,
collection: &str,
min_lat: f64,
min_lon: f64,
max_lat: f64,
max_lon: f64,
filter: &Value,
) -> Result<Vec<GeoHit>, GeoError>
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.
Sourcepub fn nearest(
&self,
collection: &str,
lat: f64,
lon: f64,
k: usize,
filter: &Value,
) -> Result<Vec<GeoHit>, GeoError>
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).
pub fn snapshot(&self) -> EngineSnapshot
pub fn load_snapshot(&self, snap: EngineSnapshot)
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for GeoEngine
impl !RefUnwindSafe for GeoEngine
impl Send for GeoEngine
impl Sync for GeoEngine
impl Unpin for GeoEngine
impl UnsafeUnpin for GeoEngine
impl UnwindSafe for GeoEngine
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more