-
Beta Was this translation helpful? Give feedback.
Answered by
giswqs
Aug 30, 2023
Replies: 1 comment 4 replies
-
To hide the toolbar m = leafmap.Map(toolbar_control=False) To allow users to download a file from the server: def create_download_link(filename, title="Click here to download: "):
"""Downloads a file from voila. Adopted from https://github.com/voila-dashboards/voila/issues/578
Args:
filename (str): The file path to the file to download
title (str, optional): str. Defaults to "Click here to download: ".
Returns:
str: HTML download URL.
"""
import base64
from IPython.display import HTML
data = open(filename, "rb").read()
b64 = base64.b64encode(data)
payload = b64.decode()
basename = os.path.basename(filename)
html = '<a download="{filename}" href="data:text/csv;base64,{payload}" style="color:#0000FF;" target="_blank">{title}</a>'
html = html.format(payload=payload, title=title + f" {basename}", filename=basename)
return HTML(html) |
Beta Was this translation helpful? Give feedback.
4 replies
Answer selected by
giswqs
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
To hide the toolbar
To allow users to download a file from the server: