[OpenLayers-Users] Delaying Layer Initialization

GregM grzemy at gmail.com
Fri Jul 27 04:51:18 EDT 2007


I have corrected it in Map.js setCenter function
with some additional lines inside 'for' code below:

for (var i = 0; i < this.layers.length; i++) {
                var layer = this.layers[i];
                if (!layer.isBaseLayer) {
                    
                    var moveLayer;
                    var inRange = layer.calculateInRange();
                    if (layer.inRange != inRange) {
                        // Layer property has changed. We are going 
                        // to call moveLayer so that the layer can be turned
                        // off or on.   
                        layer.inRange = inRange;
                        //do NOT download tiles if not in scale limit
                        moveLayer = (layer.visibility && layer.inRange); //
was ... = true;
                        //switch off layer after going beyond scale limit
                        if (layer.visibility && !layer.inRange)
                            layer.setVisibility(false);
                        this.events.triggerEvent("changelayer");
                    } else {
                        // If nothing has changed, then we only move the
layer
                        // if it is visible and inrange.
                        moveLayer = (layer.visibility && layer.inRange);
                        //switch off layer after going beyond scale limit
                        if (layer.visibility && !layer.inRange)
                            layer.setVisibility(false);
                    }
                    if (moveLayer) {
                        layer.moveTo(bounds, zoomChanged, dragging);
                    }
                }                
            }



GregM wrote:
> 
> I would add that tiles for invisible layers are downloaded from server not
> only on map/layer initialization, but also while layer goes beyond its
> minScale. 
> Value of minScale is making layer not downloaded while initialization but
> after zooming to scale < minScale.
> 
> Is this already filled as bug in tickets ? Because I cannot find it. 
> 
> Is there any workaround for this for OE 2.4 ?
> 
> Greg
> 
> 
> 
> Christopher Schmidt-4 wrote:
>> 
>> On Sat, May 26, 2007 at 10:28:39AM +0200, Arnd Wippermann wrote:
>>> Hello Christopher,
>>> 
>>> I have the same problem (therefor I'm still using Openlayers 1.0).
>> 
>> Okay, thanks. I'd heard reports, but they were always vague in the
>> problems they were reporting.  
>>> OpenLayers should only load tiles for the baselayer from gis.ibbeck.de
>>> and
>>> wms.jpl.nasa.gov for the world image. If you use firebug, you could see,
>>> that the tiles for the other servers are also loaded.
>> 
>> Agreed. I'll file this as a bug against 2.5. Since it's been around since
>> the start of the 2.0 branch, it's not enough to delay 2.4. 
>> 
>>> After the first load of the map, pan and zoom loads only the tiles for
>>> the
>>> visible servers.
>>> 
>>> http://gis.ibbeck.de/ginfo/ibbOLClient/OLC2.3%20RC1.html?MAPNR=10000&LAYERS=
>>> 11200,12700,11500,11500,10600,10700,10900,11000,10000&ZOOM=3&CENTER=10.1745,
>>> 50.819 
>>> 
>>> (If I load the newest version from
>>> http://svn.openlayers.org/branches/openlayers/2.4/, Revision 3188 says
>>> the
>>> html-page and my svn-program, the OpenLayers.VERSION_NUMBER is still
>>> "$Revision: 2942 $". Miss I something or is this a bug).
>> 
>> This is expected -- the VERSION_NUMBER is relevant to the last time that
>> file was updated. Part of the release process is to edit the
>> OpenLayers.js file (to change the license), so releases get a new
>> VERSION_NUMBER -- it's only useful on releases. Unfortunately, I don't
>> know of a better way to automate this. 
>> 
>>> Is it possible with the number of the revision also deliver a variable
>>> with
>>> the plain text for the OpenLayers Version(example: 2.4 RC4).
>> 
>> There is no automatic way of doing this, and it's a step that I fear
>> would be missed if we made it a human intervention step, which is why
>> it's not done. If you're actually using RC4 -- that is, from the /tags/
>> instead of the branch -- the VERSION_NUMBER represents that.
>> 
>> Regards,
>> -- 
>> Christopher Schmidt
>> MetaCarta
>> _______________________________________________
>> Users mailing list
>> Users at openlayers.org
>> http://openlayers.org/mailman/listinfo/users
>> 
>> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Delaying-Layer-Initialization-tf3816850.html#a11797327
Sent from the OpenLayers Users mailing list archive at Nabble.com.




More information about the Users mailing list