PJ Class Reference

Wraps the Proj4 More...

## Data Structures

enum | Type
| The coordinate reference system (CRS) type returned by PJ#getType().

## Public Member Functions

| PJ (final String definition) throws IllegalArgumentException
| Creates a new. More...
| PJ (final PJ crs, final Type type) throws IllegalArgumentException
| Creates a new. More...
native String | getDefinition ()
| Returns the Proj4 definition string. More...
native Type | getType ()
| Returns the Coordinate Reference System type. More...
native double | getSemiMajorAxis ()
| Returns the value stored in the. More...
native double | getSemiMinorAxis ()
| Returns the value computed from PJ fields by. More...
native double | getEccentricitySquared ()
| Returns the square of the ellipsoid eccentricity (ε²). More...
native char [] | getAxisDirections ()
| Returns an array of character indicating the direction of each axis. More...
native double | getGreenwichLongitude ()
| Longitude of the prime meridian measured from the Greenwich meridian, positive eastward. More...
native double | getLinearUnitToMetre (boolean vertical)
| Returns the conversion factor from the linear units to metres. More...
native void | transform (PJ target, int dimension, double[] coordinates, int offset, int numPts) throws PJException
| Transforms in-place the coordinates in the given array. More...
native String | getLastError ()
| Returns a description of the last error that occurred, or. More...
native String | toString ()
| Returns the string representation of the PJ structure. More...

## Static Public Member Functions

static native String | getVersion ()
| Returns the version number of the Proj4 library. More...

## Static Public Attributes

static final int | DIMENSION_MAX = 100
| The maximal number of dimension accepted by the transform(PJ, int, double[], int, int) method. More...

## Protected Member Functions

final native void | finalize ()
| Deallocates the native PJ data structure. More...

## Detailed Description

PJ

native data structure. Almost every methods defined in this class are native methods delegating the work to the Proj.4 library. This class is the only place where such native methods are defined.

In the Proj.4 library, the

PJ

structure aggregates in a single place information usually splitted in many different ISO 19111 interfaces: org.opengis.referencing.datum.Ellipsoid, org.opengis.referencing.datum.Datum, org.opengis.referencing.datum.PrimeMeridian, org.opengis.referencing.cs.CoordinateSystem, org.opengis.referencing.crs.CoordinateReferenceSystem and their sub-interfaces. The relationship with the GeoAPI methods is indicated in the "See" tags when appropriate.

Author
  Martin Desruisseaux (Geomatys)

## Constructor & Destructor Documentation

## PJ() [1/2]

PJ | ( | final String | definition | ) | throws IllegalArgumentException

PJ

structure from the given Proj4 definition string.

Parameters

  definition | The Proj.4 definition string.

Exceptions

  IllegalArgumentException | If the PJ structure can not be created from the given string.

## PJ() [2/2]

PJ | ( | final PJ | crs,
|  | final Type | type
| ) |  | throws IllegalArgumentException

PJ

structure derived from an existing

PJ

object. This constructor is usually for getting the org.opengis.referencing.crs.ProjectedCRS::getBaseCRS() base geographic CRS} from a org.opengis.referencing.crs.ProjectedCRS projected CRS}.

Parameters

  crs | The CRS (usually projected) from which to derive a new CRS.
  type | The type of the new CRS. Currently, only Type#GEOGRAPHIC is supported.

Exceptions

  IllegalArgumentException | If the PJ structure can not be created.

References PJ.finalize(), PJ.getAxisDirections(), PJ.getDefinition(), PJ.getEccentricitySquared(), PJ.getGreenwichLongitude(), PJ.getLastError(), PJ.getLinearUnitToMetre(), PJ.getSemiMajorAxis(), PJ.getSemiMinorAxis(), PJ.getType(), PJ.getVersion(), PJ.toString(), and PJ.transform().

## Member Function Documentation

## getVersion()

static native String getVersion | ( |  | ) |

static

Returns
  The Proj.4 release string.

Referenced by PJ.PJ().

## getDefinition()

