On Jan 1, 2016, at 3:22 AM, Rutger Kassies <[email protected]> wrote:
Hi Brendan,
Thanks you very much for the example, that's very useful. Having near-zero experience with Javascript (I'm trying Bokeh for a reason ;)), i would never be able to come up with this myself. With the Bokeh 0.11.0dev8 release i got an import error, i think on importing 'figure'. I ignored that, and downgrading to dev7 made your gist work. I'm not sure how you intended to zooming to work, but for me it calculates the center and new extent not entirely as i would expect.
I cloned your gist and made a few simple edits, for me this zooms to the center of the 'current' extent, whereas yours drifted a bit (1/4th?) towards the edge. Here is my gist:
https://gist.github.com/RutgerK/7e6801767aa9ad50b212/397891f8ea2318ef3d65614be3c71d50012cc34d
This a great step towards what i had in mind. Zooming with 'double click' works, but dragging afterwards again introduces resampling because it changes to zoom a little. This could probably fixed also adding a similar callback for that case. I haven't looked into it yet.
Additionally the zooming might be a bit more intuitive by zooming to the mouse x/y instead of the window center. I made a first attempt, the modified gist is here:
Snapping Tile Renderer User Defined Model · GitHub
I'm not sure about the last gist, so be careful. It makes some assumptions about the origin of the projection for example, so i wouldn't be surprised if it fails for projections with a different origin then PseudoMercator. Unless the ".get_resolution()" call includes a sign with respect to the origin. Also, after a few times zooming in, it seems to skip increasing the zoom level at one step, zooming in further works again but it stays one level 'behind'.
Thanks again, and a bokehlicious 2016 to everyone!
Regards,
Rutger
On Thursday, December 31, 2015 at 4:27:05 AM UTC+1, bcol...@continuum.io wrote:
Hey Rutger,
Yes, makes complete sense. I myself have a use case for maintain the true resolutions of tiles. Shouldn't be a problem but will probably need to wait for next release for something formal. I think it would be nice to have smooth zoom with the wheel_zoom, and fixed resolution zoom with a double click or some other gesture.
One thing you can do for now is create a User Defined Model which extends TileRenderer. This would be a runtime extension of bokeh to include this functionality you desire. In this gist below, I demonstrate how to extend TileRenderer to do a fixed resolution zoom on double-click of the map. If you hold shift, then it will zoom out. This is NOT how it should be done long term, but may help for now. Note this is quick and dirty, but should work with the 0.11 release:
https://gist.github.com/brendancol/520ae46b6fa1b9279bd3
-Brendan
On Wednesday, December 23, 2015 at 9:21:11 AM UTC-6, Rutger Kassies wrote:
Hello,
Is it possible to use a tile_source and having the zoom/extent snap to certain steps so that the original tiles aren't re-sampled in anyway? For example when using the tile_source example at:
https://github.com/bokeh/bokeh/blob/master/examples/glyphs/tile_source.py
The example works great, and performance is really good. But when you zoom, you can set it at arbitrary levels, causing the tiles to be re-sampled to a something different than their native resolution. I realize this is often convenient, but being a bit of a pixel-peeper myself I'd rather avoid 'uncontrolled' re-sampling unless i specify it myself. I'm not always using online TMS sources, but sometimes also locally created tiles with something like 'gdal2tiles.py' to break up really large rasters, like satellite images or stitched photo's (panoramas etc). But i think the source of the tiles is irrelevant in this case.
I'm not sure where to implement this. I imagine the zoom-related tools trigger some callback which sets the figure extent, this might be the place to round the extent to a multiple of 256 (in pixel units) when using 256px tiles. But when looking at the models, i can see the classes defining the tools, but there is hardly any code. So whats the location where i should be looking to achieve something like this? I'm currently working on 0.11.0dev5.
Any help is appreciated.
Regards,
Rutger
--
You received this message because you are subscribed to the Google Groups "Bokeh Discussion - Public" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/411ed69f-37f5-48a6-a530-67f08dbf7708%40continuum.io\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.