From b701fcf114b56a9cb2e6c04c6b6e5f189a259a81 Mon Sep 17 00:00:00 2001 From: Dustin Carlino Date: Mon, 6 Jul 2020 07:28:41 -0700 Subject: [PATCH] also dedupe building points coming from a relation, for #130 --- convert_osm/src/osm_reader.rs | 6 ++++-- data/other_polygons/krakow.poly | 10 ++++++++++ 2 files changed, 14 insertions(+), 2 deletions(-) create mode 100644 data/other_polygons/krakow.poly diff --git a/convert_osm/src/osm_reader.rs b/convert_osm/src/osm_reader.rs index f632ed69de..e7ca91bf05 100644 --- a/convert_osm/src/osm_reader.rs +++ b/convert_osm/src/osm_reader.rs @@ -262,13 +262,15 @@ pub fn extract_osm( .next() .and_then(|id| id_to_way.get(&id)) { - if pts.len() < 3 { + let mut deduped = pts.clone(); + deduped.dedup(); + if deduped.len() < 3 { continue; } map.buildings.insert( OriginalBuilding { osm_way_id: rel.id }, RawBuilding { - polygon: Polygon::new(pts), + polygon: Polygon::new(&deduped), public_garage_name: None, num_parking_spots: 0, amenities: get_bldg_amenities(&tags), diff --git a/data/other_polygons/krakow.poly b/data/other_polygons/krakow.poly new file mode 100644 index 0000000000..81b1c6649b --- /dev/null +++ b/data/other_polygons/krakow.poly @@ -0,0 +1,10 @@ +krakow +1 + 19.91220474243164 50.075099742705696 + 19.926795959472656 50.039722339360004 + 19.975547790527344 50.04810065472004 + 19.974689483642578 50.07587092194771 + 19.940528869628906 50.07917583535689 + 19.91220474243164 50.075099742705696 +END +END