[OpenLayers-Users] Zoomify and fractional zoom

David Régade dregade at viewsurf.com
Wed Jun 27 07:15:17 PDT 2012


Ok, it works now.

To do that I configured my layer's serverResolutions with the same array I set 
up for resolutions.
Only with this trick tiles are not correctly displayed because Zoomify functions 
getURL and getImageSize use:

var res = this.map.getResolution();
...
var z = this.map.getZoom();

instead of:

var res = this.getServerResolution();
...
var z = this.getZoomForResolution( res );


With this patch and layer correct configuration, fractionalZoom works for me 
with Zoomify layer.

Do you think this patch is correct or should I take care of some specials cases ?

Regards
David

On 27/06/2012 15:00, Andreas Hocevar wrote:
> To achieve this, it should be enough to configure your layer's
> serverResolutions with the same array that you have set for
> resolutions.
>
> Andreas.
>
> On Wed, Jun 27, 2012 at 2:46 PM, David Régade<dregade at viewsurf.com>  wrote:
>> I tried this solution too and it didn't work. I had a look to this example:
>>
>> http://openlayers.org/dev/examples/fractional-zoom.html
>>
>> In this example tile size is allways 256x256 whatever the zoom level. But
>> with zoomify it can't be allways 256x256 because tiles have to be streched
>> or shrinked according to zoom level. zoomify relies on direct tile image url
>> , not a mapserver like the example above. These direct images urls have
>> fixed dimensions and represent allways the same "world region".
>> That's why I can't figure out fractionalZoom can work with Zoomify layer if
>> the displayed tile have allways the same size.
>>
>> A solution could be to setup the integer zoom for the layer and scale the
>> layer (like transformDiv() does) to obtain the good result.
>>
>> Regards
>> David
>>
>>
>> On 27/06/2012 12:12, Andreas Hocevar wrote:
>>>
>>> I see. So maybe you need to leave the original z assignement as-is
>>> (without Math.round or Math.floor), and only change the lines that say
>>>
>>> this.tierSizeInTiles[z]
>>>
>>> to something like
>>>
>>> this.tierSizeInTiles[z|0]
>>>
>>> (z|0 being a more efficient way of saying Math.floor(z)).
>>>
>>> Andreas.
>>>
>>> On Wed, Jun 27, 2012 at 12:04 PM, David Régade<dregade at viewsurf.com>
>>>   wrote:
>>>>
>>>> I tried Math.floor and the problem is the same. I'm not sure the problem
>>>> comes from Math.round/floor because with my example, for an integer zoom
>>>> value (3 for example), top left displayed tile is 256px width (thanks
>>>> firebug). For a 3.4 zoom value should the top left tile image width be
>>>> greater than 256px ?
>>>>
>>>> So if the displayed tile images are 256px for 3.4 zoom level, you need
>>>> more
>>>> tile to cover the layer extent in resolution associated to this zoom
>>>> level.
>>>> That's why on my axample, when you click on the button the displayed tile
>>>> images are not centered as is it should be and another image tile (that
>>>> doesn't exist) is required and tried to be drawn. Am I wrong ?
>>>>
>>>> Here is a screenshot of what I observed:
>>>> http://david.regade.free.fr/openlayers/z3.4.jpg
>>>>
>>>> Regards
>>>> David
>>>>
>>>>
>>>> On 27/06/2012 11:41, Andreas Hocevar wrote:
>>>>>
>>>>>
>>>>> Try Math.floor instead of Math.round - currently the client zoom
>>>>> implementation only supports oversampling, so you need the next
>>>>> smallest zoom level.
>>>>>
>>>>> Andreas.
>>>>>
>>>>> On Wed, Jun 27, 2012 at 10:51 AM, David Régade<dregade at viewsurf.com>
>>>>>   wrote:
>>>>>>
>>>>>>
>>>>>> Hi,
>>>>>>
>>>>>> It can't be so easy. I fixed line 225 with:
>>>>>>              var z = Math.round(this.map.getZoom());
>>>>>>
>>>>>> And another bug appeared line 201, same fix:
>>>>>>              var z = Math.round(this.map.getZoom());
>>>>>>
>>>>>> However on this example, http://david.regade.free.fr/openlayers/,
>>>>>> setting
>>>>>> zoom to 3.4 doesn't generate javascript errors anymore but the result
>>>>>> isn't
>>>>>> correct. A tile is tried to be drawn and it shouldn't.
>>>>>>
>>>>>> I tried to trace where and why this tile is drawn but I'm to new to
>>>>>> openlayers to find where the problem comes from.
>>>>>>
>>>>>> Regards
>>>>>> David
>>>>>>
>>>>>> On 27/06/2012 08:05, Andreas Hocevar wrote:
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> I just see that there is a bug in Zoomify.js, line 225:
>>>>>>>
>>>>>>>              var z = this.map.getZoom();
>>>>>>>
>>>>>>> We need the integer of getZoom() here instead.
>>>>>>>
>>>>>>> Maybe you want to send a pull request with a fix?
>>>>>>>
>>>>>>> Andreas.
>>>>>>>
>>>>>>> On Tue, Jun 26, 2012 at 11:33 PM, David Régade<dregade at viewsurf.com>
>>>>>>>   wrote:
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> I get the last OpenLayers master and this feature doesn't work with
>>>>>>>> the
>>>>>>>> following example:
>>>>>>>>
>>>>>>>> http://david.regade.free.fr/openlayers/
>>>>>>>>
>>>>>>>> Is there something I'm doing wrong ?
>>>>>>>>
>>>>>>>> When setting up a fractional zoom (by clicking on the button for
>>>>>>>> example)
>>>>>>>> Firebug catches an error.
>>>>>>>> Layer is resized but the tiles are not set correctly.
>>>>>>>>
>>>>>>>> David
>>>>>>>>
>>>>>>>>
>>>>>>>> On 26/06/2012 16:32, Andreas Hocevar wrote:
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> This is supported in OpenLayers master and the upcoming 2.12
>>>>>>>>> release.
>>>>>>>>>
>>>>>>>>> Andreas.
>>>>>>>>>
>>>>>>>>> On Tue, Jun 26, 2012 at 3:12 PM, David Régade<dregade at viewsurf.com>
>>>>>>>>>   wrote:
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> Hi,
>>>>>>>>>> We use openlayers to display large panoramas. We use ZoomifyImage
>>>>>>>>>> to
>>>>>>>>>> split
>>>>>>>>>> original image in tiles and Zoomify layer to display these tiles.
>>>>>>>>>> I would like to use fractionalZoom with Zoomify layer but this
>>>>>>>>>> layer
>>>>>>>>>> doesn't
>>>>>>>>>> support this feature. The main goal is to able to resize displayed
>>>>>>>>>> tiles
>>>>>>>>>> for
>>>>>>>>>> zoom level 3 from 2.5 to 3.4.
>>>>>>>>>>
>>>>>>>>>> Does anyone knows how to do that ?
>>>>>>>>>>
>>>>>>>>>> Thanks in advance
>>>>>>>>>> --
>>>>>>>>>> David REGADE
>>>>>>>>>> _______________________________________________
>>>>>>>>>> Users mailing list
>>>>>>>>>> Users at lists.osgeo.org
>>>>>>>>>> http://lists.osgeo.org/mailman/listinfo/openlayers-users
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>> _______________________________________________
>>>>>>>> Users mailing list
>>>>>>>> Users at lists.osgeo.org
>>>>>>>> http://lists.osgeo.org/mailman/listinfo/openlayers-users
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>
>>>
>>>
>>>
>> _______________________________________________
>> Users mailing list
>> Users at lists.osgeo.org
>> http://lists.osgeo.org/mailman/listinfo/openlayers-users
>
>
>


More information about the Users mailing list