native String getDefinition | ( |  | ) |

This is the string given to the constructor, expanded with as much information as possible.

Returns
  The Proj4 definition string.

Referenced by PJ.PJ().

## getType()

native Type getType | ( |  | ) |

Returns
  The CRS type.

Referenced by PJ.PJ().

## getSemiMajorAxis()

native double getSemiMajorAxis | ( |  | ) |

a_orig

PJ field.

Returns
  The axis length stored in
  a_orig
  .

See also
  org.opengis.referencing.datum.Ellipsoid::getSemiMajorAxis()

Referenced by PJ.PJ().

## getSemiMinorAxis()

native double getSemiMinorAxis | ( |  | ) |

√((a_orig)² × (1 - es_orig))

.

Returns
  The axis length computed by
  √((a_orig)² × (1 - es_orig))
  .

See also
  org.opengis.referencing.datum.Ellipsoid::getSemiMinorAxis()

Referenced by PJ.PJ().

## getEccentricitySquared()

native double getEccentricitySquared | ( |  | ) |

The eccentricity is related to axis length by ε=√(1-(b/a)²). The eccentricity of a sphere is zero.

Returns
  The eccentricity.

See also
  org.opengis.referencing.datum.Ellipsoid::isSphere()
  org.opengis.referencing.datum.Ellipsoid::getInverseFlattening()

Referenced by PJ.PJ().

## getAxisDirections()

native char [] getAxisDirections | ( |  | ) |

Directions are characters like

'e'

for East,

'n'

for North and

'u'

for Up.

Returns
  The axis directions.

See also
  org.opengis.referencing.cs.CoordinateSystemAxis::getDirection()

Referenced by PJ.PJ().

## getGreenwichLongitude()

native double getGreenwichLongitude | ( |  | ) |

Returns
  The prime meridian longitude, in degrees.

See also
  org.opengis.referencing.datum.PrimeMeridian::getGreenwichLongitude()

Referenced by PJ.PJ().

## getLinearUnitToMetre()

native double getLinearUnitToMetre | ( | boolean | vertical | ) |

Parameters

  vertical |

Referenced by PJ.PJ().

## transform()

native void transform | ( | PJ | target,
|  | int | dimension,
|  | double [] | coordinates,
|  | int | offset,
|  | int | numPts
| ) |  | throws PJException

The coordinates array shall contain (x,y,z,…) tuples, where the z and following dimensions are optional. Note that any dimension after the z value are ignored.

Input and output units:

- Angular units (as in longitude and latitudes) are decimal degrees.
- Linear units are usually metres, but this is actually projection-dependent.

Parameters

  target | The target CRS.
  dimension | The dimension of each coordinate value. Must be in the [2-{ DIMENSION_MAX}] range.
  coordinates | The coordinates to transform, as a sequence of (x,y,<z>,…) tuples.
  offset | Offset of the first coordinate in the given array.
  numPts | Number of points to transform.

Exceptions

  NullPointerException | If the target or coordinates argument is null.
  IndexOutOfBoundsException | if the offset or numPts arguments are invalid.
  PJException | If the operation failed for an other reason (provided by Proj4).

See also
  org.opengis.referencing.operation.MathTransform::transform(double[], int, double[], int, int)

Referenced by PJ.PJ().

## getLastError()

native String getLastError | ( |  | ) |

null

if none.

Returns
  The last error that occurred, or
  null
  .

Referenced by PJ.PJ().

## toString()

native String toString | ( |  | ) |

Returns
  The string representation.

Referenced by PJ.PJ().

## finalize()

final native void finalize | ( |  | ) |

protected

This method can be invoked only by the garbage collector, and must be invoked exactly once (no more, no less). NEVER INVOKE THIS METHOD EXPLICITELY, NEVER OVERRIDE.

Referenced by PJ.PJ().

## Field Documentation

## DIMENSION_MAX

final int DIMENSION_MAX = 100

static

This upper limit is actually somewhat arbitrary. This limit exists mostly as a safety against potential misuse.