Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question
up vote 3 down vote accepted

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:

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

and you can use this:

var yorkUrl = '


function get_my_url (bounds) {
        var res =;
        var x = Math.round ((bounds.left - this.maxExtent.left) / (res * this.tileSize.w));
        var y = Math.round (( - / (res * this.tileSize.h));
        var z =;

        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...

share|improve this answer

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.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.