-
Notifications
You must be signed in to change notification settings - Fork 43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add ipyleaflet representation #1065
Conversation
I like where this is heading. I'm vacillating on where some of this code should be located -- I half feel it should be in an "IPyLeafletMixin" class that would be added to the TileSource class so that it can live in a separate file. |
large_image/tilesource/jupyter.py
Outdated
proj = dict( | ||
name='PixelSpace', | ||
custom=True, | ||
# Why does this need to be 256? | ||
resolutions=[256 * 2 ** (-l) for l in range(20)], | ||
|
||
# This works but has x and y reversed | ||
proj4def='+proj=longlat +axis=esu', | ||
bounds=[[0, 0], [metadata['sizeY'], metadata['sizeX']]], | ||
origin=[0, 0], | ||
|
||
# This almost works to fix the x, y reversal, but | ||
# - bounds are weird and other issues occur | ||
# proj4def='+proj=longlat +axis=seu', | ||
# bounds=[[-metadata['sizeX'],-metadata['sizeY']],[metadata['sizeX'],metadata['sizeY']]], | ||
# origin=[0,0], | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@manthey, I copied this from https://gist.github.com/manthey/a66f69ae84dc59bbd54c2fbbb1c8844f and I'm not seeing the XY reversal issues mentioned in your comments (or am I??). I think this projection generally works, though we could probably improve it to address the following issues I do see (for non-geospatial):
- Map is centered on top-left corner of image
- Bounds of map do not match bounds of image
- Some zoom levels yield "edge"/"border" tiles ... not sure how best to describe these, but I can provide screenshots where black tiles outside the bounds of the image are generated/shown
- Zoom level 0 does not show the full image in the frame
- Max zoom level is not working
CI is passing tests but codecov client is failing. @manthey, this is ready for another review |
@zachmullen and I are experiencing issues where the tornado endpoints here are breaking Classic Notebook, but this works fin in JupyterLab |
@manthey, this is ready for review. There are some quirks and known issues, but I think this is at a point where it is highly valuable/useful.
|
Let's merge this and refine it in future PRs. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's make an issue to revisit the coordinate system of non-geospatial data.
A first pass at adding an
_ipython_display_
repr to visualize a tile source in Jupyter dynamicallyresolves #1059
I'm having a bit of trouble getting this to work consistently for non-geospatial tile sources
This adds a new
rest.py
module which is leveraged to launch a minimal tile server for aTileSource
using a tornado web server (the same web server Jupyter uses, thus requiring no extra dependencies).The
TileLayer
creation is abstracted ingetIpyleafletTileLayer()
so that users can build the tile layer more easily and/or create custom maps.Potential remaining tasks