code: public static void insertBeforeCompass( WorldWindow wwd, Layer layer ) {
          // Insert the layer into the layer list just before the compass.
          int compassPosition = 0;
          LayerList layers = wwd.getModel().getLayers();
          for( Layer l : layers ) {
              if (l instanceof CompassLayer)
                  compassPosition = layers.indexOf(l);
          }
          layers.add(compassPosition, layer);
      }
docs: Insert a layer before the compass layer.
  
  @param wwd the {@link WorldWindow}.
  @param layer the layer to insert.