# Can overlays have different resolutions from the base layer?

I am trying to show a regional map on top of base map but without success. While debugging I noticed that my regional map has a different set of resolutions from the base. Is this allowed in OpenLayers?

If you change the map options to use yorkLayer's resolutions array then the regional tiles will load but no the base map's.

-

maybe there is an easy way for solving this but if we choose to go the hard way, you can write your own cache mechanism for overlaping certain zoom levels with your yorkLayer and your baseLayer.

File and Folder Mechanisms:

z = zoom
x = folder name
y = file name


Google Map: z/x/y.jpg

ArcGIS Cache: z/y/x.jpg

Example Image Adress:

http://ww4.yorkmaps.ca/ArcGIS/rest/services/CacheMaps/YR_StreetMap/MapServer/tile/0/633/286


TMS Cache: z/x/((2**z - 1) -y).jpg

and you can use this:

var yorkUrl = 'http://ww4.yorkmaps.ca/ArcGIS/rest/services/CacheMaps/
YR_StreetMap/MapServer/tile/';

....

function get_my_url (bounds) {
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();

var path = z + "/" + x + "/" + y + "." + this.type;
var url = this.url;
if (url instanceof Array) {
url = this.selectUrl(path, url);
}
return url + path;
};

var yorkLayer = new OpenLayers.Layer.TMS("YorkLayer", yorkUrl , { 'type':'png',
'getURL':get_my_url });
yorkLayer.isBaseLayer = false;


but dont forget you have to beat your brains out to get true result...The point to focus on is that get_my_url function...

i hope it helps you...

-

This is an annoying behaviour of ArcGIS: to start the zoom level number at the first scale level of the map service, instead of just align it to the defacto zoom/scale matching of full-world services.

If possible (i.e. if you have control and can make changes to the YR_StreetMap service), I would recommend changing the defined scale range to match the standard like World_Street_Map (i.e. level zero = 1:591M). You don't need to create the extra tiles for those top zoom levels, or you could create simple placeholders tiles.

I'm not sure of the specifics of OpenLayers -- there may be an easier way to do it. Changing the URL to various tiles (as in Aragon's answer) is certainly another way to fix the zoom level discrepancy. I think making everything the same is nicer: that way the tile references (e.g. z/y/x) are the same between services.

-