Ric
Ric

Reputation: 67

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

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?

Upvotes: 2

Views: 452

Answers (1)

Pratik Sheth
Pratik Sheth

Reputation: 128

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.

Upvotes: 2

Related Questions