Search code examples
ol3-google-maps

How to set the Google map type?


How do I set the Google map type e.g. SATELLITE or TERRAIN? I tried varitaions of the OpenLayers 2 syntax:

new olgm.layer.Google( { type: google.maps.MapTypeId.SATELLITE });

and

new olgm.layer.Google({ 
    params: { type: google.maps.MapTypeId.SATELLITE }
});

but no joy.


Solution

  • The correct syntax is this:

    new olgm.layer.Google({
        mapTypeId: google.maps.MapTypeId.SATELLITE
    };
    

    See a live example (click on the + Satellite button). See also the JavaScript source file of the example