As our example uses coordinate systems and transformation,
the relevant packages must be imported, as well as the projection
package for the Mercator projection definition:
import ilog.views.maps.*;
import ilog.views.maps.srs.coordsys.*;
import ilog.views.maps.srs.coordtrans.*;
import ilog.views.maps.projection.*;
The first important step is to define the source and
the target coordinate systems.
For the source coordinate system, some latitude and longitude
coordinates expressed in degrees are needed. This is the kind of coordinate
defined in a geographic coordinate system. In this example, the WGS84
coordinate is used. The WGS84 geographic coordinate system defines
ellipsoidal coordinates over the standard WGS84 ellipsoid.
IlvCoordinateSystem sourceCS = IlvGeographicCoordinateSystem.WGS84;
Now these coordinates must be changed to Mercator coordinates.
Then you can create a new projected coordinate system using the Mercator
projection to express coordinates. Note that the Mercator projection
should use exactly the same geodetic parameters as the WGS84 geographic
coordinate system. The latter is passed as the geographic coordinate
system of the projected coordinate system.
IlvCoordinateSystem targetCS =
new IlvProjectedCoordinateSystem("Mercator",
IlvGeographicCoordinateSystem.WGS84,
new IlvMercatorProjection(),
IlvLinearUnit.METER,
"X", // The X axis name
"Y"); // The Y axis name