pub struct GeoUtils;Expand description
Geographic utilities for common geographic operations
Implementations§
Source§impl GeoUtils
impl GeoUtils
Sourcepub fn deg_to_rad(degrees: f64) -> f64
pub fn deg_to_rad(degrees: f64) -> f64
Convert degrees to radians
Sourcepub fn rad_to_deg(radians: f64) -> f64
pub fn rad_to_deg(radians: f64) -> f64
Convert radians to degrees
Sourcepub fn normalize_longitude(lon: f64) -> f64
pub fn normalize_longitude(lon: f64) -> f64
Normalize longitude to [-180, 180] range
Sourcepub fn normalize_latitude(lat: f64) -> f64
pub fn normalize_latitude(lat: f64) -> f64
Normalize latitude to [-90, 90] range
Sourcepub fn centroid(points: &[GeoPoint]) -> Option<GeoPoint>
pub fn centroid(points: &[GeoPoint]) -> Option<GeoPoint>
Calculate the center point of multiple geographic points
Sourcepub fn polygon_area(vertices: &[GeoPoint]) -> f64
pub fn polygon_area(vertices: &[GeoPoint]) -> f64
Calculate polygon area using the spherical excess method (in square meters)
Sourcepub fn point_in_polygon(point: &GeoPoint, polygon: &[GeoPoint]) -> bool
pub fn point_in_polygon(point: &GeoPoint, polygon: &[GeoPoint]) -> bool
Check if a point is inside a polygon using ray casting algorithm
Sourcepub fn closest_point_on_line(
point: &GeoPoint,
line_start: &GeoPoint,
line_end: &GeoPoint,
) -> GeoPoint
pub fn closest_point_on_line( point: &GeoPoint, line_start: &GeoPoint, line_end: &GeoPoint, ) -> GeoPoint
Find the closest point on a line segment to a given point
Sourcepub fn great_circle_distance(point1: &GeoPoint, point2: &GeoPoint) -> f64
pub fn great_circle_distance(point1: &GeoPoint, point2: &GeoPoint) -> f64
Calculate great circle distance between two points (same as Haversine)
Auto Trait Implementations§
impl Freeze for GeoUtils
impl RefUnwindSafe for GeoUtils
impl Send for GeoUtils
impl Sync for GeoUtils
impl Unpin for GeoUtils
impl UnwindSafe for GeoUtils
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more