[OpenLayers-Users] HELP! OL 2.13: Google v3 and other layers not zooming "together"

Andreas Hocevar ahocevar at opengeo.org
Tue Jun 18 02:25:13 PDT 2013


Google Maps is integrated using the GMaps API, and there we cannot control
zoom animation. Your best bet is to turn off zoom animation for the map by
configuring your map with

    zoomMethod: null

Then you can also activate the OpenLayers hack to remove the GMaps
animation by turning the layer off during zooming. To do so, configure your
Google layer with

    animationEnabled: false

Andreas.


On Mon, Jun 17, 2013 at 6:54 PM, Jeff Heard <jefferson.r.heard at gmail.com>wrote:

> I'm stuck. My code works with OSM, but I need it to work with Google as
> well.  The problem is simply that Google v3 and my other layers are not
> playing well together at all.  They don't zoom together.
>
> In the case of Google satellite, the layer doesn't zoom at all unless I
> pan the map.  In the case of the others (hybrid, terrain, roads), they
> zoom, but the google layer and the other layers on the map zoom up to half
> a second apart from each other, and the layer "drifts" between zoom levels
> somewhat.
>
> The code that reproduces this is simple and derived directly from the WMS
> and Google v3 examples, but they appear not to work together well:
>
> $(function() { var in_options = { internalProjection: new
> OpenLayers.Projection('EPSG:900913'), externalProjection: new
> OpenLayers.Projection("EPSG:4326") };
> var wkt = new OpenLayers.Format.WKT(in_options); var feature =
> wkt.read("POLYGON ((-78.9950752916525687 35.5198238058974169,
> -78.9950752916525687 36.0750238562958074, -78.2565296570171398
> 36.0750238562958074, -78.2565296570171398 35.5198238058974169,
> -78.9950752916525687 35.5198238058974169))"); var bounds =
> feature.geometry.getBounds();
> var wms = new OpenLayers.Layer.WMS('Zoning', "/ga_resources/wms/", {
>  styles: "styles/new-style",  layers:
> "catalog/states/nc/counties/wake/zoning", transparent: true });
> var map = new OpenLayers.Map({ div:'map', projection: new
> OpenLayers.Projection("EPSG:900913")});
> var layers = [ new OpenLayers.Layer.Google( "Google Physical", {type:
> google.maps.MapTypeId.TERRAIN} ), new OpenLayers.Layer.Google( "Google
> Streets", // the default {numZoomLevels: 20} ), new
> OpenLayers.Layer.Google( "Google Hybrid", {type:
> google.maps.MapTypeId.HYBRID, numZoomLevels: 20} ), new
> OpenLayers.Layer.Google( "Google Satellite", {type:
> google.maps.MapTypeId.SATELLITE, numZoomLevels: 22} ), wms ];
> map.addLayers(layers);  //map.addLayers([wms]); map.addControl(new
> OpenLayers.Control.LayerSwitcher());  map.zoomToExtent(bounds);
> });
>
> _______________________________________________
> Users mailing list
> Users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/openlayers-users
>
>


-- 
Andreas Hocevar
OpenGeo - http://opengeo.org/
Expert service straight from the developers.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/openlayers-users/attachments/20130618/9ebfe8b7/attachment-0001.html>


More information about the Users mailing list