Skip to content

Commit

Permalink
Simplify code and remove area filter for water features [#198] (#215)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
bdon authored Feb 2, 2024
1 parent f0e1cc0 commit a8ee378
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 13 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
Tiles v3.3.0
------
- Improve water generalization detail by doing area filtering post-merge [#198]

Tiles v3.2.0
------
- Add `village_green` and `allotments` to landuse layer via @lenalebt [#206]
Expand Down
14 changes: 14 additions & 0 deletions app/src/examples.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,5 +47,19 @@
"tags": ["boundaries"],
"center": [37.382, -1.592],
"zoom": 7
},
{
"name": "colombia-rivers",
"description": "water features west of Bogota should not be broken",
"tags": ["water"],
"center": [-74.422, 4.62],
"zoom": 7.8
},
{
"name": "river-thames",
"description": "River Thames should not have pieces missing",
"tags": ["water"],
"center": [-0.3, 51.4],
"zoom": 8.9
}
]
2 changes: 1 addition & 1 deletion tiles/src/main/java/com/protomaps/basemap/Basemap.java
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public String description() {

@Override
public String version() {
return "3.2.0";
return "3.3.0";
}

@Override
Expand Down
13 changes: 1 addition & 12 deletions tiles/src/main/java/com/protomaps/basemap/layers/Water.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import com.onthegomap.planetiler.geo.GeometryException;
import com.onthegomap.planetiler.reader.SourceFeature;
import com.onthegomap.planetiler.util.Parse;
import com.protomaps.basemap.postprocess.Area;
import java.util.List;

public class Water implements ForwardingProfile.FeatureProcessor, ForwardingProfile.FeaturePostProcessor {
Expand Down Expand Up @@ -144,7 +143,7 @@ public void processFeature(SourceFeature sf, FeatureCollector features) {
.setAttr("water", sf.getString("water"))
.setAttr("waterway", sf.getString("waterway"))
.setZoomRange(6, 15)
.setMinPixelSize(3.0)
.setMinPixelSize(1.0)
.setBufferPixels(8);

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

@Override
public List<VectorTile.Feature> postProcess(int zoom, List<VectorTile.Feature> items) throws GeometryException {
if (zoom == 15)
return items;

int minArea = 400 / (4096 * 4096) * (256 * 256);
if (zoom == 6)
minArea = 600 / (4096 * 4096) * (256 * 256);
else if (zoom <= 5)
minArea = 800 / (4096 * 4096) * (256 * 256);
items = Area.filterArea(items, minArea);

return FeatureMerge.mergeOverlappingPolygons(items, 1);
}
}

0 comments on commit a8ee378

Please sign in to comment.