[OpenLayers-Trac] [OpenLayers] #3484: setcenter is not being nice....

OpenLayers trac-20090302 at openlayers.org
Wed Aug 31 21:27:47 EDT 2011


#3484: setcenter is not being nice....
-----------------------+----------------------------------------------------
 Reporter:  cpugenuis  |       Owner:              
     Type:  bug        |      Status:  new         
 Priority:  trivial    |   Milestone:  2.10 Release
Component:  Map        |     Version:  2.11 RC3    
 Keywords:             |       State:              
-----------------------+----------------------------------------------------
 so, i am running openlayers, and it isn't properly setting the
 coordinates. i followed the PDF guide by packt publishing, and it isn't
 working. i got it to show me where the center is, but when i put in the
 coordinates, it goes to those coordinates, but it nullifies the zoom. what
 is going on? i had problems earlier with a similar (but much outdated)
 map.

 here is the code

 <html>
 <head>
 <title>OpenLayers Example</title>
 <meta charset='utf-8' />
         <script
 src="http://maps.google.com/maps?file=api&amp;v=2&amp;key=ABQIAAAAKkhwo33u311L5mz
 --Y7BEBTwprBKjA_n3Ly6yGptNtUzx2EkQRQ7CYjqtnwqpFOZmWe_M5mJHK4T4g"></script>
         <script src='http://openlayers.org/api/OpenLayers.js'></script>
         </head>
         <body>
                 <div style="width:100%; height:100%" id="map"></div>
                 <script type="text/javascript">
                 var map = new OpenLayers.Map('map');


                         var gmap = new
 OpenLayers.Layer.Google("GMaps",{type: G_HYBRID_MAP, numZoomLevels: 20});

                         map.addLayer(gmap);

                         map.setCenter(new OpenLayers.LonLat(0,0), 15);

                         map.setCenter(new OpenLayers.LonLat(39, 89), 5);

                 </script>
         </meta>
         </body>
 </html>

-- 
Ticket URL: <http://trac.openlayers.org/ticket/3484>
OpenLayers <http://openlayers.org/>
A free AJAX map viewer


More information about the Trac mailing list