[Users] Base Layer Does Not Display on Initial Load

Jason Woolard Jason.Woolard at noaa.gov
Fri Sep 24 16:21:36 CEST 2010


Elshae,

I experienced some similar behavior with my page using GeoExt and Google layers. I found that the issue only happened when I used the Google physical or hybrid map as my initial base layer. I change the initial base layer to be Google streets and the blank loading problem disappeared. Once Google streets was loaded I could toggle between the hybrid and physical maps with no problem. So, not actually a solution but it might be worth trying.

I'd be interested to hear if someone chimes in with an actual fix. It drove me crazy for a couple of days too. 

Good luck.


users-request at geoext.org wrote:
> Send Users mailing list submissions to
> 	users at geoext.org
>
> To subscribe or unsubscribe via the World Wide Web, visit
> 	http://www.geoext.org/cgi-bin/mailman/listinfo/users
> or, via email, send a message with subject or body 'help' to
> 	users-request at geoext.org
>
> You can reach the person managing the list at
> 	users-owner at geoext.org
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of Users digest..."
>
>
> Today's Topics:
>
>    1. Re: legend for OpenLayers.Layer.Image (Charlton Galvarino)
>    2. Base Layer Does Not Display on Initial Load (IT Intern)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Thu, 23 Sep 2010 15:18:21 -0400
> From: Charlton Galvarino <charlton at 2creek.com>
> Subject: Re: [Users] legend for OpenLayers.Layer.Image
> To: Eric Lemoine <eric.lemoine at camptocamp.com>
> Cc: "users at geoext.org" <users at geoext.org>
> Message-ID:
> 	<97FDCEA6D905154D94E20D02312C8A310D43818F58 at mse18be1.mse18.exchange.ms>
> 	
> Content-Type: text/plain; charset="us-ascii"
>
>   
>> This won't work. "legendUrl" must be set in the layer record, as
>> opposed to the layer. For further help please paste your code that
>> creates the map, layers, and the MapPanel.
>>     
>
> Ah, interesting.  This little code snipped doesn't seem to make a difference.  It might not make too much sense to pin this on a Store listener, but I thought I could at least test it this way.
>
>   var olLayerStore = new GeoExt.data.LayerStore({
>      map    : map
>     ,layers : baseLayer
>     ,listeners : {
>       add : function(store,rec,index) {
>         if (rec[0].get('layer').name == 'myImageName') {
>           rec[0].set('legendUrl','http://myLegendUrl');
>         }
>       }
>     }
>   });
>
> In any case, I know that I am getting to the set() part of my code when I add my image by firing a dumb alert(), but I still don't see anything in my legend panel.
>
> My map is pretty generic:
>
>   map = new OpenLayers.Map('',{
>     controls : [
>        new OpenLayers.Control.Navigation()
>       ,new OpenLayers.Control.PanZoomBar()
>       ,mouseControl
>     ]
>   });
>
> My baseLayer is a normal WMS layer as well.  And the addition of other normal WMS-es causes beautiful legends to show up in the panel.
>
> I certainly don't mind posting code, but I was trying to hone in on where I thought the problem might be.  Of course, the problem could be sitting here in this chair typing this email!
>
>
> ------------------------------
>
> Message: 2
> Date: Thu, 23 Sep 2010 15:43:19 -0400
> From: IT Intern <itintern12 at gmail.com>
> Subject: [Users] Base Layer Does Not Display on Initial Load
> To: users at geoext.org
> Message-ID:
> 	<AANLkTikpF6KARQtUAun7Mx8pc_P5jpad9cDAXj+onWwp at mail.gmail.com>
> Content-Type: text/plain; charset="iso-8859-1"
>
> 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.html 
>
> ------------------------------
>
> _______________________________________________
> Users mailing list
> Users at geoext.org
> http://www.geoext.org/cgi-bin/mailman/listinfo/users
>
>
> End of Users Digest, Vol 20, Issue 34
> *************************************
>   


More information about the Users mailing list