In [1]:
import geopandas
import topojson
topojson.__version__
Out[1]:
'1.0rc4'
In [2]:
data = geopandas.read_file(geopandas.datasets.get_path("naturalearth_lowres"))
data = data[(data.continent == "Africa")]
In [3]:
tj = topojson.Topology(data, prequantize=1e6, topology=True)
tj.toposimplify(1).topoquantize(1e5).to_alt()
Out[3]:
In [4]:
tj.to_widget()
Out[4]:
<function topojson.utils.toposimpquant(epsilon, quant, topo)>
In [5]:
# if above is not working, test the following
# if this not works, there is something with your ipywidgets installation
# and not with the to_widget() function
from ipywidgets import interact, fixed
import ipywidgets as widgets

def f(x):
    return x

interact(f, x=10)
Out[5]:
<function __main__.f(x)>
In [ ]: