MapSnippets logo MapSnippets logo

Satellite Basemap with Leaflet

Leaflet

Show MapTiler satellite imagery on a Leaflet map with L.tileLayer() and switch to a labeled hybrid layer through L.control.layers().

progress_activity Loading map...
const satellite = L.tileLayer('https://api.maptiler.com/maps/satellite/256/{z}/{x}/{y}.jpg?key=YOUR_MAPTILER_KEY', {
  tileSize: 256,
  attribution: '&copy; <a href="https://www.maptiler.com/">MapTiler</a>'
});
const hybrid = L.tileLayer('https://api.maptiler.com/maps/hybrid/256/{z}/{x}/{y}.jpg?key=YOUR_MAPTILER_KEY', {
  tileSize: 256,
  attribution: '&copy; <a href="https://www.maptiler.com/">MapTiler</a>'
});
const streets = L.tileLayer('https://api.maptiler.com/maps/streets-v4/256/{z}/{x}/{y}.png?key=YOUR_MAPTILER_KEY', {
  tileSize: 256,
  attribution: '&copy; <a href="https://www.maptiler.com/">MapTiler</a> &copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap contributors</a>'
});
const map = L.map('map', { layers: [hybrid] }).setView([41.9028, 12.4964], 12);
L.control.layers({ 'Satellite': satellite, 'Hybrid (labels)': hybrid, 'Streets': streets }).addTo(map);

How to add a satellite basemap in Leaflet

MapTiler provides separate satellite (imagery only) and hybrid (imagery + labels) raster tile styles. Creating an L.tileLayer for each and adding them to L.control.layers() gives the user a radio-button switcher in the top-right corner.

The hybrid style is set as the default by including it in the map’s layers option. Switching between satellite and hybrid lets users toggle labels on and off while keeping the same aerial imagery base. The streets layer provides a standard map fallback.

Key APIs

API Description Docs
MapTiler Satellite Aerial imagery tiles docs.maptiler.com/cloud/api/maps
L.control.layers() Layer switcher leafletjs.com/reference.html#control-layers

FAQ

What is the difference between satellite and hybrid?

satellite is pure imagery with no labels. hybrid overlays road names, city labels, and points of interest on top of the satellite imagery.

What zoom levels are available for satellite?

MapTiler satellite tiles are available from zoom 0 to approximately zoom 20, depending on the region. Urban areas typically have higher resolution.

Common mistakes

  • Using the .png extension for satellite tiles, which are served as .jpg for better compression
  • Including all layers in the map’s layers array. Only the default layer belongs there, and the layer control manages the rest.
  • Forgetting the API key. Satellite tiles require authentication like all MapTiler tiles.

Build maps using Leaflet with AI

Generate code like this satellite basemap with leaflet example using the Leaflet skill in your IDE.