[OpenLayers-Dev] [Fwd: OpenLayers
openlayers\lib\OpenLayers\Layer\Grid.js]
Christopher Schmidt
crschmidt at metacarta.com
Mon Mar 17 11:28:51 EDT 2008
This was sent to me personally. I have not evaluated it.
> Hi,
>
> I find error in ???calculateGridLayout???.
>
> It is nessary to correct tileoffsetx,tileoffsetlon, tileoffsety,
> tileoffsetlat .
>
> In Revision 6535 in Grid.js
>
> var offsetlon = bounds.left - extent.left;
> var tilecol = Math.floor(offsetlon/tilelon) - this.buffer;
> var tilecolremain = offsetlon/tilelon - tilecol;
> var tileoffsetx = -tilecolremain * this.tileSize.w;
> var tileoffsetlon = extent.left + tilecol * tilelon;
>
> var offsetlat = bounds.top - (extent.bottom + tilelat);
> var tilerow = Math.ceil(offsetlat/tilelat) + this.buffer;
> var tilerowremain = tilerow - offsetlat/tilelat;
> var tileoffsety = -tilerowremain * this.tileSize.h;
> var tileoffsetlat = extent.bottom + tilerow * tilelat;
>
> I use
>
> var offsetlon = bounds.left - extent.left;
> var tilecol = Math.floor(offsetlon/tilelon) - this.buffer;
> var tilecolremain = offsetlon/tilelon - tilecol;
> var tileoffsetx = -tilecolremain * this.tileSize.w;
> var tileoffsetlon = extent.left + tilecol * tilelon;
>
> if (this.tileOrigin) {
> var nx = Math.round((tileoffsetlon -
> this.tileOrigin.lon)/tilelon);
> var x = tileoffsetlon;
> tileoffsetlon = this.tileOrigin.lon + nx * tilelon;
> tileoffsetx += (tileoffsetlon - x) / resolution;
> }
>
> var offsetlat = bounds.top - (extent.bottom + tilelat);
> var tilerow = Math.ceil(offsetlat/tilelat) + this.buffer;
> var tilerowremain = tilerow - offsetlat/tilelat;
> var tileoffsety = -tilerowremain * this.tileSize.h;
> var tileoffsetlat = extent.bottom + tilerow * tilelat;
>
>
>
> if (this.tileOrigin) {
> var ny = Math.round((this.tileOrigin.lat -
> tileoffsetlat)/tilelat);
> var y = tileoffsetlat;
> tileoffsetlat = this.tileOrigin.lat - ny * tilelat;
> tileoffsety -= (tileoffsetlat - y) / resolution;
> }
>
>
>
> Regards,
>
>
>
> Toporovskiy Alexandr.
Regards,
--
Christopher Schmidt
MetaCarta
More information about the Dev
mailing list