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

How can style parameters be changed dynamically? #11

Open
cardinalgeo opened this issue Mar 11, 2023 · 5 comments
Open

How can style parameters be changed dynamically? #11

cardinalgeo opened this issue Mar 11, 2023 · 5 comments

Comments

@cardinalgeo
Copy link
Contributor

cardinalgeo commented Mar 11, 2023

Hi all,

With django-large-image, styling can be changed dynamically using the request url (e.g., http://localhost:8000/api/image-file/${imageId}/data/thumbnail.png?band=3&palette=viridis&min=50&max=250, given in the example here). Is there a similar way to update styling with trame-leaflet (e.g., with a dropdown)? I've tried adding parameters to the url (e.g., "/tile/{z}/{x}/{y}.png?palette=twilight_shifted") but without success.

Also, am I comparing apples to oranges? Should this question instead be posted in large-image?

Thanks!

@cardinalgeo
Copy link
Contributor Author

cardinalgeo commented Mar 12, 2023

Another thought is that, as django-large-image is built on large-image, which I'm already using with trame-leaflet, the former could be used to serve tiles instead?

@cardinalgeo
Copy link
Contributor Author

cardinalgeo commented Mar 13, 2023

Alternatively, might this be accomplished in large-image by setting up a custom "style function" that is applied upon serving the tile (e.g., here)?

@cardinalgeo
Copy link
Contributor Author

Update: @banesullivan had some good suggestions on this topic. Once I implement them, I'll update everyone here and close the issue!

@banesullivan
Copy link

@cardinalgeo, definitely update this after our discussion on this topic.

Some takeaways though:

  • This is an issue better suited for large-image than this repository as its about tile serving and building endpoints to serve those tiles with different styles
  • Use large-image's style API: https://girder.github.io/large_image/tilesource_options.html#style
  • When creating a tile serving endpoint like demo'd in this example, the browser will cache the tile endpoints response, so changing the style server-side may not reflect on the browser. You need to invalidate the tile URL -- IMO, the best way is to just pass the style in the URL parameters
  • I hope to one day make a trame-large-image package to make all of this simpler with trame

@cardinalgeo
Copy link
Contributor Author

Thanks for the comments @banesullivan — will take them into account when posting my solution :)

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

2 participants