[OpenLayers-Dev] Problem with Layer/Grid.js:moveTo() function..

Bill Woodall bwoodall at wardrobe.dhs.org
Thu May 3 02:03:05 EDT 2007


Hi Louvy, Chris, and Dev List,

I made a test page to look at Louvy problem and hopefully help in the
debug.  Yes, it is there!  *sigh*

If you have a Gmap BaseLayer and an overlay then you will see the
problem.  If the overlay is turned off, the problem goes away.

The test page first comes up with vmap0 setCentered over NY, click on
the button under the map will setCenter of SanDiego which should be
rather quick (you mileage may vary).
Click the button once more to change to Gmap (Sat) and setCenter back
over to NY which take you some time ( a lot of time ).


[1] http://wardrobe.dhs.org/fire/grid_moveToTest.html


.........Bill,

On Wed, 2007-05-02 at 10:36 -0700, Louvy Joseph wrote:
> Thanks Chris. I am on openlayers trunk with revision 3087. 
> (It may take a while for me to check out the latest 3113 but I don't
> see any changes in moveTo function since 3087).
> 
> I have a base google layer set to zoom level 15 and then a WMS layer
> from my geoserver. Here is my hypothesis: when we are at such high
> zoom level, if we do setCenter() to a far away location, it seems that
> it is walking each grid one at a time. 
> 
> Here is the code I found under firebug looping for too many times. It
> keeps doing shiftRow() or shiftColumn():
> 
>     moveTo:function(bounds, zoomChanged, dragging) {
>         OpenLayers.Layer.HTTPRequest.prototype.moveTo.apply(this,
> arguments);
>         .......
>         if (bounds != null) {
>             if (!this.grid.length || zoomChanged 
>              ............
>             } else {
>                ............
>                 while (true) {
>                     var tlLayer = this.grid[0][0].position;
>                     var tlViewPort = 
>                         this.map.getViewPortPxFromLayerPx(tlLayer);
>                     if (tlViewPort.x > -this.tileSize.w * (buffer -
> 1)) {
>                         this.shiftColumn(true);
>                     } else if (tlViewPort.x < -this.tileSize.w *
> buffer) {
>                         this.shiftColumn(false);
>                     } else if (tlViewPort.y > -this.tileSize.h *
> (buffer - 1)) {
>                         this.shiftRow(true);
>                     } else if (tlViewPort.y < -this.tileSize.h *
> buffer) {
>                         this.shiftRow(false);
>                     } else {
>                         break;
>                     }
>                 };
>                .................
>             }
>         }
>     },
> 
> 
> Thanks
> Louvy
> 
> Christopher Schmidt wrote: 
> > On Wed, May 02, 2007 at 01:20:54AM -0700, Louvy Joseph wrote:
> >   
> > > I do not fully understand this function but Grid.js:moveTo() takes long 
> > > time in the while loop if we move from one location on the WMS map to a 
> > > very far away location.
> > > 
> > > For example, say my current center is new york city and I move to 
> > > california by doing a map.setCenter() call. [I am not dragging the map 
> > > but directly making a setCenter() call]. Then the moveTo() function in 
> > > Grid.js seems to loop forever while shifting one column or row at a time 
> > > moving from new york to california. That takes too long time. Most of 
> > > the time firefox thinks that the script is looping and asks whether I 
> > > can stop it.
> > > 
> > > Does anybody know what could be happening here?
> > >     
> > 
> > What version of OpenLayers are you using? I know this existed in 1.0,
> > and may have existed in 2.0, but should have almost definitely been
> > fixed in 2.2.
> > 
> > Regards,
> >   
> 
> _______________________________________________
> Dev mailing list
> Dev at openlayers.org
> http://openlayers.org/mailman/listinfo/dev




More information about the Dev mailing list