You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Adding thoughts and pseudo code for accomplishing this.
We want to think of the map extent as its own object. So, our initial extent is going to be the continental US (CONUS). This can be derived using:
conus_bbox=states.geometry.total_bounds
But if we want this to update based on interactions made with the widgets?
Currently, if a state(s) is/are selected with state_selector, it updates both the display_states and display_points functions (in that order), which brings the extent of the map to the selected state(s) and clips the points returned by display_points to the same extents.
The streamgage_input is what is throwing a wrench into this as it filters what is returned by display_points but does nothing to filtering in display_states. It seems like a refactor is in order to accomplish this.
Rename display_map to display_basemap
defdisplay_basemap(map: str) ->gv.WMTS:
''' Display a basemap, based on the string input to select a base input to overlay beneath the state boundaries polygons object. Parameters: map(str): A string for a base map Defaults to `map_selector.value`. Returns: gv.WMTS: A Tile source type from the GeoViews library. '''basemap=base_map_options[map]
returnbasemap
Write new display_map
defdisplay_map(basemap: str, state_list: list[str], streamgauge_ids: str) ->gv.Overlay:
""" Docstrings """# move plot_opts dictionary to hereplot_opts= {......}
# create basemapbasemap=display_basemap(basemap)
# if streamguage_ids are entered, we can just return the basemap and points ifstreamgauge_ids:
# Use current logic from `if ids:` to create a gv.Points object# return (basemap * gv.Points object).opts(**plot_opts)# else `state_list` can be passed to `display_states`and `display_points`else:
# pass `state_list` to functions and create_objects# return (basemap * displayed_states * displayed_points).opts(**plot_opts)
If this doesn't snap to the geometries using framewise = True in the plot_opts then set the xlim and ylim programmatically using the Geodataframe.geometry.total_bounds for whichever geometry you need the bounds from.
Rewrite display_points function as only the clip is needed and none of the if/else statements.
Remove all of the displayed_** variables outside the context of display_map
Create displayed_map and use pn.rx to bind the three widgets to it
reference this is completing functionality initially proposed in work done on #476
The text was updated successfully, but these errors were encountered: