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

Andreas Hocevar ahocevar at opengeo.org
Tue Jun 18 07:42:49 PDT 2013


To fix the other issue, remove any maxResolution, maxExtent and units
setting form the map configuration. Only make sure that projection is set
to 'EPSG:3857' or 'EPSG:900913'. Then everything should be fine.

Andreas.


On Tue, Jun 18, 2013 at 4:34 PM, Jeff Heard <jefferson.r.heard at gmail.com>wrote:

> Andreas, thanks for that, will do.  That doesn't fix the other issue,
> though, which is that zooming in and out causes the layers to "drift"
> physically.  An object that is on the west side of the street at one zoom
> level will overlap the street at the next zoom level in or out, and so
> forth.  The rendering only appears to be accurate at the initial zoom
> level.  I haven't tested this extensively for WMS layers, but the problem
> is consistent with vector layers.
>
> This is a recent change - I've been using OpenLayers for three years now,
> and I saw this problem back in 2.11 for a time and the fix was to add a
> maxExtent to the map.  That fix no longer works now, and I'm at a loss as
> to what to fix.
>
>
> On Tue, Jun 18, 2013 at 5:25 AM, Andreas Hocevar <ahocevar at opengeo.org>wrote:
>
>> 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.
>>
>
>
> _______________________________________________
> 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/96cb262c/attachment.html>


More information about the Users mailing list