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

Vladimir fl_v at inbox.ru
Thu Mar 13 23:00:12 PDT 2014


 Hi zach

Projection of google layers is 3857(or 900913) by default.

May be need a  positioning   like this: 
map.zoomTo(youZoomLevel);         
map.setCenter(youLonLat);
http://dev.openlayers.org/releases/OpenLayers-2.13.1/doc/apidocs/files/OpenLayers/Map-js.html#OpenLayers.Map.zoomTo
http://dev.openlayers.org/releases/OpenLayers-2.13.1/doc/apidocs/files/OpenLayers/Map-js.html#OpenLayers.Map.setCenter

Best regards
>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
>_______________________________________________
>Users mailing list
>Users at lists.osgeo.org
>http://lists.osgeo.org/mailman/listinfo/openlayers-users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/openlayers-users/attachments/20140314/65d43d20/attachment.html>


More information about the Users mailing list