Polygons are two dimensional shapes that contain both an outer stroke (or “outline”) and an inside (or “fill”). A polygon can be thought of as an irregularly-shaped point and is styled in similar ways to circles.

There is one layer for this style, which is the simplest possible situation. Styling polygons is accomplished via the fill type (line 7). Line 9 specifies dark blue ('#000080') as the polygon’s fill color.

Note

The light-colored outlines around the polygons in the figure are artifacts of the renderer caused by the polygons being adjacent. There is no outline in this style.

This example is similar to the mbstyle_cookbook_polygons_simplepolygon example above, with the addition of fill-outline paint parameter (line 9). Line 9 also sets the color of stroke to white ('#FFFFFF'), the "fill-outline-color" can only be 1 pixel, a limitation of MBStyle.

This example is similar to the Simple polygon with stroke example, save for defining the fill’s opacity in line 11. The value of 0.5 results in partially transparent fill that is 50% opaque. An opacity value of 1 would draw the fill as 100% opaque, while an opacity value of 0 would result in a completely transparent (0% opaque) fill. In this example, since the background is white, the dark blue looks lighter. Were the fill imposed on a dark background, the resulting color would be darker.