[OpenLayers-Users] Why won't this map re-center?

Scott Chapman scott at mischko.com
Mon Feb 27 01:10:12 EST 2012


Here's my code to build a map in the qooxdoo framework.
The map displays correctly and zooms to the level I tel it to but it
won't recenter to the LatLon I tell it to.

Any clues?

Thanks!
Scott

qx.Class.define("kiosk_portal.OpenLayersMap",
{
  extend : qx.ui.core.Widget,
  construct : function()
    {
      this.base(arguments);
      this.set({
        width: 950,
        height: 650
      });
      console.log("G A");
      this.addListenerOnce("appear", function() {

        var arrayOSM =
["http://otile1.mqcdn.com/tiles/1.0.0/osm/${z}/${x}/${y}.jpg",

"http://otile2.mqcdn.com/tiles/1.0.0/osm/${z}/${x}/${y}.jpg",

"http://otile3.mqcdn.com/tiles/1.0.0/osm/${z}/${x}/${y}.jpg",

"http://otile4.mqcdn.com/tiles/1.0.0/osm/${z}/${x}/${y}.jpg"];
        var baseOSM = new OpenLayers.Layer.OSM("MapQuest-OSM Tiles", arrayOSM);

        var map = new OpenLayers.Map( this.getContentElement().getDomElement(),
        {controls: [
            new OpenLayers.Control.PanZoom(),
            new OpenLayers.Control.ScaleLine(),
            new OpenLayers.Control.OverviewMap(),
            new OpenLayers.Control.Navigation(
                {mouseWheelOptions: {interval: 100}}
                )
            ]
        } );
        map.addLayer(baseOSM);
        map.addControl(new OpenLayers.Control.Attribution());
        map.setCenter(new OpenLayers.LonLat(-98.4375,39.774769));
        map.zoomTo(2);
        this.__map = map;
      });
    }
});


More information about the Users mailing list