[Users] MapPanel overwriting my map getextent?

Andrew Stewart Andrew.Stewart at reddeer.ca
Mon Sep 20 23:50:44 CEST 2010


  I am trying to display my map inside of a mappanel and ext window. Below is my code and I am using the same exact settings as a map on a different page that shows all my layers without issues. However when I add this to an ext.window and panel it loads but no layers show up as if the zoom level/maxextent is wrong... any ideas?



  <script type="text/javascript">

            // begin map defintion
            var map = new OpenLayers.Map('map',{
                    maxExtent: new OpenLayers.Bounds(-20037508.34, -20037508.34, 20037508.34, 20037508.34),
                    maxResolution: 156543.0399,
                    units: 'km',
                    projection: new OpenLayers.Projection("EPSG:900913"),
                    displayProjection: new OpenLayers.Projection("EPSG:4326")
                }
             );    //end of map definition

         //Base Layer - contains all base layers (everything except transit routes/bus stops)
        var layer_Base = new OpenLayers.Layer.WMS("Base Layer", "http://ITS701X5J1/RedWMS/Request.aspx",
        {
            layers: ['BAS_NEIGHBOURHOOD_SHAPE,BAS_NEIGHBOURHOOD_SHAPE1,BAS_RURAL_BLOCK_LINE,BAS_RURAL_LOT_LINE,LRSV_STREET_SEGMENT,LRSV_SECONDARY_SEGMENT,WWW_PARCELS,BAS_HYDRO,BAS_CITY_BOUNDARY_LINE, Arterial,Highway,Rural_Highway,BAS_BRIDGE'],
            format: 'image/png',
            VERSION: "1.1.1",
            transparent: true
        },
           { isBaseLayer: true,
             singleTile: true
           }
        );

    map.addLayer(layer_Base);

            //Define Map Longitude/Latitude and Start zoom levels
        var startupLat = 52.27210;
        var startupLon = -113.80288;
        var startupLevel = 12;
        var lonLat = new OpenLayers.LonLat(startupLon, startupLat).transform(new OpenLayers.Projection("EPSG:4326"), map.getProjectionObject());

        map.setCenter(lonLat,startupLevel);


        var mapPanel;
Ext.onReady(function() {
    new Ext.Window({
        title: "GeoExt MapPanel Window",
        height: 400,
        width: 600,
        layout: "fit",
        items: [{
            xtype: "gx_mappanel",
            id: "mappanel",
            map: map
        }]
    }).show();

    mapPanel = Ext.getCmp("mappanel");
});</script>





-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.geoext.org/pipermail/users/attachments/20100920/a439f2a7/attachment-0001.htm 


More information about the Users mailing list