Configuring the Google Map Server URL

I am using this url to get 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 additional options to extract the tiles without any street labels or additional information or overlay. something like setting up a map on a map api v3. any suggestion would be welcome.

+3


source to share


2 answers


I didn't find any documentation about this, but there is an option apistyle

value (must be urlencoded) to hide street labels would be

s.t:3|s.e:l|p.v:off

      

Below is a guess due to missing documentation:

  • s.t

    defines the type of the function, the value 3

    seems expensive
  • s.e

    defines an element, eg. l

    abels or g

    eometry
  • p

    defines style, v

    means meaning v

    , meaning off

    must 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
    
          

lyrs = m @ 289000001 & hl = en & src = app & x = 41189 & y = 25680 & z = 16 & s = Gal & apistyle = st% 3A3 | se% 3Al | pv% 3Aoff

You will need to play around with the parameters to get the desired result. It used to be possible to get a style like. having checked the snippet url with developer tools when using like New Styles Wizard , but they changed the snippet url used by javascript API, the parameters will now be encoded somehow.



List of parameters and values:

FeatureTypes: s.t

  • all 0

  • Administrative 1

  • administrator.country 17

  • administrator.land_parcel 21

  • Administrative.locality 19

  • administrator.neighborhood 20

  • administrator.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

  • 4

  • transit.line 65

  • transit.station 66

  • water 6

ElementType: s.e

  • geometry g

  • geometry.fill g.f

  • geometry.stroke g.s

  • tags l

  • labels.icon l.i

  • labels.text l.t

  • labels.text.fill l.t.f

  • labels.text.stroke l.t.s

Styler:

  • RGBA color p.c


    hex-value#aarrggbb

  • gamma p.g


    float between 0.01

    and10

  • hue p.h


    RGB hex-value#rrggbb

  • invert_lightness /p.il


    true

    false

  • ease p.l


    float between -100

    and100

  • saturation p.s


    float between -100

    and100

  • visibility / /p.v


    on

    simplified

    off

  • whole weight p.w


    > =0

+8


source


Implementation of what Dr. Molle learned:

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));
}

      



In this case, the input is a regular array of google map styles. A good master for this Snazzy Maps

Anyway, thanks to Dr. Molle for saving hours!

+1


source







All Articles