Openlayers with google map layer - points zoom before the map?

454 views Asked by At

I'm using OpenLayers 2 to display a few points on a map. When I use a Google map layer and zoom in or out, the points zoom in/out before the map layer moves creating a strange effect.

var google_terrain = new OpenLayers.Layer.Google("Google Terrain",
    {type: google.maps.MapTypeId.TERRAIN}
);

Here is an example of the problem: jsfiddle

By contrast, a Bing map layer behaves as I would expect and when zooming in/out. The points and the map zoom at the same time. Can anyone shed any light on this for me?

1

There are 1 answers

0
Pratik Sheth On BEST ANSWER

This is common problem happening for one using OpenLayers with Google Maps. To resolve this issue change initialization of your map with below line.

var map = new OpenLayers.Map('map', { zoomMethod:null });

adding zoomMethod:null disables zoom effect applied to your feature layer.

Please refer updated jsFiddle in which zoom is working properly.

I hope this helps you.