[OpenLayers-Users] Referencing Kamap a Tile

Ben Brehmer bbrehmer at refractions.net
Fri Jan 26 12:17:21 EST 2007


Ka Thank you.

Ben

Tim Schaub wrote:
>> 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
>>
>>     
>
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
>   




More information about the Users mailing list