Custom Tile Layer Problem
- by Myra
Hi,I'm currently implementing logic on custom tile layers via OpenLayers
function getTiles() {
var res = this.map.getResolution();
var x = Math.round((bounds.left - this.maxExtent.left) / (res * this.tileSize.w));
var y = Math.round((this.maxExtent.top - bounds.top) / (res * this.tileSize.h));
var z = this.map.getZoom();
return ......;
}
What I need to is to carry this code in Google API v3.
As I searched documentation I found this code to work with:
var customtile = new google.maps.ImageMapType({
getTileUrl: function (coord, zoom) {
....
....
}
Unfortonately,I cannot convert logic in OpenLayers code to Google.
As I know resolution is
180 * tileSize.w / Math.pow(2, zoom) //where tileSize is 256x256
Since Google projection is same with my tiles WGS84 boundary should be
-180,-90,90,180
I need to calculate to extent coordinates,but in function getTileUrl,there are two arguments.One of which is zoom,but the other coord is some x,y pair which I dont understand what that is.What is that exactly ?
How can I generalize formula for calculating tile numbers in Google Maps?
Thank you
Myra