You have to use the projection sphericalMercator

var options = {
    projection: new OpenLayers.Projection("EPSG:900913"),
    displayProjection: new OpenLayers.Projection("EPSG:4326"),
    units: "m",
    numZoomLevels: 18,
    maxResolution: 156543.0339,
    maxExtent: new OpenLayers.Bounds(-20037508, -20037508,
                                     20037508, 20037508.34)
};
map = new OpenLayers.Map('map', options);
// create Google Mercator layers
var gmap = new OpenLayers.Layer.Google(
    "Google Streets",
    {'sphericalMercator': true}
);
...
http://dev.openlayers.org/releases/OpenLayers-2.10/examples/spherical-mercat
or.html

or use Google v3
map = new OpenLayers.Map('map');
map.addControl(new OpenLayers.Control.LayerSwitcher());
var gphy = new OpenLayers.Layer.Google(
    "Google Physical",
    {type: google.maps.MapTypeId.TERRAIN}
);
...
http://dev.openlayers.org/releases/OpenLayers-2.10/examples/google-v3.html
 
Arnd

________________________________

Von: [email protected]
[mailto:[email protected]] Im Auftrag von Sridhar
Raman
Gesendet: Montag, 17. Januar 2011 11:17
An: [email protected]
Betreff: [OpenLayers-Users] Feature on Google Map moving with zoom or
movingof map


Hi

I am using features (OpenLayer.Feature.Vector) to indicate certain positions
on the map.  I am using OpenLayers 2.10 and have a Google Maps layer.  The
problem I am facing is that the position of the feature keeps shifting when
the zoom level changes.  I have attached the sample HTML file that exhibits
this error.  In the initial zoom level of 9, the point is near Chennai
(which is correct).  As you decrease the zoom level (i.e. zoom out), the
circle indicating the feature also shifts.

At certain zoom levels, moving the map also results in the circle moving in
the same direction as the map movement.  In effect, the impression is got of
one where the circle remains in the same position ON THE SCREEN, while the
map moves around it.  This is obviously not the right behaviour.

Another observation that I made was that this issue doesn't appear if we use
OSM or our locally generated maps.  It happens on Google (and maybe Yahoo as
well, though I haven't tested it enough on Y!).

What could be the reason for this problem?

Thanks,
Sridhar


_______________________________________________
Users mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/openlayers-users

Reply via email to