mirror of
https://github.com/a-b-street/abstreet.git
synced 2024-12-01 02:33:54 +03:00
Match amenities defined as areas in OSM to buildings within. This was
already working for multipolygon relations, but for some reason not done for ways. This fixes lots of missing schools in Bristol.
This commit is contained in:
parent
edfd696ff3
commit
f8d30c411f
@ -94,6 +94,7 @@ pub fn extract_osm(
|
|||||||
|
|
||||||
let mut coastline_groups: Vec<(WayID, Vec<Pt2D>)> = Vec::new();
|
let mut coastline_groups: Vec<(WayID, Vec<Pt2D>)> = Vec::new();
|
||||||
let mut memorial_areas: Vec<Polygon> = Vec::new();
|
let mut memorial_areas: Vec<Polygon> = Vec::new();
|
||||||
|
let mut amenity_areas: Vec<(Polygon, Amenity)> = Vec::new();
|
||||||
timer.start_iter("processing OSM ways", doc.ways.len());
|
timer.start_iter("processing OSM ways", doc.ways.len());
|
||||||
for (id, way) in &mut doc.ways {
|
for (id, way) in &mut doc.ways {
|
||||||
timer.next();
|
timer.next();
|
||||||
@ -162,6 +163,13 @@ pub fn extract_osm(
|
|||||||
});
|
});
|
||||||
} else if way.tags.is("historic", "memorial") {
|
} else if way.tags.is("historic", "memorial") {
|
||||||
memorial_areas.push(polygon);
|
memorial_areas.push(polygon);
|
||||||
|
} else if way.tags.contains_key("amenity") {
|
||||||
|
let amenity = Amenity {
|
||||||
|
names: NamePerLanguage::new(&way.tags).unwrap_or_else(NamePerLanguage::unnamed),
|
||||||
|
amenity_type: way.tags.get("amenity").unwrap().clone(),
|
||||||
|
osm_tags: way.tags.clone(),
|
||||||
|
};
|
||||||
|
amenity_areas.push((polygon, amenity));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -174,8 +182,6 @@ pub fn extract_osm(
|
|||||||
|
|
||||||
let boundary = map.boundary_polygon.clone().into_ring();
|
let boundary = map.boundary_polygon.clone().into_ring();
|
||||||
|
|
||||||
let mut amenity_areas: Vec<(Polygon, Amenity)> = Vec::new();
|
|
||||||
|
|
||||||
// TODO Fill this out in a separate loop to keep a mutable borrow short. Maybe do this in
|
// TODO Fill this out in a separate loop to keep a mutable borrow short. Maybe do this in
|
||||||
// reader, or stop doing this entirely.
|
// reader, or stop doing this entirely.
|
||||||
for (id, rel) in &mut doc.relations {
|
for (id, rel) in &mut doc.relations {
|
||||||
|
Loading…
Reference in New Issue
Block a user