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

Map Component #428

Open
ay1man4 opened this issue Jun 13, 2024 · 9 comments
Open

Map Component #428

ay1man4 opened this issue Jun 13, 2024 · 9 comments
Labels
feature request New feature / API

Comments

@ay1man4
Copy link

ay1man4 commented Jun 13, 2024

In other frameworks like streamlit, there is support for map component.
Streamlit Map

Also, comunity contribute with map compnents like Folium:
Streamlit 3rd party Maps

  • Folium
  • Keplergl
  • Mapbox
  • Raster
  • Leaflet
  • Plotly
  • Globe

Could you add map component with event handlers to give more interactivity.

@ay1man4 ay1man4 added the feature request New feature / API label Jun 13, 2024
@wwwillchen
Copy link
Collaborator

Thanks for the feature request @ay1man4. We're working on #95 which should support these libraries and open up these use cases.

I'm not super familiar with the map ecosystem - is there 1 or 2 libraries that are most used in the community?

@ay1man4
Copy link
Author

ay1man4 commented Jun 14, 2024

Thank you @wwwillchen for feedback.
The most used js libraries for mapping in my opinion are Leaflet and plotly.

The prefect implementation that provide below main features which already supported in js library:

  • Input data like Points, GeoJson, GeoPandas, vector, image layer
  • Map styling
  • Add markers, vector layers (polygon, polyline, circle, etc.)
  • Drawing on the map
  • Callback handlers to map events (click, hover, etc. on map layers)

@wwwillchen
Copy link
Collaborator

Mesop now supports web components so you should be able to wrap these JS libraries in Mesop now. Please let me know if you run into any issues - thanks.

@lianggecm
Copy link

I'm working to wrap the Markmap library into a custom web component but experienced 'TypeError'. Got error message as:
TypeError: Failed to set the 'innerHTML' property on 'Element': This document requires 'TrustedHTML' assignment

The corresponding code:
e.innerHTML = t[r].__html;
How can this be addressed? Thanks a lot.

@wwwillchen
Copy link
Collaborator

Looks like you'll need to turn off trusted types to use the Markmap library:

@me.page(
  path="/",
  security_policy=me.SecurityPolicy(dangerously_disable_trusted_types=True),
)

See example:

security_policy=me.SecurityPolicy(dangerously_disable_trusted_types=True),

@lianggecm
Copy link

That works.

@wwwillchen
Copy link
Collaborator

@lianggecm awesome! Also, if you've a working example, feel free to contribute it to our repo web components examples or you can share your repo and we can provide a link to your repo somewhere on our docs page (e.g. a web components gallery). Thanks!

@lianggecm
Copy link

For the time being I'll put what I have here. I've also created a colab demo. Will contribute to the repo later.

@wwwillchen
Copy link
Collaborator

Neat, thanks for sharing!

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

No branches or pull requests

3 participants