Population data sometimes comes as mesh-based data:

Cell location Population

POLYGON(0 0, 1 0, 1 1, 0 1)


POLYGON(1 0, 2 0, 2 1, 1 1)


For each cell of the mesh, we have:

  • The location

  • The total population for that location

One option to visualize this data is to use extruded shapes for each cell. The height and color of the extruded shape depend on the value of the Population property.

lls vectorpainting population density mesh

To achieve this visualization, you need:

//Create an ALspStyleTargetProvider which converts the 2D rectangle shape to an extruded shape
//The height of the extruded shape depends on the value of the population property
ALspStyleTargetProvider styleTargetProvider = new ALspStyleTargetProvider() {
  public void getStyleTargetsSFCT(Object aObject, TLspContext aContext, List<Object> aResultSFCT) {
    ILcdShape shape = ALcdShape.fromDomainObject(aObject);
    int population = (Integer) ((ILcdDataObject) aObject).getValue(populationProperty);
    TLcdExtrudedShape extrudedShape = new TLcdExtrudedShape(shape, 0, population);

//Create an ILspStyler which uses
// - The style target provider to ensure that extruded shapes are painted
// - A TLspParameterizedFillStyle to make the color of the extruded shape depend on the property
ILspStyler bodyStyler = new ALspStyler() {
  private final TLspParameterizedFillStyle fStyle =
                                .color(mixmap(toFloat(attribute(Integer.class, populationProperty)), densityColorMap))

  public void style(Collection<?> aObjects, ALspStyleCollector aStyleCollector, TLspContext aContext) {

//Install the styler on the layer
TLspLayer layer = TLspShapeLayerBuilder.newBuilder()
                                       .bodyStyler(TLspPaintState.REGULAR, bodyStyler)