I use this url for fetching map tile from google server
http://mts0.google.com/vt/lyrs=m@189000000&hl=en&src=app&x=41189&y=25680&z=16&s=Gal
I wonder if there is a way to customize this url, by adding some extra parameters to fetch tile without any label of streets or extra info or overlays. something just like customizing map in map api v3. any suggestion would be welcomed.
Using Maps URLs, you can build a universal, cross-platform URL to launch Google Maps and perform searches, get directions and navigation, and display map views and panoramic images. The URL syntax is the same regardless of the platform in use. You don't need a Google API key to use Maps URLs.
Go to “Settings” from the navigation menu. Next, scroll to the “Map Type” section. Finally, select the “Satellite” map type. Next, you can open any route on your route planner in satellite map mode.
I didn't find a documentation about it, but there is a parameter apistyle
the value(must be urlencoded) to hide street-labels would be
s.t:3|s.e:l|p.v:off
The following is a guess because of a missing documentation:
s.t
defines the feature-type, the value 3
seems to be road
s.e
defines the element e.g. l
abels or g
eometryp
defines the style, v
stands for v
isibility , the value off
should be clear.
result:
https://mts0.google.com/vt/lyrs=m@289000001&hl=en&src=app&x=41189&y=25680&z=16&s=Gal&apistyle=s.t%3A3|s.e%3Al|p.v%3Aoff
You'll have to play around with the parameters to get the desired result. In the past it was possible to get the style e.g. by inspecting the tile-URL with developer-tools when using for example the Styled Map Wizard , but they have modified the tile-URLs used by the javascript-API , the parameters now will be encoded somehow.
A list of parameters and values:
s.t
0
1
17
21
19
20
18
5
81
82
2
37
33
34
36
40
38
35
39
3
50
49
51
4
65
66
6
s.e
g
g.f
g.s
l
l.i
l.t
l.t.f
l.t.s
p.c
#aarrggbb
p.g
0.01
and 10
p.h
#rrggbb
p.il
true
/false
p.l
-100
and 100
p.s
-100
and 100
p.v
on
/simplified
/off
p.w
0
Implementation of what Dr. Molle found out:
function getEncodedStyles(styles){
var ret = "";
var styleparse_types = {"all":"0","administrative":"1","administrative.country":"17","administrative.land_parcel":"21","administrative.locality":"19","administrative.neighborhood":"20","administrative.province":"18","landscape":"5","landscape.man_made":"81","landscape.natural":"82","poi":"2","poi.attraction":"37","poi.business":"33","poi.government":"34","poi.medical":"36","poi.park":"40","poi.place_of_worship":"38","poi.school":"35","poi.sports_complex":"39","road":"3","road.arterial":"50","road.highway":"49","road.local":"51","transit":"4","transit.line":"65","transit.station":"66","water":"6"};
var styleparse_elements = {"all":"a","geometry":"g","geometry.fill":"g.f","geometry.stroke":"g.s","labels":"l","labels.icon":"l.i","labels.text":"l.t","labels.text.fill":"l.t.f","labels.text.stroke":"l.t.s"};
var styleparse_stylers = {"color":"p.c","gamma":"p.g","hue":"p.h","invert_lightness":"p.il","lightness":"p.l","saturation":"p.s","visibility":"p.v","weight":"p.w"};
for(i=0;i<styles.length;i++){
if(styles[i].featureType){
ret += "s.t:"+styleparse_types[styles[i].featureType]+"|";
}
if(styles[i].elementType){
if(!styleparse_elements[styles[i].elementType])
console.log("style element transcription unkown:"+styles[i].elementType);
ret += "s.e:"+styleparse_elements[styles[i].elementType]+"|";
}
if(styles[i].stylers){
for(u=0;u<styles[i].stylers.length;u++){
var keys = [];
var cstyler = styles[i].stylers[u]
for(var k in cstyler){
if(k=="color"){
if(cstyler[k].length==7)
cstyler[k] = "#ff"+cstyler[k].slice(1);
else if(cstyler[k].length!=9)
console.log("malformed color:"+cstyler[k]);
}
ret += styleparse_stylers[k]+":"+cstyler[k]+"|";
}
}
}
ret = ret.slice(0,ret.length-1);
ret += ","
}
return encodeURIComponent(ret.slice(0,ret.length-1));
}
Input is in this case a regular google maps styles array - A good wizard for that is Snazzy Maps
Anyways, thanks to Dr. Molle for saving hours!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With