Skip to content

Commit 1e4a4d7

Browse files
authored
Fix Antarctica landcover (#342)
* Fix Antarctica landcover by adding in glacier geometry from Natural Earth. [#337]
1 parent 694b20b commit 1e4a4d7

File tree

1 file changed

+18
-0
lines changed
  • tiles/src/main/java/com/protomaps/basemap/layers

1 file changed

+18
-0
lines changed

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

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import com.protomaps.basemap.feature.FeatureId;
1010
import com.protomaps.basemap.names.OsmNames;
1111
import java.util.List;
12+
import org.locationtech.jts.geom.Point;
1213

1314
public class Earth implements ForwardingProfile.LayerPostProcesser {
1415
@Override
@@ -29,6 +30,23 @@ public void processNe(SourceFeature sf, FeatureCollector features) {
2930
} else if (sourceLayer.equals("ne_10m_land")) {
3031
features.polygon(this.name()).setZoomRange(5, 5).setBufferPixels(8).setAttr("kind", "earth");
3132
}
33+
// Daylight landcover uses ESA WorldCover which only goes to a latitude of roughly 80 deg S.
34+
// Parts of Antarctica therefore get no landcover = glacier from Daylight.
35+
// To fix this, we add glaciated areas from Natural Earth in Antarctica.
36+
if (sourceLayer.equals("ne_10m_glaciated_areas")) {
37+
try {
38+
Point centroid = (Point) sf.centroid();
39+
// Web Mercator Y = 0.7 is roughly 60 deg South, i.e., Antarctica.
40+
if (centroid.getY() > 0.7) {
41+
features.polygon("landcover")
42+
.setAttr("kind", "glacier")
43+
.setZoomRange(0, 7)
44+
.setMinPixelSize(0.0);
45+
}
46+
} catch (GeometryException e) {
47+
System.out.println("Error: " + e);
48+
}
49+
}
3250
}
3351

3452
public void processOsm(SourceFeature sf, FeatureCollector features) {

0 commit comments

Comments
 (0)