Legacy

Mapbox.js is no longer in active development. To learn more about our newer mapping tools see Mapbox GL JS.

You are viewing an older version of Mapbox.js. Check out v3.3.1 for the latest.

ImageOverlay

Used to load and display a single image over specific bounds of the map, implements ILayer interface.

Usage example

var imageUrl = 'http://www.lib.utexas.edu/maps/historical/newark_nj_1922.jpg',
	imageBounds = [[40.712216, -74.22655], [40.773941, -74.12544]];

L.imageOverlay(imageUrl, imageBounds).addTo(map);

Creation

Factory Description
L.ImageOverlay( <String> imageUrl, <LatLngBounds> bounds, <ImageOverlay options> options? ) Instantiates an image overlay object given the URL of the image and the geographical bounds it is tied to.

Options

Option Type Default Description
opacity Number 1.0 The opacity of the image overlay.
attribution String '' The attribution text of the image overlay.

Methods

Method Returns Description
addTo( <Map> map ) this Adds the overlay to the map.
setOpacity( <Number> opacity ) this Sets the opacity of the overlay.
setUrl( <String> imageUrl ) this Changes the URL of the image.
bringToFront() this Brings the layer to the top of all overlays.
bringToBack() this Brings the layer to the bottom of all overlays.