<div dir="ltr">I resolved the previous problem but ran into another: when an XYZ layer has "isBaseMap: false", has maxExtent set, and has a non-default tileOrigin, the getXYZ method in Layers/XYZ.js incorrectly calculates the x, y, and z coordinates based on the layer's maxExtent bounds rather than on its tileOrigin property. I fixed this problem by replacing "this.maxExtent.left" with "this.tileOrigin.lon" and replacing "this.maxExtent.top" with "-this.tileOrigin.lat" in the getXYZ method of Layers/XYZ.js.<div>
<br></div><div>I hope this helps somebody and that OpenLayers can be patched to fix the bug. I am using 2.12.</div><div><br></div><div>-Dave</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Sun, Apr 21, 2013 at 11:46 AM, David Fuhry <span dir="ltr"><<a href="mailto:dfuhry@gmail.com" target="_blank">dfuhry@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>Hi Rohan or others,</div><div><br></div><div>   Wondering if you ever found a resolution for this problem. What I'm experiencing is when using an XYZ layer with isBaseMap: false, setting maxScale to anything other than NaN or null, or setting minResolution to anything other than null, or 'auto', results in the layer never displaying. Obviously I want to set maxScale or minResolution to a numeric value, but the layer simply never displays when I do, no matter what the numeric value.</div>

<div><br></div>Thanks,<div><br></div><div>Dave</div><div><br></div><div><br></div><div><div>Rohan Parkes rohan.parkes at <a href="http://pelicancorp.com" target="_blank">pelicancorp.com</a> </div><div>Fri Jun 24 00:05:27 EDT 2011</div>
<div>
<br></div><div><div>I have a layer based on a 3rd-party map provider that uses an XYZ layer type</div><div>that is optimised to show Australia and New Zealand. If I just let the layer</div><div>run with sphericalMercator set to true, and don't set anything else,</div>

<div>everything's fine. However, I want to be able to limit the number of layers</div><div>available based on criteria like zoom level (e.g. the map should have zoom</div><div>levels between 20km and 1 km). I have been able to do this with other layer</div>

<div>types like ArcGIS93Rest by having a resolutions array in advance, and</div><div>truncating it according to the calculated zoom level and then passing it to</div><div>the map object.</div><div><br></div><div>I can't get the same idea to work if I use an XYZ layer. It won't work</div>

<div>properly if I pass in any array of resolutions, even if it's the same array</div><div>of Spherical Mercator resolutions that it generates itself. </div><div><br></div><div>Based on the information in</div><div><a href="http://trac.osgeo.org/openlayers/wiki/SettingZoomLevels" target="_blank">http://trac.osgeo.org/openlayers/wiki/SettingZoomLevels</a> I've tried setting</div>

<div>the minZoomLevel/maxZoomLevel, minResolution/maxResolution. These seem to</div><div>have no effect, or they create bizarre results. The only setting that seems</div><div>to constrain the levels is numZoomLevels, but this doesn't give me any</div>

<div>control over which range of levels it selects - if I set it to 10, it</div><div>defaults to the outermost 10.</div><div><br></div><div>(I have the same issue with the OSM layer type, which I would like to have</div>
<div>
as a fallback if the main map provider fails - again I can't seem to specify</div><div>the exact zoom levels I want.)</div><div><br></div><div>One issue - I'm not passing the array into the map constructor via the</div>

<div>options parameter during initialisation. Due to the way the code has been</div><div>written, it creates an empty map object, then sets various parameters. I</div><div>don't know it that's a factor.</div><div>

<br></div><div>One other thing that seems a bit odd - even if I can successfully set the</div><div>levels with a resolutions array, I still have to specify the number of zoom</div><div>levels in the map object. I thought it would figure this out itself from the</div>

<div>size of the array.</div><div><br></div><div>Rohan Parkes</div><div><br></div><div>Melbourne</div></div></div></div>
</blockquote></div><br></div></div>