Class: Photo

ol.style. Photo

Set Photo style for vector features.


new Photo(options)

Parameters:
Name Type Description
options
Properties
Name Type Argument Default Description
kind default | square | circle | anchored | folio
crop boolean

crop within square, default is false

radius Number

symbol size

shadow Number <optional>
0

drop a shadow (the shadow width in pixel)

declutterMode string <optional>

Declutter mode "declutter" | "obstacle" | "none" | undefined

stroke ol.style.Stroke
src String

image src

crossOrigin String

The crossOrigin attribute for loaded images. Note that you must provide a crossOrigin value if you want to access pixel data with the Canvas renderer.

displacement Array.<number> <optional>

to use with ol > 6

offsetX number <optional>
0

Horizontal offset in pixels, deprecated use displacement with ol>6

offsetY number <optional>
0

Vertical offset in pixels, deprecated use displacement with ol>6

onload function <optional>

callback when image is loaded (to redraw the layer)

onerror function <optional>

callback when image is on error (not loaded)

Implements:
  • ol.structs.IHasChecksum

Extends

  • ol.style.RegularShape

Methods


clone()

Clones the style.

Returns:
Type
ol.style.Photo

getImage(pixelRatio)

Get the image icon.

Parameters:
Name Type Description
pixelRatio number

Pixel ratio.

Returns:

Image or Canvas element.

Type
HTMLCanvasElement

getPhoto()

Returns the photo image

Returns:
Type
HTMLImageElement

setOffset(offset)

Set photo offset

Parameters:
Name Type Description
offset ol.pixel