Commit 24760e75 authored by Volker Krause's avatar Volker Krause
Browse files

Simplify all outer polygons separately

This fixes messed up geometry for cases with multiple disjoint coverage
areas (eg. AT-7, BE).
parent 7d1931c4
......@@ -120,10 +120,12 @@ static void preProcessCoverage(QJsonObject &obj)
// reduce resolution of the area geometry
using namespace KPublicTransport;
auto poly = GeoJson::readOuterPolygon(obj.take(QLatin1String("area")).toObject());
poly = PolygonSimplifier::douglasPeucker(poly, 10'000.0);
if (!poly.empty()) {
obj.insert(QLatin1String("area"), GeoJson::writePolygon(poly));
auto polys = GeoJson::readOuterPolygons(obj.take(QLatin1String("area")).toObject());
for (auto &poly : polys) {
poly = PolygonSimplifier::douglasPeucker(poly, 10'000.0);
}
if (!polys.empty()) {
obj.insert(QLatin1String("area"), GeoJson::writePolygons(polys));
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment