[OpenLayers-Users] Bing maps with dynamic resized map bug

Jimmy Aumard jimmy.aumard at gmail.com
Thu Apr 22 06:08:46 EDT 2010


I have open a ticket for the issue but I'm not sure to have correctly make
it.

My english is very limited sorry.

#2588: No update on map object of Google map on map resize
------------------------------
-+--------------------------------------------
 Reporter:  jim06              |       Owner:  tschaub
    Type:  bug                |      Status:  new
 Priority:  minor              |   Milestone:  2.10 Release
Component:  Layer.Google       |     Version:  2.9 RC3
 Keywords:  map rezise google  |       State:
-------------------------------+--------------------------------------------
 When the base layer is not google and when the map is resized the google
 map object is not updated.
 I have attach an example of the bug

Cheers.


2010/4/22 Andreas Hocevar <ahocevar at opengeo.org>

> Hi,
>
> I can confirm the issue. Please simplify the example even more (remove all
> unneeded layers, replace bing layer with an empty layer, use just one div
> for the map (no nested map inside carte)) and create a ticket with the
> example attached.
>
> The other issue with different zoom levels in Bing and Google is a floating
> point issue. If you want, you can create a separate minimal example and
> another ticket for it.
>
> Thanks,
> Andreas.
>
> On Apr 22, 2010, at 10:56 , Jimmy Aumard wrote:
>
> > I have try to make an example :
> >
> > <html xmlns="http://www.w3.org/1999/xhtml">
> > <head>
> > <meta http-equiv="content-type" content="text/html; charset=utf-8" />
> > <title>OpenLayers</title>
> > <!--  -->
> >
> > <script    src='
> http://maps.google.com/maps?file=api&amp;v=2&amp;key=AZERAAAAbsmHETfVBBkfYg-JOma8IhRLLSF_UQf1WG5vAu5MHZHm0uNmSxSASAYqpbkiQpo160A-r5z5xWFQtw
> '></script>
> > <script    src="
> http://api.maps.yahoo.com/ajaxymap?v=3.0&appid=euzuro-openlayers
> "></script>
> > <script    src='
> http://dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=6.1'></script>
> >
> > <!-- <script src="OpenLayers-2.8/lib/OpenLayers.js"></script>-->
> > <script src="http://openlayers.org/api/2.9-rc3/OpenLayers.js"></script>
> >
> > <script type='text/javascript'>
> > //
> > var map;
> >
> > // increase reload attempts
> > OpenLayers.IMAGE_RELOAD_ATTEMPTS = 3;
> >
> > /**
> >  * Initialise la map, les couches, les evenements...
> >  * @return void
> >  */
> > function init() {
> >
> >     var usrbounds = new OpenLayers.Bounds(-1433917.9163166,
> 5014554.4359391,2167713.3877521, 6882716.1409359);
> >
> >     var options = {
> >         projection : new OpenLayers.Projection("EPSG:900913"),
> >         displayProjection : new OpenLayers.Projection("EPSG:4326"),
> >         units : "m",
> >         // restrictedExtent : usrbounds,
> >         numZoomLevels : 18,
> >         maxResolution : 156543.0339,
> >         maxExtent : new OpenLayers.Bounds(-20037508, -20037508, 20037508,
> >                 20037508.34),
> >         controls : [ new OpenLayers.Control.Navigation(),
> >                      new OpenLayers.Control.MousePosition(),
> >                      new OpenLayers.Control.LayerSwitcher() ]
> >     };
> >     map = new OpenLayers.Map('map', options);
> >
> >     // create Google Mercator layers
> >
> >         var gmap = new OpenLayers.Layer.Google("google_str", {
> >             'sphericalMercator' : true
> >         });
> >         var gsat = new OpenLayers.Layer.Google("google_sat", {
> >             type : G_SATELLITE_MAP,
> >             'sphericalMercator' : true,
> >             numZoomLevels : 22
> >         });
> >         var ghyb = new OpenLayers.Layer.Google("google_hyb", {
> >             type : G_HYBRID_MAP,
> >             'sphericalMercator' : true
> >         });
> >         map.addLayers( [ gmap, gsat, ghyb ]);
> >
> >     // create Virtual Earth layers
> >
> >
> >         var veroad = new OpenLayers.Layer.VirtualEarth("bing_str", {
> >             'type' : VEMapStyle.Road,
> >             'sphericalMercator' : true
> >         });
> >         var veaer = new OpenLayers.Layer.VirtualEarth("bing_sat", {
> >             'type' : VEMapStyle.Aerial,
> >             'sphericalMercator' : true
> >         });
> >         var vehyb = new OpenLayers.Layer.VirtualEarth("bing_hyb", {
> >             'type' : VEMapStyle.Hybrid,
> >             'sphericalMercator' : true
> >         });
> >         map.addLayers( [ veroad, veaer, vehyb ]);
> >
> >     // create Yahoo layer
> >
> >         var yahoo = new OpenLayers.Layer.Yahoo("yahoo_str", {
> >             'sphericalMercator' : true
> >         });
> >         var yahoosat = new OpenLayers.Layer.Yahoo("yahoo_sat", {
> >             'type' : YAHOO_MAP_SAT,
> >             'sphericalMercator' : true
> >         });
> >         var yahoohyb = new OpenLayers.Layer.Yahoo("yahoo_hyb", {
> >             'type' : YAHOO_MAP_HYB,
> >             'sphericalMercator' : true
> >         });
> >         map.addLayers( [ yahoo, yahoosat, yahoohyb ]);
> >     // create OSM layer
> >
> >         var mapnik = new OpenLayers.Layer.OSM("osm");
> >
> >         var osmarender = new OpenLayers.Layer.OSM("osm_tile",
> >                 "
> http://tah.openstreetmap.org/Tiles/tile/${z}/${x}/${y}.png<http://tah.openstreetmap.org/Tiles/tile/$%7Bz%7D/$%7Bx%7D/$%7By%7D.png>
> ");
> >         map.addLayers( [ mapnik, osmarender ]);
> >
> >         //map.setBaseLayer(veaer);
> >
> >     map.zoomToExtent(usrbounds, true);
> >
> > }
> >
> > /**
> >  * Passer du plein ecrant a une taille fixe
> >  * @return void
> >  */
> > function togglePleinEcran() {
> >     var height =document.getElementById('carte').style['height'];
> >
> >     if (height != "600px") {
> >         document.getElementById('carte').style['width']='1000px';
> >         document.getElementById('carte').style['height']='600px';
> >
> >     } else {
> >         document.getElementById('carte').style['width']='600px';
> >         document.getElementById('carte').style['height']='400px';
> >
> >     }
> >     map.updateSize();
> >
> > }
> >
> > </script>
> >
> > </head>
> > <body onload="init()" id="api">
> >
> > <div id="carte" style="width: 800px; height: 600px">
> > <div id="map" style="width: 100%; height: 100%"></div>
> >
> > </div>
> >
> > 1 Change the size <br/>
> > 2 Change layer to bing layer.<br/>
> > 3 Changer the size again and go to google map, normally you have bug (if
> you doesn't bug test steps again)<br/><br/>
> >
> > Another bug when you are on google map and switch to bing map the zoom is
> not the same<br/>
> > 1 go to google map <br/>
> > 2 go to bing map <br/>
> > Sometimes the zoom is not the same, make step again if the bug is not
> going<br/>
> >
> > <input class="button" type="button" value="Change size"
>  onclick="togglePleinEcran();" />
> >
> > </body>
> > </html>
> >
> > Hope that show you the issue.
> >
> > Cheers.
> >
> > Jim
> >
> > 2010/4/22 Andreas Hocevar <ahocevar at opengeo.org>
> >
> > On Apr 22, 2010, at 09:25 , Jimmy Aumard wrote:
> >
> > > Hello,
> > >
> > > I have test the 2.9 RC3 version of OpenLayers and I have always the
> bugs if I show a bing map, resize the map and change layer to google map.
> the google map object was not resized.
> >
> > Please provide a minimal example that shows the issue.
> >
> > Regards,
> > Andreas.
> >
> >
> > >
> > > Thanks
> > >
> > > Jim
> > >
> > > 2010/4/20 Jimmy Aumard <jimmy.aumard at gmail.com>
> > > Yes I use OpenLayers 2.8 because it is the stable version, I have same
> problem with Google map and I resolved this with
> > >
> > > map.getLayersBy('name','google_str')[0].mapObject.checkResize();
> > >
> > > I will test the 2.9 version.
> > >
> > > Thanks.
> > >
> > > Jim
> > >
> > > 2010/4/19 Andreas Hocevar <ahocevar at opengeo.org>
> > >
> > > On Apr 19, 2010, at 17:54 , Jimmy Aumard wrote:
> > >
> > > > Thanks!!
> > > >
> > > > I have find another solution :
> > > >
> > > > map.getLayersBy('name','bing_str')[0].mapObject.Resize(500,500);
> > > >
> > > > I resize the bing map object for each layer and it's works.
> > >
> > > Oh, in that case I assume you are still using OpenLayers 2.8? This is
> fixed in 2.9 (see http://trac.openlayers.org/ticket/2285).
> > >
> > > -Andreas.
> > >
> > >
> > >
> > >
> > >
> > > --
> > > Aumard Jimmy
> > > Développeur
> > >
> > > KINAXIA
> > > c/o CICA / PacaEst
> > > 2229 Route des Crêtes
> > > F-06560 Sophia Antipolis
> > >
> > > Tél.: +33 (0)4 8973 0242
> > > Mob.: +33 (0)6 6017 2827
> > > Fax : +33 (0)4 8307 6583
> > >
> > > http://www.kinaxia.fr
> >
> > --
> > Andreas Hocevar
> > OpenGeo - http://opengeo.org/
> > Expert service straight from the developers.
> >
> >
> >
> >
> > --
> > Aumard Jimmy
> > Développeur
> >
> > KINAXIA
> > c/o CICA / PacaEst
> > 2229 Route des Crêtes
> > F-06560 Sophia Antipolis
> >
> > Tél.: +33 (0)4 8973 0242
> > Mob.: +33 (0)6 6017 2827
> > Fax : +33 (0)4 8307 6583
> >
> > http://www.kinaxia.fr
>
> --
> Andreas Hocevar
> OpenGeo - http://opengeo.org/
> Expert service straight from the developers.
>
>


-- 
Aumard Jimmy
Développeur

KINAXIA
c/o CICA / PacaEst
2229 Route des Crêtes
F-06560 Sophia Antipolis

Tél.: +33 (0)4 8973 0242
Mob.: +33 (0)6 6017 2827
Fax : +33 (0)4 8307 6583

http://www.kinaxia.fr
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20100422/a1a1bccb/attachment.html


More information about the Users mailing list