GeoSpace

Struct GeoSpace 

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

A non-Euclidean spatial context based on geodetic coordinates (WGS84).

GeoSpace represents a geographic location on Earth using the WGS84 standard. It stores latitude, longitude, and altitude, and is commonly used in systems that need to model real-world positions, such as navigation, mapping, remote sensing, and sensor fusion applications.

Unlike Euclidean coordinates, geodetic coordinates model the Earth’s surface as a curved ellipsoid rather than a flat plane. This makes GeoSpace a simple yet powerful non-Euclidean spatial representation that integrates naturally with GPS and global datasets.

§Fields

  • id: A unique numeric identifier for the location (e.g., sensor ID, region ID)
  • lat: Latitude in degrees (positive north, negative south)
  • lon: Longitude in degrees (positive east, negative west)
  • alt: Altitude in meters above the WGS84 ellipsoid (not above sea level)

§Trait Implementations

This type implements:

  • Identifiable
  • Coordinate<f64>
  • Metric using the Haversine approximation
  • Spatial<f64>
  • Display for human-readable output

§Common Use Cases

  • Geographic sensor modeling (e.g., magnetometers on aircraft, buoys, satellites)
  • Location-aware causal contexts (e.g., MagNav, remote sensing calibration)
  • Contextualizing non-Euclidean geospatial data in DeepCausality graphs

§Example

use deep_causality::*;

let g1 = GeoSpace::new(1, 52.520008, 13.404954, 34.0); // Berlin, Germany
let g2 = GeoSpace::new(2, 48.856613, 2.352222, 35.0);   // Paris, France

println!("{}", g1);

let distance = g1.distance(&g2);
println!("Distance (approx): {:.2} km", distance / 1000.0);

§Output

GeoSpace(id="1", lat=52.520008, lon=13.404954, alt=34m)
Distance (approx): 878.84 km

Implementations§

Source§

impl GeoSpace

Source

pub fn lat(&self) -> f64

Source

pub fn alt(&self) -> f64

Source

pub fn lon(&self) -> f64

Source§

impl GeoSpace

Source

pub fn new(id: u64, lat: f64, lon: f64, alt: f64) -> Self

Trait Implementations§

Source§

impl Adjustable<f64> for GeoSpace

Source§

fn update<const W: usize, const H: usize, const D: usize, const C: usize>( &mut self, array_grid: &ArrayGrid<f64, W, H, D, C>, ) -> Result<(), UpdateError>

The default implementation does nothing to keep update optional. Override this method to implement a node update when needed. For a sample implementation, see src/types/context_types/node_types_adjustable
Source§

fn adjust<const W: usize, const H: usize, const D: usize, const C: usize>( &mut self, array_grid: &ArrayGrid<f64, W, H, D, C>, ) -> Result<(), AdjustmentError>

The default implementation does nothing to keep adjustment optional. Override this method to implement a node adjustment when needed. Depending on the type of node adjustment, select a 1, 2,3, or 4 dimensional array grid that contains the transformation data to apply to the node. For a sample implementation, see src/types/context_types/node_types_adjustable
Source§

impl Clone for GeoSpace

Source§

fn clone(&self) -> GeoSpace

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 Coordinate<f64> for GeoSpace

Source§

fn dimension(&self) -> usize

Returns the number of dimensions defined in this coordinate system.
Source§

fn coordinate(&self, index: usize) -> Result<&f64, IndexError>

Returns a reference to the value at a given axis index (0-based). Read more
Source§

impl Debug for GeoSpace

Source§

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

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

impl Display for GeoSpace

Implements human-readable formatting for a geographic spatial context.

Format:

GeoSpace(id="S1", lat=52.52, lon=13.405, alt=34.0)
Source§

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

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

impl Identifiable for GeoSpace

Source§

fn id(&self) -> u64

Source§

impl Metric<f64> for GeoSpace

Source§

fn distance(&self, other: &Self) -> f64

Computes a scalar distance or influence between self and other.
Source§

impl PartialEq for GeoSpace

Source§

fn eq(&self, other: &GeoSpace) -> 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 Spatial<f64> for GeoSpace

Source§

impl StructuralPartialEq for GeoSpace

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, 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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. 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.