Google Maps V3 45 Degree Imagery in OpenLayersUsing the OpenLayers 2.11 with Google Maps API V3 provides some great new functionality that will lead most users to want to upgrade their existing mapping applications.  Not only do you get the latest functionality and imagery from Google Maps, but it also simplifies deployment of your application by eliminating the need for managing API keys.

However, there is a minor ‘gotcha’ in this latest version of the Google Maps API that could cause certain developers a lot of grief which OpenLayers 2.11 will not handle by default.  In certain locations, Google Maps API V3 now provides access to 45 degree satellite imagery.  “Great!,” you say, but not so fast.  The imagery only shows up in certain locations and at certain zoom levels.  What’s more, if you don’t specifically disable it, you will always get the 45 degree version of the imagery if it is available.  This can create a pretty disjointed user experience when navigating the map, but more importantly it causes any 2D vector layers which you are overlaying on your map to appear improperly registered against the base imagery.

Luckily there is a solution to this issue that is fairly simple to implement.  Whenever you add a Google Maps layer to your OpenLayers map, it adds a reference to the Google Maps mapObject that it is using to request the Google Maps imagery.  By calling the setTilt method on the map object, we can disable 45 degree imagery for all Google Maps layers, like so:


Just ensure that this call is deferred until after the layer is added to your map, and you should never see the 45 degree imagery in any of your Google Maps layers.