[OpenLayers-Users] how to add google maps v3 in openlayers 2.13?

zach cruise zachc1980 at gmail.com
Thu Mar 13 09:41:39 PDT 2014


trying to add a google layer:

// 1. include script
<script src="http://maps.google.com/maps/api/js?v=3&sensor=false"></script>

// 2. create layer
map = new OpenLayers.Map(
    ...
);
var layer_google = new OpenLayers.Layer.Google(
    "Google Streets",
    {
        numZoomLevels: 20
    }
);

// 3. add layer
map.addlayers([layer_google]);

but then when i select the google layer, my map zooms to the equator
and freezes (can't pan or zoom).

could it be a projection issue? tried setting projection to
'epsg:4326', 'epsg:3857' and 'epsg:900913', and disabling zoom but
without success.

http://openlayers.org/dev/examples/google.js
http://openlayers.org/blog/2010/07/10/google-maps-v3-for-openlayers/
http://openlayers.org/dev/examples/google.html
http://dev.openlayers.org/releases/OpenLayers-2.13.1/examples/google-v3-alloverlays.html
http://dev.openlayers.org/releases/OpenLayers-2.13.1/examples/osm-google.html


More information about the Users mailing list