Comments (7)
thanks a lot for your help @banesullivan I think I finally managed to find the server prefix needed to make it work. I simply use the one found in os.environ["SUDO_COMMAND"]
:
import os
os.environ["LOCALTILESERVER_CLIENT_PREFIX"] = "/api/sandbox/jupyter/proxy/{port}"
from localtileserver import get_folium_tile_layer, examples
from folium import Map
client = examples.get_landsat(client_host="sepal.io", debug=False)
style = {
'bands': [
{'band': 5, 'palette': '#f00'},
{'band': 3, 'palette': '#0f0'},
{'band': 2, 'palette': '#00f'},
]
}
l = get_folium_tile_layer(client, style=style)
m = Map(location=client.center(), zoom_start=client.default_zoom)
m.add_child(l)
m
I'll close this one when I'll manage the full integration in our lib but that's a big step forward. I'll keep an eye on #101 as it sounds very promising.
from localtileserver.
@12rambau, thanks for giving localtileserver a try and working hard to understand exactly what's going awry here - I understand this is probably a bit frustrating and I'd like to help get this working for you.
Overall, it seems you have set it up to work in a remote Jupyter environment as you are getting 200 statuses on your tiles. The confusing thing is that you are seeing fully transparent tiles - a transparent tile is generated when tiles are requested outside the bounds of the raster. A few things could go wrong here....
As a first check, could you make sure this behaves the same with folium
as well: https://python-visualization.github.io/folium/
from localtileserver import get_folium_tile_layer, examples
from folium import Map
client = examples.get_landsat(client_host="sepal.io", debug=True)
style = {
'bands': [
{'band': 5, 'palette': '#f00'},
{'band': 3, 'palette': '#0f0'},
{'band': 2, 'palette': '#00f'},
]
}
l = get_folium_tile_layer(client, style=style, )#name="toto")
m = Map(location=client.center(), zoom_start=client.default_zoom)
m.add_child(l)
m
This will rule out any issues with the ipyleafelt BoundTileLayer
that I provide in localtileserver:
localtileserver/localtileserver/widgets.py
Lines 100 to 103 in 6963b6b
from localtileserver.
Thank you for your prompt answer. Until now I was using xarray_leaflet but recently geemap from @giswqs started using your lib for the same operation.
So I think I went a bit to fast looking at the payload. The images are not transparent, they are white in the preview (but as I'm not seeing them in the maps I assumed they were transparent). I unzoom to the maximum to check it wasn't a projection issue but they are nowere.
I tried the Folium implementation and the result is slightly different. There I get a 301 error.
from localtileserver.
@12rambau xarray-leaflet is no longer being actively developed and it never works on Windows, so I decided to switch to locatileserver. If you want to stick with xarray-leaflet, you can still use the add_raster_legacy()
function.
https://geemap.org/geemap/#geemap.geemap.Map.add_raster_legacy
from localtileserver.
I'm only running things on a linux environment so that was not an issue (I have a pending issue for way to long on xarray_leaflet as well π ). I saw the add_raster_legacy
in the latest release (which is super convenient) but I would prefer to follow-up with new cool thing like this for my own mapping sytem.
from localtileserver.
@12rambau, were you able to resolve this issue? I'd be happy to help you debug this if you're still having trouble
from localtileserver.
nope I'm still a bit lost. Didn't have any idea but if you want me to check other stuff I'll be happy to give it a try
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.