org.geotools.referencing.operation.transform
Class NADCONTransform

java.lang.Object
  extended byorg.geotools.referencing.wkt.Formattable
      extended byorg.geotools.referencing.operation.transform.AbstractMathTransform
          extended byorg.geotools.referencing.operation.transform.NADCONTransform
All Implemented Interfaces:
org.opengis.referencing.operation.MathTransform, org.opengis.referencing.operation.MathTransform2D, java.io.Serializable

public class NADCONTransform
extends AbstractMathTransform
implements org.opengis.referencing.operation.MathTransform2D, java.io.Serializable

Transform backed by the North American Datum Conversion grid. The North American Datum Conversion (NADCON) Transform (EPSG code 9613) is a two dimentional datum shift method, created by the National Geodetic Survey (NGS), that uses interpolated values from two grid shift files. This method is used to transform NAD27 (EPSG code 4267) datum coordinates (and some others) to NAD83 (EPSG code 4267) within the United States. There are two set of grid shift files: NADCON and High Accuracy Reference Networks (HARN). NADCON shfts from NAD27 (and some others) to NAD83 while HARN shifts from the NADCON NAD83 to an improved NAD83. Both sets of grid shift files may be downloaded from www.ngs.noaa.gov/PC_PROD/NADCON/.

Some of the NADCON grids, their areas of use, and source datums are shown in the following table.

Shift File NameAreaSource DatumAccuracy at 67% confidence (m)
CONUSConterminous U S (lower 48 states)NAD270.15
ALASKAAlaska, incl. Aleutian IslandsNAD270.5
HAWAIIHawaiian IslandsOld Hawaiian (4135)0.2
STLRNCSt. Lawrence Is., AKSt. Lawrence Island (4136)--
STPAUL St. Paul Is., AKSt. Paul Island (4137)--
STGEORGESt. George Is., AKSt. George Island (4138)--
PRVIPuerto Rico and the Virgin IslandsPuerto Rico (4139)0.05

Grid shift files come in two formats: binary and text. The files from the NGS are binary and have (latitude shift) and (longitude shift) extentions. Text grids may be created with the NGS nadgrd program and have (latitude shift) and (longitude shift) file extentions. Both types of files may be used here.

The grid names to use for transforming are parameters of this MathTransform. This parameter may be the full name and path to the grids or just the name of the grids if the default location of the grids was set as a preference. This preference may be set with the main method of this class.

Transformations here have been tested to be within 0.00001 seconds of values given by the NGS ndcon210 program for NADCON grids. American Samoa and HARN shifts have not yet been tested. References:

Since:
2.1
Version:
$Id: NADCONTransform.java 17672 2006-01-19 00:25:55Z desruisseaux $
Author:
Rueben Schulz
See Also:
NADCON - North American Datum Conversion Utility, Serialized Form
To Do:
the transform code does not deal with the case where grids cross +- 180 degrees.

Nested Class Summary
static class NADCONTransform.Provider
          The provider for NADCONTransform.
 
Constructor Summary
NADCONTransform(java.lang.String latGridName, java.lang.String longGridName)
          Constructs a from the specified grid shift files.
 
Method Summary
 boolean equals(java.lang.Object object)
          Compares the specified object with this math transform for equality.
 org.opengis.parameter.ParameterDescriptorGroup getParameterDescriptors()
          Returns the parameter descriptors for this math transform.
 org.opengis.parameter.ParameterValueGroup getParameterValues()
          Returns the parameter values for this math transform.
 int getSourceDimensions()
          Gets the dimension of input points (always 2).
 int getTargetDimensions()
          Gets the dimension of output points (always 2).
 int hashCode()
          Returns a hash value for this transform.
 org.opengis.referencing.operation.MathTransform inverse()
          Returns the inverse of this transform.
 void inverseTransform(double[] srcPts, int srcOff, double[] dstPts, int dstOff, int numPts)
          Transforms nad83 values to nad27.
static void main(java.lang.String[] args)
          Used to set the preference for the default grid shift file location.
 void transform(double[] srcPts, int srcOff, double[] dstPts, int dstOff, int numPts)
          Transforms a list of coordinate point ordinal values.
 
Methods inherited from class org.geotools.referencing.operation.transform.AbstractMathTransform
createTransformedShape, derivative, derivative, ensureNonNull, formatWKT, getDimSource, getDimTarget, isIdentity, needCopy, rollLongitude, transform, transform, transform
 
Methods inherited from class org.geotools.referencing.wkt.Formattable
toString, toWKT, toWKT, toWKT
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.opengis.referencing.operation.MathTransform2D
createTransformedShape, derivative, transform
 
Methods inherited from interface org.opengis.referencing.operation.MathTransform
derivative, isIdentity, toWKT, transform, transform
 

Constructor Detail

NADCONTransform

