Using Leaflet, it is possible to consume google maps tiles with the code below:
var googleStreets = L.tileLayer('http://{s}.google.com/vt/lyrs=m&x={x}&y={y}&z={z}&',{
maxZoom: 20,
subdomains:['mt0','mt1','mt2','mt3']
});
Is it possible to consume the same service but without labels? Does google provide a tiling service for this purpose?
I can easily do that with cartodb basemaps because they provide different services for this reason:
var basemapCartoNoLabels = L.tileLayer('http://{s}.basemaps.cartocdn.com/light_nolabels/{z}/{x}/{y}.png', {
attribution: '©OpenStreetMap, ©CartoDB'
}).addTo(map);
var basemapCartoOnlyLabels = L.tileLayer('http://{s}.basemaps.cartocdn.com/light_only_labels/{z}/{x}/{y}.png', {
attribution: '©OpenStreetMap, ©CartoDB',
pane: 'labels'
}).addTo(map);
My goal is to show the following layers:
– google streets
– my geometry json layer
– labels on top of everything
Best Answer
Due to google's terms&conditions, it's not possible to access the tiles without using their API. For this reason, things like https://gitlab.com/IvanSanchez/Leaflet.GridLayer.GoogleMutant exist.
It should be possible to request tiles without labels by using the "custom styling" functionality, but I'm not sure that will allow requesting labels-only tiles.