Projection methods and parameters

Forward and inverse methods

Projections are implemented using the forward and inverse methods:
  • The forward method converts a geographic point, defined by a longitude and a latitude, to its Cartesian coordinates.
  • The inverse method converts Cartesian coordinates to a latitude and a longitude.
These methods can throw exceptions of two different types that both inherit from the class IlvProjectionException :
  • The IlvUnsupportedProjectionFeature exception is thrown when a feature that is not implemented is called. It originates from the following actions:
    • When trying to perform a forward projection on a nonspherical ellipsoid when the projection does not support nonspherical ellipsoids ( IlsEquidistantCylindricalProjection for example).
    • When trying to inverse a projection that cannot be reversed.
  • The IlvToleranceConditionException exception is thrown when an error occurs during computation.
To know whether these features are implemented in the projection you are using, use the methods isEllipsoidEnabled and isInverseEnabled.

Projection parameters

You can set the following parameters for a projection:
  • The ellipsoid that specifies the figure of the Earth.
    For more information on ellipsoids, refer to section Ellipsoids.
    Each projection is associated with an ellipsoid. By default, most of the projections use the ellipsoid SPHERE. Only some specific projections, such as the Universal Transverse Mercator or the Universal Polar Stereographic, use a nonspherical ellipsoid by default.
    You will obtain more accurate projections using an appropriate ellipsoid, especially with large scale maps. Note, however, that computations are more complex and slower than when using a sphere.
    To specify the ellipsoid you want to use for a projection, use the method setEllipsoid.
    IlvProjection projection = new IlvMercatorProjection();
    projection.setEllipsoid(IlvEllipsoid.WGS84);
    
    You can either use a static member of the class IlvEllipsoid , which defines a number of commonly used ellipsoids, or create your own ellipsoid as explained in the section Defining new ellipsoids. You can also use one of the predefined ellipsoids listed in the section Predefined ellipsoids.
  • The unit converter that specifies the measurement unit in which Cartesian coordinates should be expressed.
  • The central meridian and the central parallel of the projection.
    These parameters can be set with the setLLCenter method. Projections produce less distortion near their center.
  • The offset applied to the Cartesian coordinates, also called false easting and false northing. These parameters can be set with the method setXYOffset. The offset can be used in conjunction with the unit converters to control the range of projected coordinates for a region. For example, the range of the region may be set so that the region fits into a square of size 200 x 200. In JViews Maps applications, the range of the data is not an issue, since a transformer can be automatically applied to fit all the graphics contained in an IlvManager into a window. Therefore, false easting and false northing are mainly used to adapt a projection to geographic data that has already been projected using a Cartesian offset.
You can also:
  • Specify whether the coordinates are geodetic (the default value) or geocentric using the setGeocentric method.
    The geocentric latitude of a point is defined by the angle formed by a line joining the point to the center of the Earth and the equatorial plane, whereas the geodetic (or geographic) latitude of a point is defined by the angle formed by the vertical line passing through this point and the equatorial plane. The two values differ since the Earth is not exactly a sphere but rather an ellipsoid. Both latitudes are related through the relation tan phiG = (1 - e ^ 2) tan phi where e is the eccentricity of the ellipsoid used to model the shape of the Earth.
mapsprg_datums8.gif
If an application handles geocentric data, this parameter must be set. Most of the available cartographic data available is expressed with geographic latitudes.
  • Specify whether the projection uses longitude reduction, that is, forces longitude to be in the range [-PI;PI] or accepts any longitude, using the method setUsingLongitudeReduction.
The above parameters are common to all the projections. They can be set with the API of the class IlvProjection , which is the base class of all the projections in the package. Some projections have additional specific parameters. For example, secant latitudes can be specified for a conic projection, or the latitude of the true scale can be specified for most cylindrical projections. For more information, refer to the documentation of the API for each projection.

Projection utilities

The class IlvProjectionUtil provides conversion utilities to convert radians to degrees and degrees to radians.