Leaflet Map API with Google Satellite Layer

Google Maps-Api-3SatelliteLeaflet

Google Maps-Api-3 Problem Overview


I'm very interested in the Leaflet Map API.

However, I need to be able to use the Google Satellite Layer. I have not been able to find an example on how to add a Google Satellite Layer to Leaflet. I understand that I will still need to load the Google Maps API to do this (OpenLayers has an example).

Google Maps-Api-3 Solutions


Solution 1 - Google Maps-Api-3

You don't need a plugin or the Google API, you can add it as a XYZ tile layer.

Streets

googleStreets = L.tileLayer('http://{s}.google.com/vt/lyrs=m&x={x}&y={y}&z={z}',{
    maxZoom: 20,
    subdomains:['mt0','mt1','mt2','mt3']
});

Hybrid:

googleHybrid = L.tileLayer('http://{s}.google.com/vt/lyrs=s,h&x={x}&y={y}&z={z}',{
    maxZoom: 20,
    subdomains:['mt0','mt1','mt2','mt3']
});
  

Satellite:

googleSat = L.tileLayer('http://{s}.google.com/vt/lyrs=s&x={x}&y={y}&z={z}',{
    maxZoom: 20,
    subdomains:['mt0','mt1','mt2','mt3']
});

Terrain

googleTerrain = L.tileLayer('http://{s}.google.com/vt/lyrs=p&x={x}&y={y}&z={z}',{
    maxZoom: 20,
    subdomains:['mt0','mt1','mt2','mt3']
});


Note the difference in the "lyrs" parameter in the URL:
Hybrid: s,h;
Satellite: s;
Streets: m;
Terrain: p;

Solution 2 - Google Maps-Api-3

There's a third-party plugin for it: Demo: http://psha.org.ru/leaflet/bel.html (switch to Google Maps with the switcher) Source: http://psha.org.ru/leaflet/Google.js

Solution 3 - Google Maps-Api-3

this repository contains few tile layers google and other and very useful other plugins: https://github.com/shramov/leaflet-plugins

Solution 4 - Google Maps-Api-3

Leaflet has an official page for publishing all available plugins: http://leafletjs.com/plugins.html

You will find plugins there for adding Google layers support to Leaflet.

Solution 5 - Google Maps-Api-3

Google title layer with Traffic

var googleTraffic = L.tileLayer('https://{s}.google.com/vt/lyrs=m@221097413,traffic&x={x}&y={y}&z={z}', {
        maxZoom: 20,
        minZoom: 2,
        subdomains: ['mt0', 'mt1', 'mt2', 'mt3'],
    });

Please see their General Terms

Hope someone helps this

Solution 6 - Google Maps-Api-3

Alternative to Google Maps API for satellite layer: Leaflet.js with Esri World Imagery tiles

<script>

    var map = L.map('map').setView([-41.2858, 174.78682], 14);

    var mapLink = '<a href="http://www.esri.com/">Esri</a>';
    var wholink = 'i-cubed, USDA, USGS, AEX, GeoEye, Getmapping, Aerogrid, IGN, IGP, UPR-EGP, and the GIS User Community';

    L.tileLayer(
        'http://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}', {
        attribution: '&copy; '+mapLink+', '+wholink,
        maxZoom: 18,
        }).addTo(map);

</script>

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionfnllcView Question on Stackoverflow
Solution 1 - Google Maps-Api-3capie69View Answer on Stackoverflow
Solution 2 - Google Maps-Api-3MournerView Answer on Stackoverflow
Solution 3 - Google Maps-Api-3stefcudView Answer on Stackoverflow
Solution 4 - Google Maps-Api-3Etienne DesgagnéView Answer on Stackoverflow
Solution 5 - Google Maps-Api-3Rahul MahadikView Answer on Stackoverflow
Solution 6 - Google Maps-Api-3Bruno De Freitas BarrosView Answer on Stackoverflow