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

Explorer: disable the geo controls when geoviews is not installed #1223

Merged
merged 4 commits into from
Dec 21, 2023

Conversation

maximlt
Copy link
Member

@maximlt maximlt commented Dec 21, 2023

Addressing (a tiny) part of #1190 with a different take compared to #1200 whose goal is to cover all kind of exceptions the explorer might raise, while in this PR I focused on finding the best way to let them know they should install GeoViews to enable the geo controls.

I ended up trying to import geoviews on initialization and if that fails disabling all the geo controls:

image

The Checkbox widget has no tooltip so instead I used a Toggle with a label that is updated to indicate GeoViews is required.
Trying to instantiate an explorer by passing geo kwargs (e.g. df.explorer(geo=True)) will raise an import error.

Copy link
Collaborator

@ahuang11 ahuang11 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me! The only thing is tiles doesn't seem to work without geographic projections, but I think that's a separate issue.

e.g. need to call: lon_lat_to_easting_northing

import holoviews as hv

hv.extension("bokeh")

hv.element.tiles.EsriImagery() * hv.Points(
    hv.util.transform.lon_lat_to_easting_northing(-88, 40)
)

@maximlt
Copy link
Member Author

maximlt commented Dec 21, 2023

@ahuang11 Isn't it that you need to provide a dataset that has coordinates already projected to easting/northing to use tiles? Not all geo datasets are in lat/lon so I'm not sure the explorer should perform the conversion by default.

@maximlt maximlt merged commit 8135f34 into main Dec 21, 2023
8 checks passed
@maximlt maximlt deleted the explorer_disable_geo_no_gv branch December 21, 2023 20:54
@ahuang11
Copy link
Collaborator

ahuang11 commented Dec 21, 2023

Maybe an extra toggle in the future that allows conversion to easting northing? Or at the very least, a tooltip that elaborates on that so new users aren't confused.

@maximlt
Copy link
Member Author

maximlt commented Dec 21, 2023

Yes I think that'd make sense.

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

Successfully merging this pull request may close these issues.

2 participants