-
Notifications
You must be signed in to change notification settings - Fork 140
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
linking solara.Button() callback function to method of geemap.Map() instance #718
Comments
You can do it with just ipywidgets. See this example: https://github.com/opengeos/surface-water-app |
Hey @gregorhd! @giswqs proposes a very good solution, where you can work completely within the widget paradigm. How to do this in Solara is a very good question; in the solara documentation page concerning ipywidgets libraries, as I think you noticed, we say
So unfortunately I have to say doing this using the widget methods is not possible1. How I would approach the problem you proposed (centering the map on different points) in Solara would be by using the active_point_index = solara.reactive(0)
def Page():
with solara.Column():
with solara.Columns([0,0,1]):
...
Map.element(center=points[active_point_index.value]) And use the buttons to set Footnotes
|
Thank you both for the helpful feedback. I did end up going back to vanilla ipywidgets, as part of the @iisakkirotko I'll give the approach hinted at in your footnote a longer look as well, though it might be beyond me. Nevertheless, the two projects really gel well together otherwise. Keep up the good work! |
Hi there,
I'm trying to write a simple solara + geemap app where two
solara.Button()
elements, embedded in a separate row of asolara.Column()
, cause the map, embedded in the row below the buttons, to be centered on two different coordinates when pressed.The UI elements all show up, and the
print()
calls are shown in the terminal, but the map doesn't center on the respectively other point.I'm testing this locally, but this will be running on a HuggingFace Docker image, similar to this example. Locally, I can get this to work with vanilla ipywidgets without solara but those don't seem to work when deployed on HF in combination with solara (or I'm not sure how to display an
ipywidgets.widgets.VBox()
as an element in thePage()
function.Something must be wrong in how I'm instantiating the
Map.element()
object or that it's maybe not quite the same as aMap()
object as hinted at here.Any hints would be much appreciated.
The text was updated successfully, but these errors were encountered: