[OpenLayers-Users] Referencing Kamap a Tile
Tim Schaub
noreply at geocartic.com
Thu Jan 25 23:26:44 EST 2007
> But what I want to do, is reference the top and left
> attributes of a tile that is already loaded, with the
> reference being made from a click event in the viewport (from
> which I can retrieve the pixel or lon/lat).
// kaMath
var resolution = kaLayer.getResolution();
var tileMapWidth = resolution * kaLayer.tileSize.w;
var tileMapHeight = resolution * kaLayer.tileSize.h;
var mapPoint = kaLayer.getLonLatFromViewPortPx(viewPortPx);
var tileLeft = tileMapWidth * Math.floor(mapPoint.lon / tileMapWidth);
var tileBottom = tileMapHeight * Math.floor(mapPoint.lat / tileMapHeight);
var kaLeft = tileLeft / resolution;
var kaTop = -(tileBottom + tileMapHeight) / resolution;
kaRegards,
Tim
>
> Thanks,
>
> Ben
>
>
>
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
>
More information about the Users
mailing list