-
-
Notifications
You must be signed in to change notification settings - Fork 193
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* pixelated images when needed * black formatted
- Loading branch information
1 parent
fe7e663
commit 2965af6
Showing
4 changed files
with
81 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -77,5 +77,5 @@ package-lock.json | |
.envrc | ||
|
||
.streamlit/ | ||
|
||
.venv/ | ||
test-results.xml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import folium | ||
import streamlit as st | ||
|
||
from streamlit_folium import st_folium | ||
|
||
st.set_page_config( | ||
layout="wide", | ||
page_title="streamlit-folium documentation: Misc Examples", | ||
page_icon="random", | ||
) | ||
""" | ||
# streamlit-folium: Image Overlay | ||
By default, st_folium renders images using browser image rendering mechanism. | ||
Use st_folium(map, pixelated=True) in order to see image pixels without resample. | ||
""" | ||
|
||
url_image = "https://i.postimg.cc/kG2FSxSR/image.png" | ||
image_bounds = [[-20.664910, -46.538223], [-20.660001, -46.532977]] | ||
|
||
m = folium.Map() | ||
m1 = folium.Map() | ||
|
||
folium.raster_layers.ImageOverlay( | ||
image=url_image, | ||
name="image overlay", | ||
opacity=1, | ||
bounds=image_bounds, | ||
).add_to(m) | ||
folium.raster_layers.ImageOverlay( | ||
image=url_image, | ||
name="image overlay", | ||
opacity=1, | ||
bounds=image_bounds, | ||
).add_to(m1) | ||
|
||
m.fit_bounds(image_bounds, padding=(0, 0)) | ||
m1.fit_bounds(image_bounds, padding=(0, 0)) | ||
|
||
col1, col2 = st.columns(2) | ||
with col1: | ||
st.markdown("## Pixelated off") | ||
st_folium(m, use_container_width=True, pixelated=False, key="pixelated_off") | ||
with col2: | ||
st.markdown("## Pixelated on") | ||
st_folium(m1, use_container_width=True, pixelated=True, key="pixelated_on") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters