GithubHelp home page GithubHelp logo

Comments (7)

12rambau avatar 12rambau commented on July 28, 2024 1

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

Capture d’écran 2022-07-24 aΜ€ 19 11 39

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.

banesullivan avatar banesullivan commented on July 28, 2024

@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:

class BoundTileLayer(TileLayer):
# https://github.com/jupyter-widgets/ipyleaflet/issues/888
# https://github.com/ipython/traitlets/issues/626#issuecomment-699957829
bounds = Union((Tuple(),), default_value=None, allow_none=True).tag(sync=True, o=True)

from localtileserver.

12rambau avatar 12rambau commented on July 28, 2024

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.

giswqs avatar giswqs commented on July 28, 2024

@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.

12rambau avatar 12rambau commented on July 28, 2024

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.

banesullivan avatar banesullivan commented on July 28, 2024

@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.

12rambau avatar 12rambau commented on July 28, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.