[Users] Base Layer Does Not Display on Initial Load

IT Intern itintern12 at gmail.com
Thu Sep 23 21:43:19 CEST 2010


Hello GeoExt users,

This one's gotten me totally stumped.  I have some base layers and a few wms
overlays.  When my page loads it shows the base layer for a quick second and
then goes blank as it loads my overlays.  It stays blank until I click the
map, etc.  Then it displays properly.  I've Googled all sorts of things
concerning this sort of issue and have come up with nothing that gives me a
hint as to why this could be.  This never happened to me before until I
started using GeoExt to display my map.  Is it something in code I must
write for GeoExt or OpenLayers so that this doesnt happen?  It's driving me
crazy!!!

Code:

//Base Layers

             var ghyb = new OpenLayers.Layer.Google(
                    "Google Hybrid",
                    {type: google.maps.MapTypeId.HYBRID, numZoomLevels: 20}
                );

            var gmap = new OpenLayers.Layer.Google(
                    "Google Streets", // the default
                    {numZoomLevels: 20},{visibility: true}
            );

            var osm = new OpenLayers.Layer.OSM();

//.....
....
....

var options = {
                    controls: [new OpenLayers.Control.Navigation()],
                    maxExtent: new OpenLayers.Bounds(-20037508.34,
-20037508.34, 20037508.34, 20037508.34),
                    maxResolution: "auto",
                    projection: new OpenLayers.Projection("EPSG:900913"),
                    units: 'm',
                    allOverlays: false
            }


            var map = new OpenLayers.Map('map', options);
            map.addLayers([gmap, ghyb, osm, all_chn, all_tib, chn_bridges,
tib_bridges, chn_countys, tib_countys, chn_farms, tib_farms, chn_glaciers,
tib_glaciers, chn_grazing, tib_grazing, chn_hwyCrew, tib_hwyCrew,
chn_hospitals, tib_hospitals, chn_lakes, tib_lakes, chn_monastaries,
tib_monastaries, chn_pass, tib_pass, chn_rivers, tib_rivers, chn_townships,
tib_townships, chn_villages, tib_villages]);

            var mapPanel = new GeoExt.MapPanel({
                title: "Map",
                map: map,
                center: map.setCenter(new OpenLayers.LonLat(93.9,
29.53).transform(new OpenLayers.Projection("EPSG:4326"),
map.getProjectionObject())),
                zoom: 9,
                region: "center",
                bbar: [{
                    xtype: "label",
                    text: "Scale = 1 : "
                }],
                items: [{
                    xtype: "gx_zoomslider",
                    vertical: true,
                    height: 300,
                    x: 10,
                    y: 20,
                    plugins: new GeoExt.ZoomSliderTip()
                }]
            });

            var layerRoot = new Ext.tree.TreeNode({
                text: "All Layers",
                expanded: true,
                autoLoad: true
                });

//Is there something to set here???
                layerRoot.appendChild(new GeoExt.tree.BaseLayerContainer({
                text: "Base Layers",
                map: map,
                layerStore: mapPanel.layers,
                expanded: true,
                autoLoad: true
                }));

//.....

Thank you very much, I appreciate any suggestions :),

elshae
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.geoext.org/pipermail/users/attachments/20100923/78df0c80/attachment.htm 


More information about the Users mailing list