public class PJ
extends Object
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
split 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.
Modifier and Type | Class | Description |
---|---|---|
static class |
PJ.Type |
The coordinate reference system (CRS) type returned by
getType() . |
Modifier and Type | Field | Description |
---|---|---|
static int |
DIMENSION_MAX |
The maximal number of dimension accepted by the
transform(PJ, int, double[], int, int)
method. |
Constructor | Description |
---|---|
PJ(String definition) |
Creates a new
PJ structure from the given Proj4 definition string. |
PJ(PJ crs,
PJ.Type type) |
Creates a new
PJ structure derived from an existing PJ object. |
Modifier and Type | Method | Description |
---|---|---|
protected void |
finalize() |
Deallocates the native PJ data structure.
|
char[] |
getAxisDirections() |
Returns an array of character indicating the direction of each axis.
|
String |
getDefinition() |
Returns the Proj4 definition string.
|
double |
getEccentricitySquared() |
Returns the square of the ellipsoid eccentricity (ε²).
|
double |
getGreenwichLongitude() |
Longitude of the prime meridian measured from the Greenwich meridian, positive eastward.
|
String |
getLastError() |
Returns a description of the last error that occurred, or
null if none. |
double |
getLinearUnitToMetre(boolean vertical) |
Returns the conversion factor from the linear units to metres.
|
double |
getSemiMajorAxis() |
Returns the value stored in the
a_orig PJ field. |
double |
getSemiMinorAxis() |
Returns the value computed from PJ fields by
\u221a((a_orig)² × (1 - es_orig)) . |
PJ.Type |
getType() |
Returns the Coordinate Reference System type.
|
static String |
getVersion() |
Returns the version number of the Proj4 library.
|
String |
toString() |
Returns the string representation of the PJ structure.
|
void |
transform(PJ target,
int dimension,
double[] coordinates,
int offset,
int numPts) |
Transforms in-place the coordinates in the given array.
|
public static final int DIMENSION_MAX
transform(PJ, int, double[], int, int)
method. This upper limit is actually somewhat arbitrary. This limit exists mostly as a safety
against potential misuse.public PJ(String definition) throws IllegalArgumentException
PJ
structure from the given Proj4 definition string.definition
- The Proj.4 definition string.IllegalArgumentException
- If the PJ structure can not be created from the given string.public PJ(PJ crs, PJ.Type type) throws IllegalArgumentException
PJ
structure derived from an existing PJ
object.
This constructor is usually for getting the
base geographic CRS
from a projected CRS.crs
- The CRS (usually projected) from which to derive a new CRS.type
- The type of the new CRS. Currently, only PJ.Type.GEOGRAPHIC
is supported.IllegalArgumentException
- If the PJ structure can not be created.public static String getVersion()
public String getDefinition()
public PJ.Type getType()
public double getSemiMajorAxis()
a_orig
PJ field.a_orig
.org.opengis.referencing.datum.Ellipsoid#getSemiMajorAxis()
public double getSemiMinorAxis()
\u221a((a_orig)² × (1 - es_orig))
.\u221a((a_orig)² × (1 - es_orig))
.org.opengis.referencing.datum.Ellipsoid#getSemiMinorAxis()
public double getEccentricitySquared()
org.opengis.referencing.datum.Ellipsoid#isSphere()
,
org.opengis.referencing.datum.Ellipsoid#getInverseFlattening()
public char[] getAxisDirections()
'e'
for East, 'n'
for North and 'u'
for Up.org.opengis.referencing.cs.CoordinateSystemAxis#getDirection()
public double getGreenwichLongitude()
org.opengis.referencing.datum.PrimeMeridian#getGreenwichLongitude()
public double getLinearUnitToMetre(boolean vertical)
vertical
- false
for the conversion factor of horizontal axes,
or true
for the conversion factor of the vertical axis.public void transform(PJ target, int dimension, double[] coordinates, int offset, int numPts) throws PJException
Input and output units:
target
- The target CRS.dimension
- The dimension of each coordinate value. Must be in the [2-100] 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.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).org.opengis.referencing.operation.MathTransform#transform(double[], int, double[], int, int)
public String getLastError()
null
if none.null
.public String toString()
toString
in class Object
protected final void finalize()
finalize
in class Object