Class GeographicTransformationStep


  • public final class GeographicTransformationStep
    extends Object
    Represents a step in the process of transforming coordinates from one datum to another.

    A geographic transformation step can be constructed from a well-known ID (WKID) that represents a known geographic transformation, using the create(int) factory method. Alternatively, a custom transformation can be constructed from well-known text using create(String). After creating a GeographicTransformationStep, one or more steps can be added to a GeographicTransformation, and used to project a Geometry.

     // Create a geometry located in London, UK, with British National Grid spatial reference
      Point britishNationalGridPt = new Point(538985.355, 177329.516, SpatialReference.create(27700));
     // Create a GeographicTransformation with a single step using WKID for OSGB_1936_To_WGS_1984_NGA_7PAR transformation
     GeographicTransformation transform = GeographicTransformation.create(GeographicTransformationStep.create(108336));
     // Project the point to WGS84, using the transformation
     Point wgs84Pt = (Point) GeometryEngine.project(britishNationalGridPt, SpatialReferences.getWgs84(), transform);
     

    This SDK supports thousands of geographic transformation WKIDs, which are documented in the developer Guide on the ArcGIS for Developers site. The list of supported WKIDs includes a transformation from every supported datum to WGS 1984. Additionally, there is a more limited list of transformations directly between two non-WGS84 datums, such as 4461, which is NAD_1983_HARN_To_NAD_1983_NSRS2007_1.

    Alternatively, transformations can be created by using the methods on TransformationCatalog.

    Some geographic transformations rely on supporting files to be present in a known location (see TransformationCatalog.getProjectionEngineDirectory). Use isMissingProjectionEngineFiles() to identify transformations for which the supporting files are missing. If true, then the transformation cannot be used to project geometries. Use getProjectionEngineFilenames() to identify which files are missing for this step.

    Geographic transformation steps are immutable. Use getInverse() to get a new step representing the same transformation in the opposite direction.

    Since:
    100.2.0
    See Also:
    GeographicTransformation, GeometryEngine.project(Geometry, SpatialReference, DatumTransformation)
    • Method Detail

      • create

        public static GeographicTransformationStep create​(int wkid)
        Creates a GeographicTransformationStep instance from the given well-known ID (WKID).

        If the WKID defines a grid-based transformation, the transformation can only be used if the supporting files are found on the local file system. See isMissingProjectionEngineFiles().

        Parameters:
        wkid - a string containing a WKID of the geographic transformation step to create
        Returns:
        a GeographicTransformationStep instance
        Throws:
        ArcGISRuntimeException - if wkid is invalid (is not a supported WKID). The list of supported WKIDs is documented in the developer Guide.
        Since:
        100.2.0
        See Also:
        getWkid()
      • create

        public static GeographicTransformationStep create​(String wkText)
        Creates a GeographicTransformationStep instance from the given well-known text (WKT) string.

        Some users adjust the components of a geographic transformation to suit their specific needs. These custom transformations use the existing methods of transformation (Position Vector, Geocentric_Translation, and so on) but have different parameter values than the well-known definitions. Create a custom geographic transformation object by passing in a text string containing your custom transformation expressed in WKT format. The resulting geographic transformation will have a WKID of zero.

        If the WKT defines a grid-based transformation, the transformation can only be used if the supporting files are found on the local file system. See isMissingProjectionEngineFiles().

        Parameters:
        wkText - a string containing a WKT representation of a GeographicTransformationStep
        Returns:
        a GeographicTransformationStep instance
        Throws:
        IllegalArgumentException - if wkText is null or empty
        ArcGISRuntimeException - if wkText is invalid (is not a well-formed geographic transformation text string)
        Since:
        100.2.0
        See Also:
        getWkText()
      • getInverse

        public GeographicTransformationStep getInverse()
        Gets the inverse of this geographic transformation step.

        The inverse of a transformation converts coordinates using the same method and parameters, but in the opposite direction of the original object. For example if the original object represents NAD_1983_HARN_To_NAD_1983_NSRS2007_1 transformation, then the inverse will transform from NAD83 (NSRS 2007) to NAD83 (HARN).

        To check the input and output SpatialReferences of a transformation step, add the step to a new GeographicTransformation, and check DatumTransformation.getInputSpatialReference() and DatumTransformation.getOutputSpatialReference().

        Returns:
        the inverse of this geographic transformation step or null if the transformation is not invertible
        Since:
        100.2.0
      • getWkText

        public String getWkText()
        Gets a string containing the well-known text representation of this GeographicTransformationStep.
        Returns:
        a well-known text representation of this GeographicTransformationStep
        Since:
        100.2.0
      • getWkid

        public int getWkid()
        Gets the well-known ID (WKID) representation of this GeographicTransformationStep.

        The list of supported WKIDs is documented in the developer Guide.

        Returns:
        a WKID representation of this GeographicTransformationStep, or 0 if this transformation was created from a custom well-known text string.
        Since:
        100.2.0
      • isMissingProjectionEngineFiles

        public boolean isMissingProjectionEngineFiles()
        Indicates if any files needed by the Projection Engine for this geographic transformation step are missing from the local file system.

        If true, this indicates that this transformation step is not currently usable; in this case, using the GeometryEngine.project(Geometry, SpatialReference, DatumTransformation) method with a transform including this step will throw an exception. In order for a transform step to be usable, two conditions must be satisfied:

        • In order for any Projection Engine files to be found, the root directory must have been successfully set before any transforms are used, using TransformationCatalog.setProjectionEngineDirectory(String). For JavaSE, if the default Projection Engine directory is found during Runtime initialization, explicitly setting the location is not required.
        • The specific Projection Engine files required by this step must be found within the Projection Engine directory. Use getProjectionEngineFilenames() to find out the filenames required by this step.

        If Projection Engine files are installed at run time, the app will need to be restarted for this value to change.

        Returns:
        true if any required files are missing; false otherwise
        Since:
        100.2.0
      • getProjectionEngineFilenames

        public List<String> getProjectionEngineFilenames()
        Gets the filenames that comprise the supporting dataset for this transformation.

        Projection Engine datasets are used by grid-based transformations; equation-based transformations do not require any supporting files.

        Each filename includes the path relative to TransformationCatalog.getProjectionEngineDirectory(), indicating the subdirectory (or directories) and the filename including extension.

        Returns:
        an unmodifiable List of the filenames that comprise the supporting dataset, or an empty List if this step does not require supporting files (is an equation-based transformation).
        Since:
        100.2.0
      • equals

        public boolean equals​(Object obj)
        Indicates whether some other object is "equal to" this GeographicTransformationStep. Returns true if the two transformation steps use the same method of transformation, and operate in the same direction.
        Overrides:
        equals in class Object
        Parameters:
        obj - the reference GeographicTransformationStep with which to compare
        Returns:
        true if this object has the same values as the obj argument; false otherwise
        Since:
        100.2.0
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object