Skip to content
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

Rasters not showing....again #233

Open
nve-sak opened this issue Dec 4, 2024 · 5 comments
Open

Rasters not showing....again #233

nve-sak opened this issue Dec 4, 2024 · 5 comments

Comments

@nve-sak
Copy link

nve-sak commented Dec 4, 2024

Hello,
Again I bring a discussion from LeafMap (opengeos/leafmap#1011) over here. I have a Shiny for Python app using LeafMap in which I cannot get rasters to show up. The app shows six maps side-by-side, each with a raster image as the only non-base layer. These images are to be replaced each time the user changes a date. They reside in local netCDF files, and are supplied to add_raster() as a leafmap.array_to_image(nparray).

I have read #158 and a number of similar issues; all seemingly solving a similar problem using jupyter-server-proxy and some LOCALTILESERVER_CLIENT_PREFIX='proxy/{port}' tricks. These don't seem to work for me, I am not in a jupyter notebook. I also lack the competence to understand why and how they are supposed to work, and hence ideas on how to proceed when they don't.

The app works as intended on Windows where I develop using VScode, but fail to show the maps when deployed to a ubuntu box. The Linux box have only Ubuntu server, so no window system, no VScode, and thus limited options for testing the app locally. Shiny-server dows not exist for Windows, so I have no way of testing the server-client mode there apart from the localhost debug server.

import localtileserver
print(localtileserver.Report())


Date: Wed Dec 04 09:10:44 2024 CET

            OS : Linux (Ubuntu 20.04)
        CPU(s) : 16
       Machine : x86_64
  Architecture : 64bit
           RAM : 94.3 GiB
   Environment : Python
   File system : ext4

Python 3.13.0 (main, Oct 8 2024, 08:51:27) [GCC 9.4.0]

localtileserver : 0.10.5
click : 8.1.7
flask : 3.1.0
flask_caching : 2.3.0
flask_cors : 5.0.0
flask_restx : 1.3.0
numpy : 2.1.3
rasterio : 1.4.3
rio_cogeo : 5.4.0
rio_tiler : 7.2.2
server_thread : 0.2.0
werkzeug : 3.1.3
folium : 0.18.0
ipyleaflet : 0.19.2
matplotlib : 3.9.3
traitlets : 5.14.3

The packages listed in requirements.txt are almost identical on the two platforms, see the #1011 issue mentioned above for details.

@giswqs
Copy link
Contributor

giswqs commented Dec 5, 2024

Open the network tab in the Chrome Developer console and see what the error messages are. The URL and port number are important ones.

@nve-sak
Copy link
Author

nve-sak commented Dec 5, 2024

I get 30 error-URLs from the six maps; all starting with http://l-klima-app06.nve.no:3838/proxy/43199/api/tiles/...and then the continuation varies.
3838 is the standard Shiny server port, i guess 43199 is the localtileserver port. One of the 30 error URLs is copied in at the bottom.

The app shows six maps, with three different value intervals which I recognise in vmin and vmax at the end of each URL.
All the basemaps show up OK, and the colormaps seem to come through OK.

Of the 30, six are without response, 24 return a 404.
In the payload, each of the 30 contain a file name of the pattern:
filename: /vsimem/3e4679be-9739-4468-a189-2260d59ff24e/3e4679be-9739-4468-a189-2260d59ff24e.tif
There are six different of these,

Selecting a new date and hence reloading new images return new errors, all 404, and all with the same port numbers (3838 and 43199). This gives six new file names, as expected. Zooming in and out also gives new error URLs, but the file names stay the same unless I change the dates. Again as expected.

http://l-klima-app06.nve.no:3838/proxy/43199/api/tiles/4/9/4.png?&filename=%2Fvsimem%2F20e09da4-cb74-4895-9469-08dd52733d14%2F20e09da4-cb74-4895-9469-08dd52733d14.tif&colormap=%5B%22%23e5e5e5%22%2C+%22%2328d460%22%2C+%22%23f8fc00%22%2C+%22%23f8c400%22%2C+%22%23f80000%22%5D&vmin=-2.0&vmax=8.0&nodata=nan

@ldemaz
Copy link

ldemaz commented Jan 12, 2025

Did you find a solution to this? I am experiencing more or less the same problem.

@nve-sak
Copy link
Author

nve-sak commented Jan 12, 2025

@ldemaz See ninsbl's answer here: opengeos/leafmap#1011. Still testing, but it appears doable, also in a docker container. Will report back when fully working.

@ldemaz
Copy link

ldemaz commented Jan 13, 2025

@nve-sak thanks very much! I will give it a try and see if it works in my situation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants