updateImage method
Update an existing image in a style. This image can be displayed on the map like any other icon in the style's
sprite using the image's ID with
icon-image
,
background-pattern
,
fill-pattern
,
or line-pattern
.
@param id The ID of the image.
@param image The image as an HTMLImageElement
, ImageData
, or object with width
, height
, and data
properties with the same format as ImageData
.
@example // If an image with the ID 'cat' already exists in the style's sprite, // replace that image with a new image, 'other-cat-icon.png'. if (map.hasImage('cat')) map.updateImage('cat', './other-cat-icon.png');
Implementation
updateImage(String id, dynamic image) => jsObject.updateImage(id, image);