The majority of formats require the same two steps for visualization on a Lightspeed view. To visualize ASTERIX data:

  1. Decode the data into an ILcdModel using an ILcdModelDecoder.

  2. Create an ILspLayer for the ILcdModel and add it to the ILspView.

//First create the model
ILcdModelDecoder decoder =
    new TLcdCompositeModelDecoder(TLcdServiceLoader.getInstance(ILcdModelDecoder.class));
ILcdModel model = decoder.decode("Data/ASTERIX/atx_cat21.astfin");

//Create a layer for the model
ILspLayer layer = createAsterixLayer(model);

//Add the layer to the Lightspeed view (an ILspView)

The ASTERIX model decoder returns a model container with sub-models for the different categories. The layer creation must deal with all types of categories.

 * The ASTERIX model decoder returns an ILcdModelContainer with sub-models.
 * Each of the sub-models potentially contains different data, so this code
 * needs to be able to deal with all types of ASTERIX data
static ILspLayer createAsterixLayer(ILcdModel model) {
  //The model container itself does not contain any data,
  //so we create an empty layer node for it
  if (model instanceof ILcdModelContainer) {
    TLspLayerTreeNode node = new TLspLayerTreeNode(model);
    for (int i = 0; i < ((ILcdModelContainer) model).modelCount(); i++) {
      ILcdModel childModel = ((ILcdModelContainer) model).getModel(i);
      //Use recursion to create layers for the child models
    return node;
  } else if (model.getModelDescriptor() instanceof TLcdASTERIXRadarVideoModelDescriptor) {
    //Use the radar layer builder to create the layer
    return TLspRadarVideoLayerBuilder.newBuilder()
  } else if (model.getModelDescriptor() instanceof TLcdASTERIXWeatherModelDescriptor) {
    return createWeatherLayer(model);
  } else if (model.getModelDescriptor() instanceof TLcdASTERIXPlotModelDescriptor ||
             model.getModelDescriptor() instanceof TLcdASTERIXTrajectoryModelDescriptor ||
             model.getModelDescriptor() instanceof TLcdASTERIXTrackModelDescriptor) {
    return TLspShapeLayerBuilder.newBuilder()
  throw new IllegalArgumentException("Cannot create layer for model " + model);

private static ILspLayer createWeatherLayer(ILcdModel model) {
  ILspStyler weatherStyler = new ALspStyler() {

    private final List<TLspLineStyle> fLineStyles = Arrays.asList(
        TLspLineStyle.newBuilder().color(new Color(231, 232, 255)).build(),
        TLspLineStyle.newBuilder().color(new Color(157, 162, 255)).build(),
        TLspLineStyle.newBuilder().color(new Color(0, 9, 120)).build(),
        TLspLineStyle.newBuilder().color(new Color(255, 112, 112)).build(),
        TLspLineStyle.newBuilder().color(new Color(255, 51, 51)).build(),
        TLspLineStyle.newBuilder().color(new Color(190, 0, 0)).build(),
        TLspLineStyle.newBuilder().color(new Color(216, 0, 202)).build()

    public void style(Collection<?> aObjects, ALspStyleCollector aStyleCollector, TLspContext aContext) {
      for (Object object : aObjects) {
        //Customize the color based on the intensity of the precipitation of the weather data
        int intensity = ((TLcdASTERIXPrecipitationZone) object).getIntensity();

        //Intensity level 0 signifies no precipitation, so we will only paint levels 1 through 7.
        if (intensity == 0) {
        aStyleCollector.object(object).style(fLineStyles.get(intensity - 1)).submit();

  return TLspShapeLayerBuilder.newBuilder()
                              .bodyStyler(TLspPaintState.REGULAR, weatherStyler)

This results in a ASTERIX layer with default styling. See Visualizing Vector Data for more information about visualizing and styling vector data.

This code snippet uses the TLcdCompositeModelDecoder, initialized with all model decoders available in the service registry.

The model decoder class that is actually responsible for decoding ASTERIX data is the TLcdASTERIXModelDecoder.