-
Name Type Description anchorArray.<number> (defaults to [0.5, 0.5]) Anchor. Default value is the icon center.
anchorOriginIconOrigin (defaults to 'top-left') Origin of the anchor:
bottom-left,bottom-right,top-leftortop-right.anchorXUnitsIconAnchorUnits (defaults to 'fraction') Units in which the anchor x value is specified. A value of
'fraction'indicates the x value is a fraction of the icon. A value of'pixels'indicates the x value in pixels.anchorYUnitsIconAnchorUnits (defaults to 'fraction') Units in which the anchor y value is specified. A value of
'fraction'indicates the y value is a fraction of the icon. A value of'pixels'indicates the y value in pixels.colorColor | string | undefined Color to tint the icon. If not specified, the icon will be left as is.
crossOriginnull | string | undefined The
crossOriginattribute for loaded images. Note that you must provide acrossOriginvalue if you want to access pixel data with the Canvas renderer. See https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_enabled_image for more detail.imgHTMLImageElement | HTMLCanvasElement | ImageBitmap | undefined Image object for the icon.
displacementArray.<number> (defaults to [0, 0]) Displacement of the icon in pixels. Positive values will shift the icon right and up.
opacitynumber (defaults to 1) Opacity of the icon.
widthnumber | undefined The width of the icon in pixels. This can't be used together with
scale.heightnumber | undefined The height of the icon in pixels. This can't be used together with
scale.scalenumber | Size (defaults to 1) Scale.
rotateWithViewboolean (defaults to false) Whether to rotate the icon with the view.
rotationnumber (defaults to 0) Rotation in radians (positive rotation clockwise).
offsetArray.<number> (defaults to [0, 0]) Offset which, together with
sizeandoffsetOrigin, defines the sub-rectangle to use from the original (sprite) image.offsetOriginIconOrigin (defaults to 'top-left') Origin of the offset:
bottom-left,bottom-right,top-leftortop-right.sizeSize | undefined Icon size in pixels. Used together with
offsetto define the sub-rectangle to use from the original (sprite) image.srcstring | undefined Image source URI.
declutterModeDeclutterMode | undefined Declutter mode.
Extends
Methods
-
Clones the style. The underlying Image/HTMLCanvasElement is not cloned.
Returns:
The cloned style.
-
Get the anchor point in pixels. The anchor determines the center point for the symbolizer.
Returns:
Anchor.
-
Get the icon color.
Returns:
Color.
-
Get the declutter mode of the shape
Returns:
Shape's declutter mode
-
Get the displacement of the shape
Returns:
Shape's center displacement
-
Get the height of the icon (in pixels). Will return undefined when the icon image is not yet loaded.
Returns:
Icon height (in pixels).
-
Get the image icon.
Name Type Description pixelRationumber Pixel ratio.
Returns:
Image or Canvas element. If the Icon style was configured withsrcor with a not let loadedimg, anImageBitmapwill be returned.
-
Get the symbolizer opacity.
Returns:
Opacity.
-
Get the origin of the symbolizer.
Returns:
Origin.
-
Get the pixel ratio.
Name Type Description pixelRationumber Pixel ratio.
Returns:
The pixel ratio of the image.
-
Determine whether the symbolizer rotates with the map.
Returns:
Rotate with map.
-
Get the symoblizer rotation.
Returns:
Rotation.
-
Get the symbolizer scale.
Returns:
Scale.
-
Get the size of the icon (in pixels).
Returns:
Image size.
-
Get the image URL.
Returns:
Image src.
-
Get the width of the icon (in pixels). Will return undefined when the icon image is not yet loaded.
Returns:
Icon width (in pixels).
-
Load not yet loaded URI. When rendering a feature with an icon style, the vector renderer will automatically call this method. However, you might want to call this method yourself for preloading or other purposes.
-
Set the anchor point. The anchor determines the center point for the symbolizer.
Name Type Description anchorArray.<number> Anchor.
-
Set the displacement.
Name Type Description displacementArray.<number> Displacement.
-
Set the opacity.
Name Type Description opacitynumber Opacity.
-
Set whether to rotate the style with the view.
Name Type Description rotateWithViewboolean Rotate with map.
-
Set the rotation.
Name Type Description rotationnumber Rotation.
-
Set the scale.
Name Type Description scalenumber | Size Scale.