loadImage method

dynamic loadImage(
  1. String url,
  2. Function callback
)

Load an image from an external URL to be used with MapboxMap#addImage. External domains must support CORS.

@param {string} url The URL of the image file. Image file must be in png, webp, or jpg format. @param {Function} callback Expecting callback(error, data). Called when the image has loaded or with an error argument if there is an error.

@example // Load an image from an external URL. map.loadImage('http://placekitten.com/50/50', function(error, image) { if (error) throw error; // Add the loaded image to the style's sprite with the ID 'kitten'. map.addImage('kitten', image); });

@see Add an icon to the map

Implementation

loadImage(String url, Function callback) =>
    jsObject.loadImage(url, allowInterop(callback));