When you are working with a georeferenced view and data, it is often convenient to display a grid for quick orientation. You can add this grid to the view as a layer, using a layer builder.

Program: Creating a grid layer shows how to add a grid layer to a view.

Program: Creating a grid layer
view.addLayer(TLspLonLatGridLayerBuilder.newBuilder().build());

LuciadLightspeed offers the following grid layer builders:

  • TLspLonLatGridLayerBuilder creates a latitude-longitude grid formed by evenly spaced meridians and parallels. It allows locating geographically referenced data immediately. This grid is used in all of the Lightspeed view samples that are shipped with LuciadLightspeed. If necessary, you can change the style of the grid lines and labels using the ILspStyler implementation for lon-lat grids, TLspLonLatGridStyler. You can also configure the spacing between the grid lines. Consult the Javadoc TLspLonLatGridLayerBuilder for more information about how to do this.

  • TLspMGRSGridLayerBuilder creates an MGRS grid. It divides the earth into grid zones that are refined depending on the view scale. As opposed to a longitude-latitude grid block, a block in an MGRS grid always covers the same size area, independent of its location on earth. If necessary, you can change what grid lines and labels are displayed and how they are visualized, by configuring a TLspMGRSGridStyle object on the layer builder. The MGRS grid is demonstrated in the grid sample.

  • TLspGeorefGridLayerBuilder creates a Georef grid. It is similar to the latitude-longitude grid, but uses a simpler and more concise notation. If necessary, you can change what grid lines and labels are displayed and how they are visualized, by configuring a TLspGeorefGridStyle object on the layer builder. The Georef grid is demonstrated in the grid sample.

  • TLspXYGridLayerBuilder creates a Cartesian grid. It is typically defined in the world reference of the view, which results in an axis-aligned grid.