[OpenLayers-Users] XYZ Layer with zoom and extent restrictions

David Fuhry dfuhry at gmail.com
Mon Apr 29 07:34:08 PDT 2013


Hi,

   I recently faced this problem. I solved it by setting a tileOrigin:
{..., tileOrigin: new OpenLayers.LonLat(-20037508.34, -20037508.34), ...}
in the layer options, and patching the OpenLayers.Layers.XYZ.getXYZ
function to use "this.tileOrigin.lon" instead of "this.maxExtent.left" and
"-this.tileOrigin.lat" instead of "this.maxExtent.lon".

   I am using OpenLayers 2.12 and after making that change my tiles were
requested properly.

-Dave





On Mon, Apr 29, 2013 at 9:49 AM, semiaddict <news at semiaddict.com> wrote:

> Hello,
>
> I am trying to setup an OL map that uses an XYZ layer as its base layer,
> with the tiles served from an mbtiles file using mbtiles-php
> (https://github.com/infostreams/mbtiles-php/). The mbtiles file only
> contains tiles for the Paris, France region with zoom levels between 11 and
> 19.
>
> I managed to get this working fine with the basic settings
> (http://orbes.mobi/cinemacity/tests/test2.html - source:
> http://orbes.mobi/cinemacity/tests/test2.js), but I would like to add zoom
> and extent restrictions. As soon as I do so by adding the layer options
> maxExtent, zoomOffset, or numZoomLevels, the XYZ parameters used in the
> tile
> URLs become relative instead of absolute
> (http://orbes.mobi/cinemacity/tests/test1.html - source:
> http://orbes.mobi/cinemacity/tests/test1.js).
>
> Am I using the wrong options, or do I need to override the getXYZ function,
> and with what ?
>
> Thank you in advance for any help.
>
>
>
> --
> View this message in context:
> http://osgeo-org.1560.x6.nabble.com/XYZ-Layer-with-zoom-and-extent-restrictions-tp5050252.html
> Sent from the OpenLayers Users mailing list archive at Nabble.com.
> _______________________________________________
> Users mailing list
> Users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/openlayers-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/openlayers-users/attachments/20130429/dad591fa/attachment.html>


More information about the Users mailing list