Polygon masks

Polygon masks limit the viewable area of the map to a polygon area. A polygon can easily be turned into a polygon mask by inserting a polygon ring that covers the full globe into the first ring in the polygon. When rendering, all other rings will be subtracted from the full globe polygon ring.

This sample shows how to create a polygon mask. This sample also monitors the 'styledata' event of the map and change the color of the mask polygon based on the style of the map to create a more seamless experience. Alternatively, any fill color and opacity value can be set on the polygon layer itself without the 'styledata' event if desired.