5 releases (3 breaking)

0.4.1 Apr 5, 2021
0.4.0 Mar 19, 2020
0.3.0 Jan 22, 2020
0.2.0 Dec 2, 2018
0.1.0 Dec 1, 2018

#51 in Science

Download history 5/week @ 2020-12-25 42/week @ 2021-01-01 28/week @ 2021-01-08 43/week @ 2021-01-15 26/week @ 2021-01-22 50/week @ 2021-01-29 67/week @ 2021-02-05 43/week @ 2021-02-12 45/week @ 2021-02-19 30/week @ 2021-02-26 18/week @ 2021-03-05 86/week @ 2021-03-12 79/week @ 2021-03-19 38/week @ 2021-03-26 33/week @ 2021-04-02 31/week @ 2021-04-09

189 downloads per month

Apache-2.0

15KB
219 lines

Build Status Documentation

geoutils

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.

Examples

extern crate geoutils;

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());
extern crate geoutils;

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());
  • Get the center of a list of coordinates.
extern crate geoutils;

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());
  • Check if a point falls in a certain radius of another point.
extern crate geoutils;

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);

License

Apache-2.0

No runtime deps