Skip to content

How to save html with data embeded? #475

Answered by zxdawn
zxdawn asked this question in Q&A
Discussion options

You must be logged in to vote

Find out the solution based on this notebook. We can add it using folium.raster_layers.ImageOverlay:

import folium
import leafmap.foliumap as leafmap
import xarray as xr

dem_url = ('https://drive.google.com/file/d/1vRkAWQYsLWCi6vcTMk8vLxoXMFbdMFn8/view?usp=sharing')
leafmap.download_file(dem_url, 'dem.tif', unzip=False)

data = xr.open_dataset('dem.tif')['band_data'].isel(band=0)
lon = data.x.to_numpy()
lat = data.y.to_numpy()

m = leafmap.Map(location=[lat.mean(), lon.mean()])

folium.raster_layers.ImageOverlay(data.to_numpy(),
                     [[lat.min(), lon.min()], [lat.max(), lon.max()]],
                     opacity=0.7,
                     name='test').add_to(m)
folium.Layer…

Replies: 3 comments 6 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@zxdawn
Comment options

Comment options

You must be logged in to vote
5 replies
@zxdawn
Comment options

@giswqs
Comment options

@zxdawn
Comment options

@giswqs
Comment options

@zxdawn
Comment options

Answer selected by giswqs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants