-
-
Notifications
You must be signed in to change notification settings - Fork 55
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix Antarctica landcover #342
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,7 @@ | |
import com.protomaps.basemap.feature.FeatureId; | ||
import com.protomaps.basemap.names.OsmNames; | ||
import java.util.List; | ||
import org.locationtech.jts.geom.Point; | ||
|
||
public class Earth implements ForwardingProfile.LayerPostProcesser { | ||
@Override | ||
|
@@ -29,6 +30,23 @@ 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) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This works, but it's confusing this isn't a negative number, and 70 would normally not result in the northern tip of Chilean Antarctica (many international bases there) showing up correctly as ice. Please add a comment explaining that you're targeting ice features in Antarctica south of -60°. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Web Mercator Y in Planetiler goes from 0 to 1 from 85 deg N to 85 deg S. The equator is at Web Mercator Y = 0.5 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added the comment |
||
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) { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This section deserves a comment explaining the problem and why this particular solution works
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added one, thanks for the tip!