Overview
ImageSource is a content source that is used for a georeferenced raster image to be shown on the map. The georeferenced image scales and rotates as the user zooms and rotates the map. This is useful for overlaying historical maps, floor plans, or other georeferenced imagery.Import
Basic Usage
Using Local Images
Animating Image Position
Props
A string that uniquely identifies the source.
The id refers to an existing source in the style. Does not create a new source.
An HTTP(S) URL, absolute file URL, or local file URL to the source image. Can also be a
require() statement for local images.Note: GIFs are currently not supported.The top left, top right, bottom right, and bottom left coordinates for the image in [longitude, latitude] format.The coordinates define the corners of the image and determine how it’s positioned, scaled, and rotated on the map.Format:
[[topLeft], [topRight], [bottomRight], [bottomLeft]]Example:Child layer components (typically RasterLayer) that will use this source.
Methods
ImageSource inherits methods from AbstractSource. Use a ref to access these methods.Notes
- The image will scale and rotate as the user zooms and rotates the map
- Coordinates must form a valid quadrilateral
- The image source will not render if
urlorcoordinatesare not provided - GIF images are not currently supported
- For local images, use
require()or import the image
Related Components
- RasterSource - For tiled raster images
- RasterLayer - Used to render the image