Comments (12)
Would the following code be relevant?
https://github.com/giswqs/leafmap/blob/master/leafmap/leafmap.py#L1400
image = Image.open(url)
f = BytesIO()
image.save(f, ext)
data = data.decode("ascii")
url = "data:image/{};base64,".format(ext) + data
from localtileserver.
This looks promising as a way to proxy the local web server over to Jupyter on MyBinder: https://jupyter-server-proxy.readthedocs.io/en/latest/arbitrary-ports-hosts.html
from localtileserver.
FYI, #32 does provide a work around by using a remotely hosted instance
from localtileserver.
I'm not sure if this is something that can be addressed by localtileserver
... I've been meaning to outline this issue and see if there are ways around it.
In brief, localtileserver
works by launching a webserver on a local port (local to wherever Python is running). If you are running Jupyter(lab) in a remote environment, then its not going to be possible to access the port on which localtileserver
is running from the Jupyter front end without some hackery or magic. The ipywidgets comm models are what are supposed to be used in place of serving data over an arbitrary port like this.
The TileLayer
in ipyleaflet or folium both expect a slippy maps tile URL in the form https://.../z/x/y.png
. In order to make this all work in a remote Jupyter environment, we would have to create a whole new widget model on top of the ipywidgets.TileLayer
model and an underlying TileLayer
in LeafletJS itself to pull tiles not from a URL but from a memory object or something.
This would get very complicated really quickly... localtileserver
is a little hobby project of mine and I'm not sure if I will have the availability to add support for this
I'm going to ping @martinRenou here to see if:
- Would there be any interest from the
ipyleaflet
team to implement something like this? At least adding a TileLayer that can load tiles from an object in memory rather than a URL. - Do you have any further insight on how to approach this problem?
from localtileserver.
Otherwise, what you can do is have your tile server running on another remote server with a publically visible URL. This is exactly what my team and I have built in ResonantGeoData and is demonstrated in this PR: ResonantGeoData/ResonantGeoData#603
from localtileserver.
Thanks for the insight. It makes a lot of sense. This feature is just my wish-list. No worries if it can't be implmented.
Just curious, what kind of memory object could potentially make this work? Would the ipyleaflet LocalTileLayer be useful in this case? I would be happy to look into it if there is a path forward.
from localtileserver.
Ahhh, LocalTileLayer
is interesting... I was not aware of that and I'll look into seeing if I might actually be able to get this to work with LocalTileLayer
from localtileserver.
I don't think LocalTileLayer
would even work in a remote Jupyter(lab) environment as-is. It simpy sets the file path as the URL of the tile layer:
The client web browser would not be able to access that.
from localtileserver.
Just curious, what kind of memory object could potentially make this work?
We would have to make an ipywidget/comm that could pass the bytes of a PNG image. Then I'd have to refactor localtileserver
a bit to have a version that doesn't run on in a webserver but just has a get_tile(x, y, z)
mehtod that is called by the ipywidget model.
from localtileserver.
Yep, that's what we'd do, but we'd need ipyleaflet to be able to take each one of those as tiles in the TileLayer
from localtileserver.
Jupyter ServerProxy
seems interesting. I will look into it.
from localtileserver.
Thank you very much for implementing this.
from localtileserver.
Related Issues (20)
- Use localtileserver in a docker container HOT 1
- Error: NeededInitPrefix is not defined HOT 4
- add_raster() isn't adding the downloaded image into the map HOT 15
- add_layer doesn't work with GeoTIFF file converted from xarray Dataset HOT 11
- can't add local raster file in windows HOT 4
- Use ipyleaflet's as_leaflet_layer interface
- Cannot display raster in Google Colab HOT 5
- Generated PNG tiles are not transparent (have black background) HOT 3
- Remote COG no longer works HOT 4
- Tiff file saving to HTML using folium HOT 1
- Tileclient does not show when run dash app python on docker HOT 3
- localtileserver fails with flask==3 HOT 2
- localtileserver not working with Leafmap on Docker HOT 4
- localtileserver client cannot work after setting the http proxy HOT 4
- not working on VS code remote notebook HOT 1
- Passing rasterio.Env context to tile server HOT 5
- nodata causes padding HOT 15
- The vmin and vmax parameters have no effect HOT 2
- Support custom colormaps
- Generate thumbnails in a projection
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from localtileserver.