From e7de595bda6ed4ed28c821cdb9e44466f9493956 Mon Sep 17 00:00:00 2001 From: Oliver Wipfli Date: Sat, 4 Jan 2025 17:09:06 +0100 Subject: [PATCH 1/3] Fix Antarctica landcover --- .../java/com/protomaps/basemap/layers/Earth.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tiles/src/main/java/com/protomaps/basemap/layers/Earth.java b/tiles/src/main/java/com/protomaps/basemap/layers/Earth.java index 1c806ad8..d322b04b 100644 --- a/tiles/src/main/java/com/protomaps/basemap/layers/Earth.java +++ b/tiles/src/main/java/com/protomaps/basemap/layers/Earth.java @@ -8,6 +8,7 @@ import com.onthegomap.planetiler.reader.SourceFeature; import com.protomaps.basemap.feature.FeatureId; import com.protomaps.basemap.names.OsmNames; +import org.locationtech.jts.geom.Point; import java.util.List; public class Earth implements ForwardingProfile.LayerPostProcesser { @@ -29,6 +30,19 @@ public void processNe(SourceFeature sf, FeatureCollector features) { } else if (sourceLayer.equals("ne_10m_land")) { features.polygon(this.name()).setZoomRange(5, 5).setBufferPixels(8).setAttr("kind", "earth"); } + if (sourceLayer.equals("ne_10m_glaciated_areas")) { + try { + Point centroid = (Point) sf.centroid(); + if (centroid.getY() > 0.7) { + features.polygon("landcover") + .setAttr("kind", "glacier") + .setZoomRange(0, 7) + .setMinPixelSize(0.0); + } + } catch (GeometryException e) { + System.out.println("Error: " + e); + } + } } public void processOsm(SourceFeature sf, FeatureCollector features) { From a99dadaad354c365a88ac0e53599b265ec4c3762 Mon Sep 17 00:00:00 2001 From: Oliver Wipfli Date: Sat, 4 Jan 2025 19:06:11 +0100 Subject: [PATCH 2/3] Add comment --- tiles/src/main/java/com/protomaps/basemap/layers/Earth.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tiles/src/main/java/com/protomaps/basemap/layers/Earth.java b/tiles/src/main/java/com/protomaps/basemap/layers/Earth.java index d322b04b..b05a4f4d 100644 --- a/tiles/src/main/java/com/protomaps/basemap/layers/Earth.java +++ b/tiles/src/main/java/com/protomaps/basemap/layers/Earth.java @@ -30,9 +30,13 @@ public void processNe(SourceFeature sf, FeatureCollector features) { } else if (sourceLayer.equals("ne_10m_land")) { features.polygon(this.name()).setZoomRange(5, 5).setBufferPixels(8).setAttr("kind", "earth"); } + // Daylight landcover uses ESA WorldCover which only goes to a latitude of roughly 80 deg S. + // Parts of Antarctica therefore get no landcover = glacier from Daylight. + // To fix this, we add glaciated areas from Natural Earth in Antarctica. if (sourceLayer.equals("ne_10m_glaciated_areas")) { try { Point centroid = (Point) sf.centroid(); + // Web Mercator Y = 0.7 is roughly 60 deg South, i.e., Antarctica. if (centroid.getY() > 0.7) { features.polygon("landcover") .setAttr("kind", "glacier") From 07bbeaf7f0ee44dbd18fd96f1c256636b17a5d26 Mon Sep 17 00:00:00 2001 From: Oliver Wipfli Date: Sat, 4 Jan 2025 19:11:16 +0100 Subject: [PATCH 3/3] Format --- tiles/src/main/java/com/protomaps/basemap/layers/Earth.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tiles/src/main/java/com/protomaps/basemap/layers/Earth.java b/tiles/src/main/java/com/protomaps/basemap/layers/Earth.java index b05a4f4d..6d3014fe 100644 --- a/tiles/src/main/java/com/protomaps/basemap/layers/Earth.java +++ b/tiles/src/main/java/com/protomaps/basemap/layers/Earth.java @@ -8,8 +8,8 @@ import com.onthegomap.planetiler.reader.SourceFeature; import com.protomaps.basemap.feature.FeatureId; import com.protomaps.basemap.names.OsmNames; -import org.locationtech.jts.geom.Point; import java.util.List; +import org.locationtech.jts.geom.Point; public class Earth implements ForwardingProfile.LayerPostProcesser { @Override