Package noaa.coastwatch.util
Class GCTP
java.lang.Object
noaa.coastwatch.util.GCTP
- All Implemented Interfaces:
ProjectionConstants
,SpheroidConstants
The static routines in the General Cartographic Transformations
Package (GCTP) class handle the transformation of data coordinates
between common earth projection systems. The class is simply a
Java wrapper for the GCTP package in C. See the GCTPC
package documentation for full documentation on routine parameters
and usage.
The native methods of GCTP are no longer supported. Use
the
MapProjectionFactory
to create
and work with map projections. The GCTP parameter related methods
in this class are still useful for creating arrays of valid
parameters to pass to the map projection factory creation methods.- Since:
- 3.1.0
- Author:
- Mark Robinson
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
The GCTP requirements class helps determine the various parameters required for each projection. -
Field Summary
Modifier and TypeFieldDescriptionstatic final int
Print errors to both file and terminal.static final int
Decimal degrees units code.static final int
US Feet units code.static final int
Print errors to a file.static final int
International Feet units code.static final int
Meters units code.static final int
Do not print error messages.static final int
Radians units code.static final int
Arc Seconds units code.static final int
State Plane table units code.static final int
Print errors to the terminal.Fields inherited from interface noaa.coastwatch.util.trans.ProjectionConstants
ALASKA, ALBERS, AZMEQD, EQRECT, EQUIDC, GEO, GNOMON, GOOD, GVNSP, HAMMER, HOM, IMOLL, LAMAZ, LAMCC, MAX_PROJECTIONS, MERCAT, MILLER, MOLL, OBEQA, ORTHO, POLYC, PROJECTION_NAMES, PS, ROBIN, SNSOID, SOM, SPCS, STEREO, TM, USDEF, UTM, VGRINT, WAGIV, WAGVII
Fields inherited from interface noaa.coastwatch.util.trans.SpheroidConstants
AIRY, AUS_NAT, BESSEL, CLARKE1866, CLARKE1880, EVEREST, GRS1980, HOUGH, INT1909, INT1967, KRASS, MAX_SPHEROIDS, MERCURY1960, MOD_AIRY, MOD_EVEREST, MOD_MER1968, SE_ASIA, SPHERE, SPHEROID_INV_FLAT, SPHEROID_NAMES, SPHEROID_SEMI_MAJOR, SPHEROID_SEMI_MINOR, STD_RADIUS, WGS66, WGS72, WGS84
-
Method Summary
Modifier and TypeMethodDescriptionstatic double[]
forward
(double[] pos, int output_system) Deprecated.The native methods of GCTP are no longer supported.static double[]
gctp
(double[] input_coord, int input_system, int input_zone, double[] input_parameters, int input_units, int input_spheroid, int error_message_flag, String error_file, int jpr, String pfile, int output_system, int output_zone, double[] output_parameters, int output_unit, int output_spheroid, String NAD1927_zonefile, String NAD1983_zonefile) Deprecated.The native methods of GCTP are no longer supported.static GCTP.Requirements[]
getRequirements
(int system) Gets the requirements for the specified projection.static void
init_forward
(int output_system, int output_zone, double[] output_parameters, int output_spheroid, String NAD1927_zonefile, String NAD1983_zonefile) Deprecated.The native methods of GCTP are no longer supported.static void
init_inverse
(int input_system, int input_zone, double[] input_parameters, int input_spheroid, String NAD1927_zonefile, String NAD1983_zonefile) Deprecated.The native methods of GCTP are no longer supported.static double[]
inverse
(double[] pos, int input_system) Deprecated.The native methods of GCTP are no longer supported.static boolean
isSupportedSpheroid
(int spheroid, int system) Determines if the projection system supports the specified spheroid earth model.static void
Tests this class.static double
pack_angle
(double angle) Packs an angle in degrees to DDDMMMSSS.SS format.static boolean
supportsSpheroid
(int system) Determines if the projection system supports a generic spheroid earth model, or only a perfect sphere.static double
unpack_angle
(double angle) Unpacks an angle in DDDMMMSSS.SS format to degrees.
-
Field Details
-
RADIAN
public static final int RADIANRadians units code.- See Also:
-
FEET
public static final int FEETUS Feet units code.- See Also:
-
METER
public static final int METERMeters units code.- See Also:
-
SECOND
public static final int SECONDArc Seconds units code.- See Also:
-
DEGREE
public static final int DEGREEDecimal degrees units code.- See Also:
-
INT_FEET
public static final int INT_FEETInternational Feet units code.- See Also:
-
STPLN_TABLE
public static final int STPLN_TABLEState Plane table units code. The STPLN_TABLE unit value is specifically used for State Plane -- if units equals STPLN_TABLE and Datum is NAD83 -- actual units are retrieved from a table according to the zone. If Datum is NAD27 -- actual units will be feet. An error will occur with this unit if the projection is not State Plane.- See Also:
-
TERM
public static final int TERMPrint errors to the terminal.- See Also:
-
FILE
public static final int FILEPrint errors to a file.- See Also:
-
BOTH
public static final int BOTHPrint errors to both file and terminal.- See Also:
-
NEITHER
public static final int NEITHERDo not print error messages.- See Also:
-
-
Method Details
-
isSupportedSpheroid
public static boolean isSupportedSpheroid(int spheroid, int system) Determines if the projection system supports the specified spheroid earth model. This is the preferred method now oversupportsSpheroid(int)
because it gives more specific information about spheroids supported. This routine should be used prior to creating a map projection with theMapProjectionFactory
methods, to make sure that no error with be thrown if an incompatible projection system and spheroid model are attempted.- Parameters:
spheroid
- the spheroid to check for support.system
- the projection system to check for support.- Returns:
- true if the projection system supports the specified spheroid, or false if not.
-
supportsSpheroid
public static boolean supportsSpheroid(int system) Determines if the projection system supports a generic spheroid earth model, or only a perfect sphere.- Parameters:
system
- the projection system code.- Returns:
- true if the projection system supports a generic spheroid, or false if not.
-
getRequirements
Gets the requirements for the specified projection.- Parameters:
system
- the projection system code.- Returns:
- the parameter requirements or null if the projection system is invalid. Generally the requirements array only contains one element. If there is more than one way to specify parameters for the projection system, the array will contain each set of requirements.
-
gctp
@Deprecated public static double[] gctp(double[] input_coord, int input_system, int input_zone, double[] input_parameters, int input_units, int input_spheroid, int error_message_flag, String error_file, int jpr, String pfile, int output_system, int output_zone, double[] output_parameters, int output_unit, int output_spheroid, String NAD1927_zonefile, String NAD1983_zonefile) Deprecated.The native methods of GCTP are no longer supported. Use theMapProjectionFactory
to create and work with map projections.Performs a single coordinate transform. Both input and output coordinate parameters are specified.- Parameters:
input_coord
- the data coordinate to transform. Input coordinate values are either[x, y]
in a projection coordinate system or[lon, lat]
for geographic coordinates.input_system
- the projection type of the input coordinates. The projection type must be a valid GCTP projection code constant.input_zone
- the zone of the input coordinates if the input system is State Plane or UTM.input_parameters
- an array of 15 parameters for the input projection system.input_units
- the input coordinate units. The input units must be a valid GCTP units code constant.input_spheroid
- the input coordinate spheroid. The input spheroid must be a valid GCTP spheroid code constant.error_message_flag
- a flag to determine the destination of error messages. The value must beTERM
,FILE
,BOTH
, orNEITHER
. See the GCTP constants for details.error_file
- the file name for error messages.jpr
- a flag to determine the destination of projection parameter messages. The value must beTERM
,FILE
,BOTH
, orNEITHER
. See the GCTP constants for details.pfile
- the file name for projection parameter messages.output_system
- the projection type of the output coordinates. The projection type must be a valid GCTP projection code constant.output_zone
- the zone of the output coordinates if the output system is State Plane or UTM.output_parameters
- an array of 15 parameters for the output projection system.output_unit
- the output coordinate units. The output units must be a valid GCTP units code constant.output_spheroid
- the output coordinate spheroid. The output spheroid must be a valid GCTP spheroid code constant.NAD1927_zonefile
- the file containing NAD 1927 State Plane zone parameters.NAD1983_zonefile
- the file containing NAD 1983 State Plane zone parameters.- Returns:
- the transformed output coordinates. Coordinates are
either
[x, y]
in a projection coordinate system or[lon, lat]
for geographic coordinates.
-
init_forward
@Deprecated public static void init_forward(int output_system, int output_zone, double[] output_parameters, int output_spheroid, String NAD1927_zonefile, String NAD1983_zonefile) Deprecated.The native methods of GCTP are no longer supported. Use theMapProjectionFactory
to create and work with map projections.Initializes the forward transformation projection parameters. Subsequent calls to
forward
will use the specified projection parameters.Refer to the
gctp(double[], int, int, double[], int, int, int, java.lang.String, int, java.lang.String, int, int, double[], int, int, java.lang.String, java.lang.String)
routine output parameters for details. -
init_inverse
@Deprecated public static void init_inverse(int input_system, int input_zone, double[] input_parameters, int input_spheroid, String NAD1927_zonefile, String NAD1983_zonefile) Deprecated.The native methods of GCTP are no longer supported. Use theMapProjectionFactory
to create and work with map projections.Initializes the inverse transformation projection parameters. Subsequent calls to
inverse
will use the specified projection parameters.Refer to the
gctp(double[], int, int, double[], int, int, int, java.lang.String, int, java.lang.String, int, int, double[], int, int, java.lang.String, java.lang.String)
routine input parameters for details. -
forward
Deprecated.The native methods of GCTP are no longer supported. Use theMapProjectionFactory
to create and work with map projections.Transforms coordinates from geographic to projection system.- Parameters:
pos
- the coordinates to transform as[lon, lat]
in radians.output_system
- the projection type of the output coordinates. The projection type must be a valid GCTP projection code constant.- Returns:
- the transformed output coordinates as
[x, y]
. - Throws:
Exception
- if the forward transform failed. Usually, this is because some geographic coordinates have no valid map coordinates.- See Also:
-
inverse
Deprecated.The native methods of GCTP are no longer supported. Use theMapProjectionFactory
to create and work with map projections.Transforms coordinates from projection system to geographic.- Parameters:
pos
- the coordinates to transform in[x, y]
.input_system
- the projection type of the input coordinates. The projection type must be a valid GCTP projection code constant.- Returns:
- the transformed output coordinates as
[lon, lat]
in radians. - Throws:
Exception
- if the inverse transform failed.- See Also:
-
pack_angle
public static double pack_angle(double angle) Packs an angle in degrees to DDDMMMSSS.SS format.- Parameters:
angle
- the angle in degrees.- Returns:
- the packed angle in DDDMMMSSS.SS format.
-
unpack_angle
public static double unpack_angle(double angle) Unpacks an angle in DDDMMMSSS.SS format to degrees.- Parameters:
angle
- the packed angle in DDDMMMSSS.SS format.- Returns:
- the angle in degrees.
-
main
Tests this class.- Parameters:
argv
- the array of command line parameters.- Throws:
Exception
-