public NADCONTransform(java.lang.String latGridName,
                       java.lang.String longGridName)
                throws org.opengis.parameter.ParameterNotFoundException,
                       org.opengis.referencing.FactoryException
Constructs a from the specified grid shift files.

Parameters:
latGridName - path and name (or just name if #GRID_LOCATION is set) to the latitude difference file. This will have a or file extention.
longGridName - path and name (or just name if #GRID_LOCATION is set) to the longitude difference file. This will have a or file extention.
Throws:
org.opengis.parameter.ParameterNotFoundException - if a math transform parameter cannot be found.
org.opengis.referencing.FactoryException - if there is a problem creating this math transform (ie file extentions are unknown or there is an error reading the grid files)
Method Detail

getParameterDescriptors

public org.opengis.parameter.ParameterDescriptorGroup getParameterDescriptors()
Returns the parameter descriptors for this math transform.

Overrides:
getParameterDescriptors in class AbstractMathTransform
Returns:
The parameter descriptors for this math transform, or .
See Also:
OperationMethod.getParameters()

getParameterValues

public org.opengis.parameter.ParameterValueGroup getParameterValues()
Returns the parameter values for this math transform.

Overrides:
getParameterValues in class AbstractMathTransform
Returns:
A copy of the parameter values for this math transform.
See Also:
Operation.getParameterValues()

getSourceDimensions

public int getSourceDimensions()
Gets the dimension of input points (always 2).

Specified by:
getSourceDimensions in interface org.opengis.referencing.operation.MathTransform
Specified by:
getSourceDimensions in class AbstractMathTransform
Returns:
the source dimensions.

getTargetDimensions

public int getTargetDimensions()
Gets the dimension of output points (always 2).

Specified by:
getTargetDimensions in interface org.opengis.referencing.operation.MathTransform
Specified by:
getTargetDimensions in class AbstractMathTransform
Returns:
the target dimensions.

transform

public void transform(double[] srcPts,
                      int srcOff,
                      double[] dstPts,
                      int dstOff,
                      int numPts)
               throws org.opengis.referencing.operation.TransformException
Transforms a list of coordinate point ordinal values. This method is provided for efficiently transforming many points. The supplied array of ordinal values will contain packed ordinal values. For example, if the source dimension is 3, then the ordinals will be packed in this order: (x0,y0,z0, x1,y1,z1 ...). All input and output values are in degrees.

Specified by:
transform in interface org.opengis.referencing.operation.MathTransform
Parameters:
srcPts - the array containing the source point coordinates.
srcOff - the offset to the first point to be transformed in the source array.
dstPts - the array into which the transformed point coordinates are returned. May be the same than .
dstOff - the offset to the location of the first transformed point that is stored in the destination array.
numPts - the number of point objects to be transformed.
Throws:
org.opengis.referencing.operation.TransformException - if the input point is outside the area covered by this grid.

inverseTransform

public void inverseTransform(double[] srcPts,
                             int srcOff,
                             double[] dstPts,
                             int dstOff,
                             int numPts)
                      throws org.opengis.referencing.operation.TransformException
Transforms nad83 values to nad27. Input and output values are in degrees. This is done by itteratively finding a nad27 value that shifts to the input nad83 value. The input nad83 value is used as the first approximation.

Parameters:
srcPts - the array containing the source point coordinates.
srcOff - the offset to the first point to be transformed in the source array.
dstPts - the array into which the transformed point coordinates are returned. May be the same than .
dstOff - the offset to the location of the first transformed point that is stored in the destination array.
numPts - the number of point objects to be transformed.
Throws:
org.opengis.referencing.operation.TransformException - if the input point is outside the area covered by this grid.

inverse

public org.opengis.referencing.operation.MathTransform inverse()
Returns the inverse of this transform.

Specified by:
inverse in interface org.opengis.referencing.operation.MathTransform
Overrides:
inverse in class AbstractMathTransform
Returns:
the inverse of this transform

hashCode

public final int hashCode()
Returns a hash value for this transform. To make this faster it does not check the grid values.

Overrides:
hashCode in class AbstractMathTransform
Returns:
a hash value for this transform.

equals

public final boolean equals(java.lang.Object object)
Compares the specified object with this math transform for equality.

Overrides:
equals in class AbstractMathTransform
Parameters:
object - the object to compare to
Returns:
if the objects are equal.

main

public static void main(java.lang.String[] args)
Used to set the preference for the default grid shift file location. This allows grids parameters to be specified by name only, without the full path. This needs to be done only once, by the user. Path values may be simple file system paths or more complex text representations of a url. A value of "default" resets this preference to its default value.

Example:

 java org.geotools.referencing.operation.transform.NADCONTransform file:///home/rschulz/GIS/NADCON/data
 

Parameters:
args - a single argument for the defualt location of grid shift files


Copyright © GeoTools. All Rights Reserved.