mirror of
https://github.com/a-b-street/abstreet.git
synced 2024-11-28 03:35:51 +03:00
handling the giant ocean polygon. actually easier after earlier!
This commit is contained in:
parent
e0bb2f97e0
commit
9a3e7dc758
@ -64,6 +64,7 @@ pub fn extract_osm(
|
||||
}
|
||||
}
|
||||
|
||||
let mut coastline_groups: Vec<Vec<Pt2D>> = Vec::new();
|
||||
timer.start_iter("processing OSM ways", doc.ways.len());
|
||||
for way in doc.ways.values() {
|
||||
timer.next();
|
||||
@ -152,6 +153,8 @@ pub fn extract_osm(
|
||||
polygon: Polygon::new(&pts),
|
||||
osm_tags: tags,
|
||||
});
|
||||
} else if tags.get("natural") == Some(&"coastline".to_string()) {
|
||||
coastline_groups.push(pts);
|
||||
} else {
|
||||
// The way might be part of a relation later.
|
||||
id_to_way.insert(way.id, pts);
|
||||
@ -239,6 +242,17 @@ pub fn extract_osm(
|
||||
}
|
||||
}
|
||||
|
||||
// Special case the coastline.
|
||||
println!("{} ways of coastline", coastline_groups.len());
|
||||
for polygon in glue_multipolygon(-1, coastline_groups, &boundary) {
|
||||
map.areas.push(RawArea {
|
||||
area_type: AreaType::Water,
|
||||
osm_id: -1,
|
||||
polygon,
|
||||
osm_tags: BTreeMap::new(),
|
||||
});
|
||||
}
|
||||
|
||||
(map, roads, traffic_signals, osm_node_ids, turn_restrictions)
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user