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

lonboard map to_streamlit #594

Closed
jc9677 opened this issue Nov 8, 2023 · 6 comments
Closed

lonboard map to_streamlit #594

jc9677 opened this issue Nov 8, 2023 · 6 comments
Labels
Feature Request New feature or request

Comments

@jc9677
Copy link

jc9677 commented Nov 8, 2023

Leafmap is fantastic and it's great to see support for lonboard already. I'm not sure how easy or difficult it would be to add a to_streamlit method for lonboard maps, but this would be useful for me!

@jc9677 jc9677 added the Feature Request New feature or request label Nov 8, 2023
@giswqs
Copy link
Member

giswqs commented Nov 8, 2023

lonboard has the to_html() method. It should be straightforward to add a to_streamlit() method, similar to the folium method. I will add that when I have time. Contributions are welcome.

@giswqs
Copy link
Member

giswqs commented Nov 12, 2023

It appears the HTML generated by lonboard has something special. It does not work with the streamlit html component. See #600. I don't have a solution yet.

@giswqs
Copy link
Member

giswqs commented Nov 12, 2023

The same method works fine for folium maps.

@cboettig
Copy link

cboettig commented May 7, 2024

@giswqs do you have an example of this? in my testing I'm just getting a literal data item back,

image

import streamlit as st
import leafmap.deckgl as lonboard
st.set_page_config(page_title="Lonboard Test")
m = lonboard.Map(center=[35, -100], zoom=3)
m.to_streamlit()

@giswqs
Copy link
Member

giswqs commented May 7, 2024

I have not used lonboard recently. The lonbard might have changed. Let me know look into it.

@giswqs
Copy link
Member

giswqs commented May 7, 2024

This seems a lonboard problem. The to_streamlit() method does not have any special.

    def to_streamlit(
        self,
        width: Optional[int] = None,
        height: Optional[int] = 600,
        scrolling: Optional[bool] = False,
        **kwargs,
    ):

        try:
            import streamlit.components.v1 as components

            return components.html(
                self.to_html(), width=width, height=height, scrolling=scrolling
            )

        except Exception as e:
            raise e

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature Request New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants