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

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

  2. Create an ILcdGXYLayer for the ILcdModel and add it to the ILcdGXYView.

//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
ILcdGXYLayer layer = createGXYAsterixLayer(model);
//Wrap the layer with an async layer wrapper to ensure
//that the view remains responsive while data is being painted
layer = ILcdGXYAsynchronousLayerWrapper.create(layer);

//Add the async layer to the GXY view (an ILcdGXYView)

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 ILcdGXYLayer createGXYAsterixLayer(ILcdModel model) {
  //The model container itself does not contain any data,
  //so we create an empty layer node for it
  if (model instanceof ILcdModelContainer) {
    TLcdGXYLayerTreeNode node = new TLcdGXYLayerTreeNode(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) {
    throw new RuntimeException("Radar data is only supported on a Lightspeed view, not on a GXY view");
  } else if (model.getModelDescriptor() instanceof TLcdASTERIXWeatherModelDescriptor) {
    return createGXYWeatherLayer(model);
  } else if (model.getModelDescriptor() instanceof TLcdASTERIXPlotModelDescriptor ||
             model.getModelDescriptor() instanceof TLcdASTERIXTrajectoryModelDescriptor ||
             model.getModelDescriptor() instanceof TLcdASTERIXTrackModelDescriptor) {
    return TLcdGXYLayer.create(model);
  throw new IllegalArgumentException("Cannot create layer for model " + model);

private static ILcdGXYLayer createGXYWeatherLayer(ILcdModel model) {
  TLcdGXYLayer layer = TLcdGXYLayer.create(model);

  //Use custom styling, more suited for weather data
  TLcdGXYShapePainter painter = new TLcdGXYShapePainter() {
    public ILcdGXYPainter getGXYPainter(Object aObject) {
      //Customize the color based on the intensity of the precipitation of the weather data
      int intensity = ((TLcdASTERIXPrecipitationZone) aObject).getIntensity();

      //Intensity level 0 signifies no precipitation, so we will only paint levels 1 through 7.
      if (intensity == 0) {
        return null;
      Color color;
      if (intensity == 1) {
        color = new Color(231, 232, 255);
      } else if (intensity == 2) {
        color = new Color(157, 162, 255);
      } else if (intensity == 3) {
        color = new Color(0, 9, 120);
      } else if (intensity == 4) {
        color = new Color(255, 112, 112);
      } else if (intensity == 5) {
        color = new Color(255, 51, 51);
      } else if (intensity == 6) {
        color = new Color(190, 0, 0);
      } else {
        color = new Color(216, 0, 202);
      setLineStyle(new TLcdG2DLineStyle(color, 1,, 1));
      return this;
  return layer;

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.