Created
February 6, 2020 01:31
-
-
Save kpcyrd/b1abfbc5fe92c3bbce029118ad10a611 to your computer and use it in GitHub Desktop.
work in progress gps distance calculation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Cargo.toml: geo = "0.12.2" | |
use geo::*; | |
use geo::prelude::*; | |
fn main() { | |
let polygon = Polygon::new(LineString::from(vec![ | |
Point::new(9.764785766601562, 53.63975308945899), | |
Point::new(9.827270507812, 53.59494998253459), | |
Point::new(9.9151611328125, 53.663153974456456), | |
Point::new(9.976272583007812, 53.65582987649682), | |
Point::new(9.992752075195312, 53.68613523817129), | |
Point::new(10.051460266113281, 53.68674518938816), | |
Point::new(10.075492858886719, 53.72495117617815), | |
Point::new(10.118408203125, 53.71946627930625), | |
Point::new(10.164413452148438, 53.743635083157756), | |
Point::new(10.202865600585938, 53.73104466704585), | |
Point::new(10.16304016113281, 53.676781546441546), | |
Point::new(10.235824584960938, 53.632832079199474), | |
Point::new(10.2008056640625, 53.608803292930894), | |
Point::new(10.208358764648438, 53.578646152866504), | |
Point::new(10.163726806640625, 53.57212285981298), | |
Point::new(10.18707275390625, 53.52071674896369), | |
Point::new(10.224151611328125, 53.52643162253097), | |
Point::new(10.347747802734375, 53.44062753992289), | |
Point::new(10.248870849609375, 53.38824275010831), | |
Point::new(10.15960693359375, 53.38824275010831), | |
Point::new(10.064849853515625, 53.44635321212876), | |
Point::new(9.985198974609375, 53.40595029739904), | |
Point::new(9.951210021972656, 53.42385506057106), | |
Point::new(9.944171905517578, 53.41843327091211), | |
Point::new(9.927349090576172, 53.41812635648326), | |
Point::new(9.917736053466797, 53.412294561442884), | |
Point::new(9.901256561279297, 53.41464783813818), | |
Point::new(9.912586212158201, 53.443490472483326), | |
Point::new(9.897651672363281, 53.45177144115704), | |
Point::new(9.866924285888672, 53.43633277935392), | |
Point::new(9.866409301757812, 53.427639673754776), | |
Point::new(9.858856201171875, 53.427639673754776), | |
Point::new(9.795513153076172, 53.46710230573499), | |
Point::new(9.795341491699219, 53.49039461941655), | |
Point::new(9.77903366088867, 53.49029248806277), | |
Point::new(9.780235290527344, 53.49856433088649), | |
Point::new(9.758434295654297, 53.5078554643033), | |
Point::new(9.759807586669922, 53.545407634092975), | |
Point::new(9.633293151855469, 53.568147234570084), | |
Point::new(9.655780792236328, 53.58802162343514), | |
Point::new(9.727706909179688, 53.568351121879815), | |
Point::new(9.737663269042969, 53.60921067445695), | |
]), vec![]); | |
let point = Point::new(-74.036677, 40.726662); | |
let distance = polygon.euclidean_distance(&point); | |
dbg!(distance); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment