Skip to content

Commit

Permalink
Delete null island points from the hull calculation
Browse files Browse the repository at this point in the history
  • Loading branch information
kylerchin committed Apr 1, 2024
1 parent cfef04b commit dcf0c4a
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/maple/gtfs_handlers/hull_from_gtfs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ pub fn hull_from_gtfs(gtfs: &gtfs_structures::Gtfs) -> Option<Polygon> {
.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()
Expand All @@ -27,6 +31,10 @@ pub fn hull_from_gtfs(gtfs: &gtfs_structures::Gtfs) -> Option<Polygon> {
.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())
})
Expand Down

0 comments on commit dcf0c4a

Please sign in to comment.