Adding a grid layer to the view

Grid layers do not contain actual data. Their main purpose is to provide a visual, usually uniform reference that makes it easier to locate data. LuciadLightspeed allows you to add such grid layers to your GXY view.

Choosing a predefined grid layer

LuciadLightspeed contains a number of grid layer implementations:

  • TLcdMapLonLatGridLayer: the most commonly used grid. The longitude-latitude grid is formed by evenly spaced meridians and parallels. It allows locating geographically referenced data immediately.

  • TLcdMapLonLatGridLayer with TLcdLonLatBorderGridPainter: a maritime-style grid that shows a border around the view with major and minor ticks.

  • TLcdMGRSGridLayer: based on the MGRS coordinate system, this grid divides the world in 60 longitudinal zones, six degrees wide, along meridians and 20 latitudinal bands, 8 degrees tall, along parallels. It also divides each circular polar zone in half by the Prime Meridian (0 degrees Longitude) and 180 degrees Longitude (East or West). The grid is further divided into blocks of 100km by 100km, blocks of 10km by 10km, up to blocks of 1m by 1m. Contrary to the longitude-latitude grid, a block in this grid always covers the same size area, independent of its location on earth. The representation of a location with regard to this grid is however more complex.

  • TLcdMapGeorefGridLayer: the World Geographic Reference System (GEOREF) divides the earth into 12 bands of latitude and 24 zones of longitude, each 15 degrees in extent. These areas are further divided into one degree units identified by 15 characters.

  • TLcdXYGridLayer: a Cartesian (XY) grid. It is typically defined in the world reference of the view, which results in an axis-aligned grid.

Using multi-level grids

The package contains classes to define, render, and perform computations on a uniform, axis-aligned, multi-level grid. The grid depends on the underlying reference system and enables to locate areas using multilevel coordinates.

An ILcdMultilevelGrid is defined by:

  • The location of its extreme points

  • The number of levels it consists of

  • The number of subdivisions per level and per axis

An area of an ILcdMultilevelGrid is designated by an ILcdMultilevelGridCoordinate.

Figure 1. Sample setup of a multilevel grid

Figure 1, “Sample setup of a multilevel grid” demonstrates the setup of a multilevel grid which is defined by the following parameters:

  • The number of levels is 3

  • The subdivisions for level 0: 5 along the first axis, 4 along the second axis

  • The subdivisions for level 1: 2 along each axis

  • The subdivisions for level 2: 2 along the first axis, 3 along the second axis

You can derive the multilevel grid coordinates for the areas A, B, and C from the figure. Note that B denotes a smaller area than A, as you can see from its more specific coordinates. Also from the coordinates, you can see that for example (4,0)(x,y) lies inside (4,0), for any value of (x,y). TLcdMultilevelGridCoordinateModel is an ILcdModel implementation for ILcdMultilevelGridCoordinate objects that use this type of setup.

The samples in the packages samples.gxy.grid.multilevel.cgrs and samples.gxy.grid.multilevel.gars contain two examples of a multilevel grid: the Common Grid Reference System (CGRS) grid and the Global Area Reference System (GARS) grid. Both of these grids are based on geodetic references and differ only by the area they cover and the order of subdivisions.