Handle more than one centerline for a lake (#139)

This commit is contained in:
Michael Barry
2022-03-19 15:16:11 -04:00
committed by GitHub
parent 79576f33d7
commit 6ef91a1e19
2 changed files with 58 additions and 1 deletions

View File

@@ -111,7 +111,13 @@ public class WaterName implements
try {
// multiple threads call this concurrently
synchronized (this) {
lakeCenterlines.put(osmId, feature.worldGeometry());
// if we already have a centerline for this OSM_ID, then merge the existing one with this one
var newGeometry = feature.worldGeometry();
var oldGeometry = lakeCenterlines.get(osmId);
if (oldGeometry != null) {
newGeometry = GeoUtils.combine(oldGeometry, newGeometry);
}
lakeCenterlines.put(osmId, newGeometry);
}
} catch (GeometryException e) {
e.log(stats, "omt_water_name_lakeline", "Bad lake centerline: " + feature);