Crates.io | geoutils |
lib.rs | geoutils |
version | 0.5.1 |
source | src |
created_at | 2018-12-01 16:36:20.665951 |
updated_at | 2022-08-07 18:54:23.811479 |
description | A collection of geo computation utilities |
homepage | |
repository | https://github.com/srishanbhattarai/geoutils |
max_upload_size | |
id | 99546 |
size | 29,142 |
Geoutils is a evolving crate to provide several geological computations and utilities. Most computations are based off methods on the Location struct.
Find the full API reference at docs.rs.
use geoutils::Location;
let berlin = Location::new(52.518611, 13.408056);
let moscow = Location::new(55.751667, 37.617778);
let distance = berlin.distance_to(&moscow).unwrap();
println!("Distance = {}", distance.meters());
use geoutils::Location;
let berlin = Location::new(52.518611, 13.408056);
let moscow = Location::new(55.751667, 37.617778);
let distance = berlin.haversine_distance_to(&moscow);
println!("Distance = {}", distance.meters());
use geoutils::Location;
let berlin = Location::new(52.518611, 13.408056);
let moscow = Location::new(55.751667, 37.617778);
let center = Location::center(&vec![&berlin, &moscow]);
println!("Center {}, {}", center.latitude(), center.longitude());
use geoutils::{Location, Distance};
let berlin = Location::new(52.518611, 13.408056);
let moscow = Location::new(55.751667, 37.617778);
let is_in_radius = berlin.is_in_circle(&moscow, Distance::from_meters(2000.0)).unwrap();
println!("Is Berlin in 2000m of Moscow? {}", is_in_radius);
Apache-2.0