Converting coordinates between coordinate systems

Once coordinate systems are defined, there must be some way to convert from one coordinate system to another. This is done using coordinate transformations, defined in the package ilog.views.maps.srs.coordtrans.

Overview of the coordinate transformations

As soon as you work with different coordinate systems and datums, you need to be able to convert from one to another. When working with coordinate systems, this can be performed using functions.
The coordinate transformations, as defined by the ilog.views.maps.srs.coordtrans. IlvCoordinateTransformation class, contain the information that allows you to manipulate them:
  • The source coordinate system
  • The target coordinate system
  • The Math Transform to convert coordinates from one to another
In addition to that, all the coordinate transformations implement the following methods:
  • IlvCoordinate transform
    This method is the basic one. It transforms the source coordinate, storing the result in result , or in a newly allocated coordinate if result is null . The method returns the transformed point.
  • IlvCoordinate[] transform
    This is the vectorized version of the previous method. This allows the transformations to convert a whole batch of coordinates, possibly allowing some optimizations to be performed.
  • Optionally, transformations can implement the getInverse method that returns an inverse transformation.
The following sections describe the predefined built in transformations of JViews Maps, and provide some examples of the transformation package.

Transformation paths

To transform the coordinates from one coordinate system to another, mathematical functions are needed. These mathematical functions can be either simple straight forward functions, or more complicated transformations. The JViews Maps package includes the most elementary transformations (or transformation steps) used for coordinate conversions, and these are available in the ilog.views.maps.srs.coordtrans package.
The chaining of elementary transformations from one coordinate system to another is called a transformation path.
The static method CreateTransformation from the class IlvCoordinateTransformation can automatically create transformation paths from coordinate systems of the ilog.views.maps.srs.coordsys package. To find the transformation paths created, refer to the following figure:
CT_path.gif
Transformation paths

Example

Convert from the following projected coordinate system:
  • Projection: Lambert Azimuthal Conformal Conic
  • Datum: NTF (Nouvelle Triangulation de la France)
  • Associated geographic coordinate system based on Clark 1880 ellipsoid, IGN modified.
to the following one:
  • Projection: Mercator
  • Datum: European 1960
  • Associated geographic coordinate system: International.
The transformation path selected by CreateTransformation() will be:
  1. Projection transformation from Lambert to geographic NTF/Clark1880
  2. Molodensky conversion from NTF/Clark1880 to European 1960/International systems
  3. Projection transformation from geographic European 1960/International to Mercator.
At each step, the relevant unit conversion is added by using the affine transforms.
Note that this path is not the only existing path. It is also possible to convert from geographic coordinates to geocentric coordinates, in which case the transformation path would be:
  1. Projection transformation from Lambert to geographic NTF/Clark1880
  2. Geocentric transform to geocentric NTF coordinates
  3. Affine transform to convert from NTF to European 1960 coordinates
  4. Geocentric transform from European 1960 to geographic coordinates
  5. Projection transformation from geographic European 1960/International to Mercator.