Skip to content

Commit a8ee378

Browse files
authored
Simplify code and remove area filter for water features [#198] (#215)
* Simplify code and remove area filter for water features [#198] We can't do any pre-filtering of water areas, because sometimes they are parts of linear features. Let the polygon merge routine do its work, and change the threshold to 1.0 pixels. * tiles 3.3.0
1 parent f0e1cc0 commit a8ee378

File tree

4 files changed

+20
-13
lines changed

4 files changed

+20
-13
lines changed

CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
Tiles v3.3.0
2+
------
3+
- Improve water generalization detail by doing area filtering post-merge [#198]
4+
15
Tiles v3.2.0
26
------
37
- Add `village_green` and `allotments` to landuse layer via @lenalebt [#206]

app/src/examples.json

+14
Original file line numberDiff line numberDiff line change
@@ -47,5 +47,19 @@
4747
"tags": ["boundaries"],
4848
"center": [37.382, -1.592],
4949
"zoom": 7
50+
},
51+
{
52+
"name": "colombia-rivers",
53+
"description": "water features west of Bogota should not be broken",
54+
"tags": ["water"],
55+
"center": [-74.422, 4.62],
56+
"zoom": 7.8
57+
},
58+
{
59+
"name": "river-thames",
60+
"description": "River Thames should not have pieces missing",
61+
"tags": ["water"],
62+
"center": [-0.3, 51.4],
63+
"zoom": 8.9
5064
}
5165
]

tiles/src/main/java/com/protomaps/basemap/Basemap.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ public String description() {
9292

9393
@Override
9494
public String version() {
95-
return "3.2.0";
95+
return "3.3.0";
9696
}
9797

9898
@Override

tiles/src/main/java/com/protomaps/basemap/layers/Water.java

+1-12
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
import com.onthegomap.planetiler.geo.GeometryException;
88
import com.onthegomap.planetiler.reader.SourceFeature;
99
import com.onthegomap.planetiler.util.Parse;
10-
import com.protomaps.basemap.postprocess.Area;
1110
import java.util.List;
1211

1312
public class Water implements ForwardingProfile.FeatureProcessor, ForwardingProfile.FeaturePostProcessor {
@@ -144,7 +143,7 @@ public void processFeature(SourceFeature sf, FeatureCollector features) {
144143
.setAttr("water", sf.getString("water"))
145144
.setAttr("waterway", sf.getString("waterway"))
146145
.setZoomRange(6, 15)
147-
.setMinPixelSize(3.0)
146+
.setMinPixelSize(1.0)
148147
.setBufferPixels(8);
149148

150149
// Core Tilezen schema properties
@@ -168,16 +167,6 @@ public void processFeature(SourceFeature sf, FeatureCollector features) {
168167

169168
@Override
170169
public List<VectorTile.Feature> postProcess(int zoom, List<VectorTile.Feature> items) throws GeometryException {
171-
if (zoom == 15)
172-
return items;
173-
174-
int minArea = 400 / (4096 * 4096) * (256 * 256);
175-
if (zoom == 6)
176-
minArea = 600 / (4096 * 4096) * (256 * 256);
177-
else if (zoom <= 5)
178-
minArea = 800 / (4096 * 4096) * (256 * 256);
179-
items = Area.filterArea(items, minArea);
180-
181170
return FeatureMerge.mergeOverlappingPolygons(items, 1);
182171
}
183172
}

0 commit comments

Comments
 (0)