I have an OpenLayers based web app, map object is initialized like this:

p4326 = new OpenLayers.Projection('EPSG:4326');
p3857 = new OpenLayers.Projection('EPSG:3857');

//initialize map object, bind it to map_canvas div
map = new OpenLayers.Map('map_canvas', 
    //allOverlays: true,
    projection: p3857,
    displayProjection: p4326,
    maxExtent: new OpenLayers.Bounds(-20037508.3427892,-20037508.3427892,20037508.3427892,20037508.3427892), 
    projection: p3857});

I have a pre-rendered map from levels 8-16, however, in order to view zoom level 16 of the map, I have to initialize its layer like this:

var osm = new OpenLayers.Layer.XYZ("OSM Mapnik", "http://localhost/osm_tiles/osm/${z}/${x}/${y}.png", { isBaseLayer: true, sphericalMercator: true, numZoomLevels: 17});

Notice, that I set the zoom level 17 (or I can't zoom and view level 16 of the map). Can someone tell me why?

  • Does your backend support it? The rendering server needs to be setup accordingly! – Styp Oct 1 '12 at 19:29
  • Rendering was ok. I ll check what are the values of map object with firebug – U2ros Oct 1 '12 at 19:56
  • 2
    need to count up from 0 so 17 will equal zoom level 16. (it is part of the api not because your tiles are starting from level 8). – Mapperz Oct 1 '12 at 21:01
  • @mapperz: thanks, i forgot i should consider the argument as index – U2ros Oct 2 '12 at 6:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.