Sources
MapLibre can use a variety of different data sources for its style layers. You can use the same source for multiple style layers.
Data
GeoJSON
You can use the GeoJsonSource to attach data like points, lines or polygons. The data can then be used in a StyleCircleLayer, FillStyleLayer, HeatmapStyleLayer, LineStyleLayer or SymbolStyleLayer.
An example use cases is to display and visualize any kind of data on the map.
Media
Image
Use the ImageSource If you want to render an image on the map.
An example use case is to position a weather radar image on the map.
Video
Likewise, the VideoSource can be used to render a video on the map.
The video source is only supported on web.
Tiles
The most common way to use a tile source is by an URL. This can either be
- the direct URL of a tile server, e.g.
https://example.com/{z}/{x}/{y}.mvt
- the URL of a TileJSON that provides
a tile server with additional metadata, e.g.
https://example.com/tiles.json
- a PMTiles file by adding
pmtiles://
in front of your url, e.g.pmtiles://https://example.com/tiles.pmtiles
orpmtiles://files://path/tiles.pmtiles
Raster Tiles
The RasterSource
can be used to add a raster tile server. Raster tiles are images that are
positioned in a grid next to each other on the map. They are hosted on a tile
server that follows the format z/x/y.png
or any other image file extension.
A common use case is to display a satellite map using a RasterStyleLayer.
Raster DEM Tiles
Raster DEM tiles are similar to regular raster tiles but are used in the HillshadeStyleLayer to display elevation. Use the RasterDemSource for it.
Vector Tiles
Last but not least you can use the VectorSource to supply the map with a source of Mapbox Vector Tiles (MVT). The data is then shown in a combination of circle, fill, line and symbol layers on the map.