Search code examples
ol3-google-maps

Prevent tilt in Google satellite layer in ol3-google


I am very grateful to those at MapGears for the excellent ol3-google integration work.

My query is whether it is possible to set the Google Satellite layer to NOT tilt at higher zoom levels? I realise this is the default behaviour, but in OpenLayers 2 it was possible to stop this (see example) with code along the lines [googleSat].mapObject.setTilt(0);

I'd be very grateful for any thoughts on help on this.


Solution

  • Setting the tilt of Google Maps map in OLGM

    You can prevent the Google Maps map from tilting by first getting it from the OLGM lib, then set the tilt value that you want:

    olGM.getGoogleMapsMap().setTilt(0)
    

    Preventing the map from beeing zoomed out/in

    This is out of scope of the original question, but still valuable information.

    It is currently not possible to prevent the map from being zoomed out to the higher zoom levels.

    The problem is this: in order to calculate the zoom level to give to Google Maps, the list of resolutions used has to be the same in the OpenLayers' map. It is possible to define our own list of resolutions, or simply set maxResolution in the OpenLayers' ol.View, but doing either of prevents the synchronization between OL and GM.

    I'm not saying this is not possible, but it would require development to be able to do so. I opened an issue on ol3-google-maps GitHub to track this.