I’m using a dynamic map whose call back returns a gv.WMTS and a gv.Shape elements… when my callback runs changing the selected shape data, the map seems to get reprojected/skewed. I’m using framewise=True in the gv.Shape options, and I think this is the root of it. If I leave off framewise the map does not reposition to center around the gv.Shape but it does NOT skew it.
import holoviews as hv
import geoviews as gv
import panel as pn
from shapely.geometry import shape
pn.extension()
gv.extension('bokeh')
feature_collection = {
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"properties": {},
"geometry": {
"type": "Polygon",
"coordinates": [
...
}
selector_widget = pn.widgets.Select(options=[x for x in range(len(feature_collection['features']))])
@pn.depends(selector_widget)
def render_callback(value):
return gv.tile_sources.OSM() * gv.Shape(shape(feature_collection['features'][value]['geometry'])).options(framewise=True, fill_alpha=0)
pn.Column(
selector_widget,
hv.DynamicMap(render_callback).options(height=400, responsive=True),
sizing_mode="stretch_width"
)
Gist: https://gist.github.com/digitaltopo/bf9a124f9bdf79c9d605a9c52f74cb82
Binder example:
https://mybinder.org/v2/gist/digitaltopo/bf9a124f9bdf79c9d605a9c52f74cb82/master