Module: ol/style/Style




Type Definitions

DeclutterMode{"declutter"} {"obstacle"} {"none"}

Defines how symbols and text are decluttered on layers ith declutter set to true

  • declutter: Overlapping symbols and text are decluttered.
  • obstacle: Symbols and text are rendered, but serve as obstacle for subsequent attempts to place a symbol or text at the same location.
  • none: No decluttering is done.


A function that takes an Feature as argument and returns an Geometry that will be rendered and styled for the feature.


Name Type Description
geometry string | Geometry | GeometryFunction | undefined

Feature property or geometry or function returning a geometry to render for this style.

fill Fill | undefined

Fill style.

image ImageStyle | undefined

Image style.

renderer RenderFunction | undefined

Custom renderer. When configured, fill, stroke and image will be ignored, and the provided function will be called with each render frame for each geometry.

hitDetectionRenderer RenderFunction | undefined

Custom renderer for hit detection. If provided will be used in hit detection rendering.

stroke Stroke | undefined

Stroke style.

text Text | undefined

Text style.

zIndex number | undefined

Z index.


Custom renderer function. Takes two arguments:

  1. The pixel coordinates of the geometry in GeoJSON notation.
  2. The State of the layer renderer.


A function that takes an Feature and a {number} representing the view's resolution. The function should return a Style or an array of them. This way e.g. a vector layer can be styled. If the function returns undefined, the feature will not be rendered.

StyleLike{Style} {Array<Style>} {StyleFunction}

A Style, an array of Style, or a StyleFunction.