From dcf0c4a385406edd296584a8172034e006bbf966 Mon Sep 17 00:00:00 2001 From: Kyler Chin <7539174+kylerchin@users.noreply.github.com> Date: Sun, 31 Mar 2024 20:25:53 -0700 Subject: [PATCH] Delete null island points from the hull calculation --- src/maple/gtfs_handlers/hull_from_gtfs.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/maple/gtfs_handlers/hull_from_gtfs.rs b/src/maple/gtfs_handlers/hull_from_gtfs.rs index 66e3da67..b92f480e 100644 --- a/src/maple/gtfs_handlers/hull_from_gtfs.rs +++ b/src/maple/gtfs_handlers/hull_from_gtfs.rs @@ -12,6 +12,10 @@ pub fn hull_from_gtfs(gtfs: >fs_structures::Gtfs) -> Option { .map(|(id, points)| { points .iter() + .filter(|point| { + let is_null_island = f64::abs(0. - point.latitude) < 0.000001 && f64::abs(0. - point.latitude) < 0.000001; + !is_null_island + }) .map(|point| Point::new(point.longitude, point.latitude)) }) .flatten() @@ -27,6 +31,10 @@ pub fn hull_from_gtfs(gtfs: >fs_structures::Gtfs) -> Option { .stops .iter() .filter(|(_, stop)| stop.longitude.is_some() && stop.latitude.is_some()) + .filter(|(_, stop)| { + let is_null_island = f64::abs(0. - stop.latitude.unwrap()) < 0.000001 && f64::abs(0. - stop.latitude.unwrap()) < 0.000001; + !is_null_island + }) .map(|(_, stop)| { Point::new(stop.longitude.unwrap(), stop.latitude.unwrap()) })