Open kylebarron opened 1 year ago
The following worked for me:
import numpy
from lonboard import Map, SolidPolygonLayer
from mapclassify import JenksCaspall
layer = SolidPolygonLayer.from_geopandas(zones_interpolated, opacity=0.2)
jc = JenksCaspall(
zones_interpolated["ProductionAttractionSum Density"].fillna(0),
k=20
)
colors = []
for color in jc.yb:
colors.append(Viridis_20.colors[color])
layer.get_fill_color = numpy.uint8(colors)
Map(layers=[layer])
Thanks! By the way, I'm not sure where Viridis_20
comes from, but doing an array lookup would be much faster than a loop. You should probably be able to do something like
Viridis_20.colors[jc.yb]
From the geopandas.plot docstring