Skip to content

Instantly share code, notes, and snippets.

@danielquisbert
Created October 6, 2017 16:24
Show Gist options
  • Save danielquisbert/5eba8f0097906a5f70e28b3ae103938c to your computer and use it in GitHub Desktop.
Save danielquisbert/5eba8f0097906a5f70e28b3ae103938c to your computer and use it in GitHub Desktop.
basemaps using tiles

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;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment